Class ThreadSafeDelegatingErrorManager

java.lang.Object
com.google.javascript.jscomp.ThreadSafeDelegatingErrorManager
All Implemented Interfaces:
ErrorHandler, ErrorManager

public class ThreadSafeDelegatingErrorManager extends Object implements ErrorManager
A simple delegating ErrorManager that provides a thread-safe wrapper for the one being delegated.
  • Constructor Details

    • ThreadSafeDelegatingErrorManager

      public ThreadSafeDelegatingErrorManager(ErrorManager delegated)
  • Method Details

    • report

      public void report(CheckLevel level, JSError error)
      Description copied from interface: ErrorManager
      Reports an error. The errors will be displayed by the ErrorManager.generateReport() at the discretion of the implementation.
      Specified by:
      report in interface ErrorHandler
      Specified by:
      report in interface ErrorManager
      Parameters:
      level - the reporting level
      error - the error to report
    • generateReport

      public void generateReport()
      Description copied from interface: ErrorManager
      Writes a report to an implementation-specific medium. The compiler calls this method after any and all ErrorManager.report(com.google.javascript.jscomp.CheckLevel, com.google.javascript.jscomp.JSError) calls.
      Specified by:
      generateReport in interface ErrorManager
    • hasHaltingErrors

      public boolean hasHaltingErrors()
      Description copied from interface: ErrorManager
      Returns if the error manager has errors that should make compilation halt. This, for example, omits errors that were promoted from warnings by using the --strict flag.
      Specified by:
      hasHaltingErrors in interface ErrorManager
    • getErrorCount

      public int getErrorCount()
      Description copied from interface: ErrorManager
      Gets the number of reported errors.
      Specified by:
      getErrorCount in interface ErrorManager
    • getWarningCount

      public int getWarningCount()
      Description copied from interface: ErrorManager
      Gets the number of reported warnings.
      Specified by:
      getWarningCount in interface ErrorManager
    • getErrors

      public com.google.common.collect.ImmutableList<JSError> getErrors()
      Description copied from interface: ErrorManager
      Gets all the errors.
      Specified by:
      getErrors in interface ErrorManager
    • getWarnings

      public com.google.common.collect.ImmutableList<JSError> getWarnings()
      Description copied from interface: ErrorManager
      Gets all the warnings.
      Specified by:
      getWarnings in interface ErrorManager
    • setTypedPercent

      public void setTypedPercent(double typedPercent)
      Description copied from interface: ErrorManager
      Sets the percentage of typed expressions.
      Specified by:
      setTypedPercent in interface ErrorManager
    • getTypedPercent

      public double getTypedPercent()
      Description copied from interface: ErrorManager
      Gets the percentage of typed expressions.
      Specified by:
      getTypedPercent in interface ErrorManager
    • shouldReportConformanceViolation

      public boolean shouldReportConformanceViolation(com.google.javascript.jscomp.Requirement requirement, com.google.common.base.Optional<com.google.javascript.jscomp.Requirement.WhitelistEntry> whitelistEntry, JSError diagnostic, com.google.javascript.jscomp.ConformanceConfig.LibraryLevelNonAllowlistedConformanceViolationsBehavior behavior, boolean isAllowlisted)
      Description copied from interface: ErrorManager
      Return true if the conformance violation should be reported. This is called even if the violation is allowlisted and override implementations all can return true despite allowlisting.

      This method's name is misleading.

      It is called by the AbstractRule.report method, but none of the implementations of this method actually check whether the violation is allowlisted or not. The actual checking of allowlists is done later at the call-site in the AbstractRule.report method. See - https://source.corp.google.com/piper///depot/google3/third_party/java_src/jscomp/java/com/google/javascript/jscomp/ConformanceRules.java;rcl=783510053;l=364

      The implementations of this method always delegate to this method (return true) as long as the violation is not in a generated code file (which is always safe and never reported) or is being used by ConformanceAllowlister to generate allowlist updates (therefore not reported). For all violations other violations (except in generated code), this method returns true.

      Specified by:
      shouldReportConformanceViolation in interface ErrorManager