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 key, @Nullable String message, boolean isFixable)
      Basic constructor that sets the immutable fields of this diagnostic.
      Parameters:
      filename - the file to which the diagnostic applies
      lineNumber - the line number to which the diagnostic applies
      kind - kind of diagnostic
      key - an error key or full error message
      message - the full error message, without the key; null if the key is the whole message
      isFixable - true if this diagnostic should no longer be reported after whole-program inference
  • Method Details

    • getFilename

      public String getFilename()
    • getLineNumber

      public long getLineNumber()
    • getKind

      public DiagnosticKind getKind()
    • getKey

      public String getKey()
      Returns the error message key.
      Returns:
      the error message key
    • getMessage

      public @Nullable String getMessage()
      Returns the full error message, without the key.
      Returns:
      the full error message, without the key
    • isFixable

      public boolean isFixable()
      Returns true if this diagnostic should no longer be reported after whole-program inference.
      Returns:
      true if this diagnostic should no longer be reported after whole-program inference
    • equals

      public boolean equals(@Nullable Object otherObj)
      Equality is compared without fields message and isFixable.
      Overrides:
      equals in class Object
      Returns:
      true if this and otherObj are equal according to filename, lineNumber, kind, and message key
    • 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