@@ -9,13 +9,15 @@ final public class Problem implements xsbti.Problem {
99 private final String _message ;
1010 private final Severity _severity ;
1111 private final Optional <String > _rendered ;
12+ private final String _diagnosticCode ;
1213
13- public Problem (Position position , String message , Severity severity , String rendered ) {
14+ public Problem (Position position , String message , Severity severity , String rendered , String diagnosticCode ) {
1415 super ();
1516 this ._position = position ;
1617 this ._message = message ;
1718 this ._severity = severity ;
1819 this ._rendered = Optional .of (rendered );
20+ this ._diagnosticCode = diagnosticCode ;
1921 }
2022
2123 public String category () {
@@ -38,8 +40,17 @@ public Optional<String> rendered() {
3840 return _rendered ;
3941 }
4042
43+ public Optional <xsbti .DiagnosticCode > diagnosticCode () {
44+ // NOTE: It's important for compatibility that we only construct a
45+ // DiagnosticCode here to maintain compatibility with older versions of
46+ // zinc while using this newer version of the compiler. If we would
47+ // contstruct it earlier, you'd end up with ClassNotFoundExceptions for
48+ // DiagnosticCode.
49+ return Optional .of (new DiagnosticCode (_diagnosticCode , Optional .empty ()));
50+ }
51+
4152 @ Override
4253 public String toString () {
43- return "Problem(" + _position + ", " + _message + ", " + _severity + ", " + _rendered + ")" ;
54+ return "Problem(" + _position + ", " + _message + ", " + _severity + ", " + _rendered + ", " + _diagnosticCode + " )" ;
4455 }
4556}
0 commit comments