Package net.sourceforge.pmd.lang.ast
Interface SemanticErrorReporter
-
public interface SemanticErrorReporterReports 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 Default Methods Modifier and Type Method Description default voidacceptError(SemanticException e)If the given error has not been reported yet (SemanticException.wasReported()), report it using this logger.SemanticExceptionerror(Node location, String message, Object... formatArgs)Report an error at the given location.@Nullable SemanticExceptiongetFirstError()Iferror(Node, String, Object...)has been called, return a semantic exception instance with the correct message.static SemanticErrorReporternoop()static SemanticErrorReporterreportToLogger(PmdReporter reporter)Forwards to aPmdReporter, except trace and debug messages which are reported on a logger.voidwarning(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
-
acceptError
default void acceptError(SemanticException e)
If the given error has not been reported yet (SemanticException.wasReported()), report it using this logger. This is used to report semantic exceptions that were produced outside this logger, but have been caught.- Parameters:
e- a semantic exception
-
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(PmdReporter reporter)
Forwards to aPmdReporter, except trace and debug messages which are reported on a logger.
-
-