@@ -48,22 +48,17 @@ public void printSummary(Context ctx) {
48
48
public void doReport (Diagnostic dia , Context ctx ) {
49
49
Severity severity = severityOf (dia .level ());
50
50
Position position = positionOf (dia .pos ().nonInlined ());
51
-
52
- StringBuilder rendered = new StringBuilder ();
53
- rendered .append (messageAndPos (dia , ctx ));
54
51
Message message = dia .msg ();
55
- StringBuilder messageBuilder = new StringBuilder ();
56
- messageBuilder .append (message .message ());
52
+ String text ;
53
+ if (Diagnostic .shouldExplain (dia , ctx ) && !message .explanation ().isEmpty ())
54
+ text = message .message () + System .lineSeparator () + explanation (message , ctx );
55
+ else
56
+ text = message .message ();
57
+ String rendered = messageAndPos (dia , ctx );
57
58
String diagnosticCode = String .valueOf (message .errorId ().errorNumber ());
58
- boolean shouldExplain = Diagnostic .shouldExplain (dia , ctx );
59
59
List <CodeAction > actions = CollectionConverters .asJava (message .actions (ctx ));
60
- if (shouldExplain && !message .explanation ().isEmpty ()) {
61
- rendered .append (explanation (message , ctx ));
62
- messageBuilder .append (System .lineSeparator ()).append (explanation (message , ctx ));
63
- }
64
-
65
- delegate .log (new Problem (position , messageBuilder .toString (), severity , rendered .toString (), diagnosticCode , actions ,
66
- lookupVirtualFileId ));
60
+ Problem problem = new Problem (position , text , severity , rendered , diagnosticCode , actions , lookupVirtualFileId );
61
+ delegate .log (problem );
67
62
}
68
63
69
64
public void reportBasicWarning (String message ) {
0 commit comments