Class TestDiagnostic

java.lang.Object
org.checkerframework.framework.test.diagnostics.TestDiagnostic

public class TestDiagnostic extends Object
Represents an expected error/warning message in a Java test file or an error/warning reported by the Javac compiler. By contrast, TestDiagnosticLine represents a set of TestDiagnostics, all of which were read from the same line of a file.
See Also:
  • Constructor Details

    • TestDiagnostic

      public TestDiagnostic(String filename, long lineNumber, DiagnosticKind kind, String message, boolean isFixable, boolean omitParentheses)
      Basic constructor that sets the immutable fields of this diagnostic.
  • Method Details

    • getFilename

      public String getFilename()
    • getLineNumber

      public long getLineNumber()
    • getKind

      public DiagnosticKind getKind()
    • getMessage

      public String getMessage()
    • isFixable

      public boolean isFixable()
    • shouldOmitParentheses

      public boolean shouldOmitParentheses()
      Returns whether or not the printed representation should omit parentheses around the message.
      Returns:
      whether or not the printed representation should omit parentheses around the message
    • equals

      public boolean equals(@Nullable Object otherObj)
      Equality is compared without isFixable/omitParentheses.
      Overrides:
      equals in class Object
      Returns:
      true if this and otherObj are equal according to filename, lineNumber, kind, and message
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a representation of this diagnostic as if it appeared in a diagnostics file.
      Overrides:
      toString in class Object
      Returns:
      a representation of this diagnostic as if it appeared in a diagnostics file
    • repr

      public String repr()
      Returns the internal representation of this, formatted.
      Returns:
      the internal representation of this, formatted