Skip to content

Commit

Permalink
HV-1863 Add the message in the diagnostic for easier error tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed May 4, 2022
1 parent c65705e commit 03751c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

import javax.annotation.processing.Processor;
Expand Down Expand Up @@ -253,7 +254,7 @@ private static Set<DiagnosticExpectation> asExpectations(Collection<Diagnostic<?
Set<DiagnosticExpectation> theValue = CollectionHelper.newTreeSet();

for ( Diagnostic<? extends JavaFileObject> diagnostic : diagnosticsList ) {
theValue.add( new DiagnosticExpectation( diagnostic.getKind(), diagnostic.getLineNumber() ) );
theValue.add( new DiagnosticExpectation( diagnostic.getKind(), diagnostic.getLineNumber(), diagnostic.getMessage( Locale.ROOT ) ) );
}

return theValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,18 @@ public class DiagnosticExpectation implements Comparable<DiagnosticExpectation>

private final long lineNumber;

private final String message;

public DiagnosticExpectation(Kind kind, long lineNumber) {
this.kind = kind;
this.lineNumber = lineNumber;
this.message = null;
}

public DiagnosticExpectation(Kind kind, long lineNumber, String message) {
this.kind = kind;
this.lineNumber = lineNumber;
this.message = message;
}

public Kind getKind() {
Expand All @@ -34,7 +43,7 @@ public long getLineNumber() {

@Override
public String toString() {
return "DiagnosticExpectation [kind=" + kind + ", lineNumber=" + lineNumber + "]";
return "DiagnosticExpectation [kind=" + kind + ", lineNumber=" + lineNumber + ", message=" + message + "]";
}

@Override
Expand Down

0 comments on commit 03751c4

Please sign in to comment.