Class ValidationError
- java.lang.Object
-
- com.tonic.analysis.source.ast.validation.ValidationError
-
public final class ValidationError extends Object
A single issue reported by AST validation, with severity, category, and offending node.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValidationError.CategoryThe aspect of the AST a validation issue concerns.static classValidationError.SeverityHow serious a validation issue is.
-
Constructor Summary
Constructors Constructor Description ValidationError(ValidationError.Severity severity, ValidationError.Category category, String message, ASTNode node)Creates an issue, taking its location from the node when one is given.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static ValidationErrorerror(ValidationError.Category category, String message, ASTNode node)Creates an error-severity issue.ValidationError.CategorygetCategory()SourceLocationgetLocation()StringgetMessage()ASTNodegetNode()ValidationError.SeveritygetSeverity()inthashCode()static ValidationErrorinfo(ValidationError.Category category, String message, ASTNode node)Creates an info-severity issue.booleanisError()booleanisWarning()static ValidationErrornullCheck(String message, ASTNode node)Creates a NULL_CHECK error.static ValidationErrorstructural(String message, ASTNode node)Creates a STRUCTURAL error.StringtoString()static ValidationErrortypeError(String message, ASTNode node)Creates a TYPE error.static ValidationErrorwarning(ValidationError.Category category, String message, ASTNode node)Creates a warning-severity issue.
-
-
-
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 iscategory- what the issue concernsmessage- the issue descriptionnode- 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 concernsmessage- the issue descriptionnode- 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 concernsmessage- the issue descriptionnode- 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 concernsmessage- the issue descriptionnode- 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 descriptionnode- 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 descriptionnode- 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 descriptionnode- the offending node, may be null- Returns:
- the issue
-
getSeverity
public ValidationError.Severity getSeverity()
- Returns:
- the severity
-
getCategory
public ValidationError.Category getCategory()
- Returns:
- the category
-
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
-
-