Class VerificationError


  • public final class VerificationError
    extends Object
    One immutable verification finding: a typed error or warning with an optional bytecode offset and location.
    • Constructor Detail

      • VerificationError

        public VerificationError​(VerificationErrorType type,
                                 int bytecodeOffset,
                                 String message)
        Creates an ERROR-severity finding with no location.
        Parameters:
        type - the error category
        bytecodeOffset - the offending bytecode offset, or -1 if not tied to an offset
        message - the detail message, or null for the type's description
      • VerificationError

        public VerificationError​(VerificationErrorType type,
                                 int bytecodeOffset,
                                 String message,
                                 VerificationError.Severity severity)
        Creates a finding with an explicit severity and no location.
        Parameters:
        type - the error category
        bytecodeOffset - the offending bytecode offset, or -1 if not tied to an offset
        message - the detail message, or null for the type's description
        severity - the severity, or null for ERROR
      • VerificationError

        public VerificationError​(VerificationErrorType type,
                                 int bytecodeOffset,
                                 String message,
                                 VerificationError.Severity severity,
                                 String className,
                                 String methodName)
        Creates a finding with an explicit severity and location; null message and severity fall back to the type's description and ERROR.
        Parameters:
        type - the error category
        bytecodeOffset - the offending bytecode offset, or -1 if not tied to an offset
        message - the detail message, or null for the type's description
        severity - the severity, or null for ERROR
        className - the enclosing class name, or null
        methodName - the enclosing method name, or null
    • Method Detail

      • withLocation

        public VerificationError withLocation​(String className,
                                              String methodName)
        Copies this error with a class and method location attached.
        Parameters:
        className - the enclosing class name
        methodName - the enclosing method name
        Returns:
        a new error with the location set
      • getBytecodeOffset

        public int getBytecodeOffset()
        Returns:
        the bytecode offset
      • getMessage

        public String getMessage()
        Returns:
        the message
      • getMethodName

        public String getMethodName()
        Returns:
        the method name
      • getClassName

        public String getClassName()
        Returns:
        the class name
      • isError

        public boolean isError()
        Returns:
        true if severity is ERROR
      • isWarning

        public boolean isWarning()
        Returns:
        true if severity is WARNING
      • format

        public String format()
        Formats this finding as one line with severity, type, location, offset, and message.
        Returns:
        the formatted line
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object