Record Class SemanticError
java.lang.Object
java.lang.Record
com.darkcollective.relix.semantic.SemanticError
- Record Components:
filePath- the path of the source file; must not be nullline- the 1-based source line (0 = no position)column- the 1-based source column (0 = no position)message- a human-readable description of the problem; must not be blankseverity- whether this is an error or a warning
public record SemanticError(String filePath, int line, int column, String message, Severity severity)
extends Record
A single diagnostic produced during semantic analysis of a
.relix script.
Every error carries the path of the file it originated from together with
the line and column of the problematic source construct. Line and column are
1-based; a value of 0 indicates that no meaningful position is available
(e.g. for file-level errors such as a missing import file).
Factory methods cover the two common cases:
SemanticError.error("./api.relix", 12, 5, "Unknown relation 'Foo'");
SemanticError.warning("./api.relix", 3, 1, "Unused import 'bar'");
-
Constructor Summary
ConstructorsConstructorDescriptionSemanticError(String filePath, int line, int column, String message, Severity severity) Creates an instance of aSemanticErrorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcolumn()Returns the value of thecolumnrecord component.final booleanIndicates whether some other object is "equal to" this one.static SemanticErrorCreates anSeverity.ERROR-severity diagnostic.filePath()Returns the value of thefilePathrecord component.final inthashCode()Returns a hash code value for this object.intline()Returns the value of thelinerecord component.message()Returns the value of themessagerecord component.severity()Returns the value of theseverityrecord component.toString()Returns a human-readable representation in the form<file>:<line>:<col>: <severity>: <message>.static SemanticErrorCreates aSeverity.WARNING-severity diagnostic.
-
Constructor Details
-
SemanticError
Creates an instance of aSemanticErrorrecord class.
-
-
Method Details
-
error
Creates anSeverity.ERROR-severity diagnostic.- Parameters:
filePath- the source file pathline- 1-based line number (0 = no position)column- 1-based column number (0 = no position)message- the error description; must not be blank- Returns:
- a new
SemanticError
-
warning
Creates aSeverity.WARNING-severity diagnostic.- Parameters:
filePath- the source file pathline- 1-based line number (0 = no position)column- 1-based column number (0 = no position)message- the warning description; must not be blank- Returns:
- a new
SemanticError
-
toString
Returns a human-readable representation in the form<file>:<line>:<col>: <severity>: <message>. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
filePath
Returns the value of thefilePathrecord component.- Returns:
- the value of the
filePathrecord component
-
line
public int line()Returns the value of thelinerecord component.- Returns:
- the value of the
linerecord component
-
column
public int column()Returns the value of thecolumnrecord component.- Returns:
- the value of the
columnrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-
severity
Returns the value of theseverityrecord component.- Returns:
- the value of the
severityrecord component
-