Record Class Diagnostic
java.lang.Object
java.lang.Record
ca.mcscert.jpipe.compiler.model.Diagnostic
- Record Components:
level- severity of the diagnostic.source- path to the file that triggered it.line- 1-based source line, or0if unknown.column- 0-based column offset, or0if unknown.message- human-readable description.
public record Diagnostic(Diagnostic.Level level, String source, int line, int column, String message)
extends Record
A single diagnostic message produced during compilation.
line and column carry the source location when known; both
are 0 when no location is available (ANTLR lines are 1-based, so
0 is a safe sentinel).
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSentinel value forlineandcolumnwhen no location is known. -
Constructor Summary
ConstructorsConstructorDescriptionDiagnostic(Diagnostic.Level level, String source, int line, int column, String message) Creates an instance of aDiagnosticrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcolumn()Returns the value of thecolumnrecord component.final booleanIndicates whether some other object is "equal to" this one.static Diagnosticstatic Diagnosticstatic Diagnosticstatic Diagnosticfinal inthashCode()Returns a hash code value for this object.booleanTrue if this diagnostic carries a known source location.booleanisError()True for ERROR and FATAL.booleanisFatal()True only for FATAL.level()Returns the value of thelevelrecord component.intline()Returns the value of thelinerecord component.message()Returns the value of themessagerecord component.source()Returns the value of thesourcerecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNKNOWN_LOCATION
public static final int UNKNOWN_LOCATIONSentinel value forlineandcolumnwhen no location is known.- See Also:
-
-
Constructor Details
-
Diagnostic
Creates an instance of aDiagnosticrecord class.
-
-
Method Details
-
hasLocation
public boolean hasLocation()True if this diagnostic carries a known source location. -
error
-
fatal
-
error
-
fatal
-
isError
public boolean isError()True for ERROR and FATAL. -
isFatal
public boolean isFatal()True only for FATAL. -
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
level
-
source
-
line
-
column
-
message
-