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 Details

    • 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 reported
      message - Message (rendered using a MessageFormat)
      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 reported
      message - Message (rendered using a MessageFormat)
      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()
      If error(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 to error(Node, String, Object...).
    • noop

      static SemanticErrorReporter noop()
    • reportToLogger

      static SemanticErrorReporter reportToLogger(PmdReporter reporter)
      Forwards to a PmdReporter, except trace and debug messages which are reported on a logger.