com.google.javascript.jscomp
Class BasicErrorManager

java.lang.Object
  extended by com.google.javascript.jscomp.BasicErrorManager
All Implemented Interfaces:
ErrorHandler, ErrorManager
Direct Known Subclasses:
AntErrorManager, LoggerErrorManager, PrintStreamErrorManager

public abstract class BasicErrorManager
extends Object
implements ErrorManager

A basic error manager that sorts all errors and warnings reported to it to generate a sorted report when the generateReport() method is called.

This error manager does not produce any output, but subclasses can override the println(CheckLevel, JSError) method to generate custom output.


Constructor Summary
BasicErrorManager()
           
 
Method Summary
 void generateReport()
          Writes a report to an implementation-specific medium.
 int getErrorCount()
          Gets the number of reported errors.
 JSError[] getErrors()
          Gets all the errors.
 double getTypedPercent()
          Gets the percentage of typed expressions.
 int getWarningCount()
          Gets the number of reported warnings.
 JSError[] getWarnings()
          Gets all the warnings.
abstract  void println(CheckLevel level, JSError error)
          Print a message with a trailing new line.
protected abstract  void printSummary()
          Print the summary of the compilation - number of errors and warnings.
 void report(CheckLevel level, JSError error)
          Reports an error.
 void setTypedPercent(double typedPercent)
          Sets the percentage of typed expressions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicErrorManager

public BasicErrorManager()
Method Detail

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

println

public abstract void println(CheckLevel level,
                             JSError error)
Print a message with a trailing new line. This method is called by the generateReport() method when generating messages.


printSummary

protected abstract void printSummary()
Print the summary of the compilation - number of errors and warnings.


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 JSError[] getErrors()
Description copied from interface: ErrorManager
Gets all the errors.

Specified by:
getErrors in interface ErrorManager

getWarnings

public 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