Package net.sourceforge.pmd.lang.ast
Interface SemanticErrorReporter
-
public interface SemanticErrorReporter
Reports errors that occur after parsing. This may be used to implement semantic checks in a language specific way.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description SemanticException
error(Node location, String message, Object... formatArgs)
Report an error at the given location.@Nullable SemanticException
getFirstError()
Iferror(Node, String, Object...)
has been called, return a semantic exception instance with the correct message.static SemanticErrorReporter
noop()
static SemanticErrorReporter
reportToLogger(MessageReporter reporter)
Forwards to aMessageReporter
, except trace and debug messages which are reported on a logger.void
warning(Node location, String message, Object... formatArgs)
Report a warning at the given location.
-
-
-
Method Detail
-
warning
void warning(Node location, String message, Object... formatArgs)
Report a warning at the given location. Warnings do not abort the analysis. They are usually recoverable errors. They are used to warn the user that something wrong is going on, which may cause subsequent errors or inconsistent behavior.- Parameters:
location
- Location where the warning should be reportedmessage
- Message (rendered using aMessageFormat
)formatArgs
- Format arguments
-
error
SemanticException error(Node location, String message, Object... formatArgs)
Report an error at the given location. Errors abort subsequent analysis and cause a processing error to be put in the report. The produced error can be thrown by the caller if it cannot be recovered from.- Parameters:
location
- Location where the error should be reportedmessage
- Message (rendered using aMessageFormat
)formatArgs
- Format arguments
-
getFirstError
@Nullable SemanticException getFirstError()
Iferror(Node, String, Object...)
has been called, return a semantic exception instance with the correct message. If it has been called more than once, return the first exception, possibly with suppressed exceptions for subsequent calls toerror(Node, String, Object...)
.
-
noop
static SemanticErrorReporter noop()
-
reportToLogger
static SemanticErrorReporter reportToLogger(MessageReporter reporter)
Forwards to aMessageReporter
, except trace and debug messages which are reported on a logger.
-
-