Class ValidationError


  • public final class ValidationError
    extends Object
    A single issue reported by AST validation, with severity, category, and offending node.
    • Constructor Detail

      • ValidationError

        public ValidationError​(ValidationError.Severity severity,
                               ValidationError.Category category,
                               String message,
                               ASTNode node)
        Creates an issue, taking its location from the node when one is given.
        Parameters:
        severity - how serious the issue is
        category - what the issue concerns
        message - the issue description
        node - the offending node, may be null
        Throws:
        NullPointerException - if severity, category, or message is null
    • Method Detail

      • error

        public static ValidationError error​(ValidationError.Category category,
                                            String message,
                                            ASTNode node)
        Creates an error-severity issue.
        Parameters:
        category - what the issue concerns
        message - the issue description
        node - the offending node, may be null
        Returns:
        the issue
      • warning

        public static ValidationError warning​(ValidationError.Category category,
                                              String message,
                                              ASTNode node)
        Creates a warning-severity issue.
        Parameters:
        category - what the issue concerns
        message - the issue description
        node - the offending node, may be null
        Returns:
        the issue
      • info

        public static ValidationError info​(ValidationError.Category category,
                                           String message,
                                           ASTNode node)
        Creates an info-severity issue.
        Parameters:
        category - what the issue concerns
        message - the issue description
        node - the offending node, may be null
        Returns:
        the issue
      • structural

        public static ValidationError structural​(String message,
                                                 ASTNode node)
        Creates a STRUCTURAL error.
        Parameters:
        message - the issue description
        node - the offending node, may be null
        Returns:
        the issue
      • typeError

        public static ValidationError typeError​(String message,
                                                ASTNode node)
        Creates a TYPE error.
        Parameters:
        message - the issue description
        node - the offending node, may be null
        Returns:
        the issue
      • nullCheck

        public static ValidationError nullCheck​(String message,
                                                ASTNode node)
        Creates a NULL_CHECK error.
        Parameters:
        message - the issue description
        node - the offending node, may be null
        Returns:
        the issue
      • getMessage

        public String getMessage()
        Returns:
        the message
      • getNode

        public ASTNode getNode()
        Returns:
        the node
      • getLocation

        public SourceLocation getLocation()
        Returns:
        the location
      • isError

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

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

        public int hashCode()
        Overrides:
        hashCode in class Object