Class TestDiagnostic


  • public class TestDiagnostic
    extends java.lang.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:
    JavaDiagnosticReader
    • Constructor Summary

      Constructors 
      Constructor Description
      TestDiagnostic​(java.lang.String filename, long lineNumber, DiagnosticKind kind, java.lang.String message, boolean isFixable, boolean omitParentheses)
      Basic constructor that sets the immutable fields of this diagnostic.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(@Nullable java.lang.Object otherObj)
      Equality is compared without isFixable/omitParentheses.
      java.lang.String getFilename()  
      DiagnosticKind getKind()  
      long getLineNumber()  
      java.lang.String getMessage()  
      int hashCode()  
      boolean isFixable()  
      java.lang.String repr()
      Returns the internal representation of this, formatted.
      boolean shouldOmitParentheses()
      Returns whether or not the printed representation should omit parentheses around the message.
      java.lang.String toString()
      Returns a representation of this diagnostic as if it appeared in a diagnostics file.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • TestDiagnostic

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

      • getFilename

        public java.lang.String getFilename()
      • getLineNumber

        public long getLineNumber()
      • getMessage

        public java.lang.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 java.lang.Object otherObj)
        Equality is compared without isFixable/omitParentheses.
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this and otherObj are equal according to filename, lineNumber, kind, and message
      • hashCode

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

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

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