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
Modifier and TypeMethodDescriptiondefault voidIf the given error has not been reported yet (SemanticException.wasReported()), report it using this logger.Report an error at the given location.@Nullable SemanticExceptionIferror(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.voidReport a warning at the given location.
-
Method Details
-
warning
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
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
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
-
reportToLogger
Forwards to aPmdReporter, except trace and debug messages which are reported on a logger.
-