Class LocatedMessage
java.lang.Object
org.codehaus.groovy.control.messages.Message
org.codehaus.groovy.control.messages.SimpleMessage
org.codehaus.groovy.control.messages.LocatedMessage
- Direct Known Subclasses:
WarningMessage
A base class for compilation messages.
-
Field Summary
Fields inherited from class org.codehaus.groovy.control.messages.SimpleMessage
data, message, owner -
Constructor Summary
ConstructorsConstructorDescriptionLocatedMessage(String message, Object data, CSTNode context, SourceUnit source) Creates a located message with supplemental data.LocatedMessage(String message, CSTNode context, SourceUnit source) Creates a located message with the supplied text. -
Method Summary
Modifier and TypeMethodDescriptionReturns the CST node that identifies the message location.Returns a format-neutral view of this message: its text and, when known, the source and position it applies to.voidwrite(PrintWriter writer, Janitor janitor) Writes the message together with source-location information.Methods inherited from class org.codehaus.groovy.control.messages.SimpleMessage
getMessage
-
Constructor Details
-
LocatedMessage
Creates a located message with the supplied text.- Parameters:
message- the message textcontext- the source locationsource- the owning source unit
-
LocatedMessage
Creates a located message with supplemental data.- Parameters:
message- the message textdata- supplemental message datacontext- the source locationsource- the owning source unit
-
-
Method Details
-
getContext
Returns the CST node that identifies the message location.- Returns:
- the source location node
-
toDiagnostic
Description copied from class:MessageReturns a format-neutral view of this message: its text and, when known, the source and position it applies to. Layouts other than the full one are rendered from this rather than from the message classes (GROOVY-12312).The default captures the output of
Message.write(PrintWriter)as the text, with no file or position, so that a subclass which does not override this still renders in every format.- Overrides:
toDiagnosticin classSimpleMessage- Returns:
- the diagnostic view, never
null
-
write
Writes the message together with source-location information.- Overrides:
writein classSimpleMessage- Parameters:
writer- the destination writerjanitor- the cleanup helper for temporary source access
-