public abstract class BasicErrorManager extends java.lang.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.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
BasicErrorManager.ErrorWithLevel |
(package private) static class |
BasicErrorManager.LeveledJSErrorComparator
Comparator of
JSError with an associated CheckLevel . |
Modifier and Type | Field and Description |
---|---|
private int |
errorCount |
private java.util.SortedSet<BasicErrorManager.ErrorWithLevel> |
messages |
private double |
typedPercent |
private int |
warningCount |
Constructor and Description |
---|
BasicErrorManager() |
Modifier and Type | Method and Description |
---|---|
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.
|
private JSError[] |
toArray(CheckLevel level) |
private final java.util.SortedSet<BasicErrorManager.ErrorWithLevel> messages
private int errorCount
private int warningCount
private double typedPercent
public void report(CheckLevel level, JSError error)
ErrorManager
ErrorManager.generateReport()
at the discretion of the implementation.report
in interface ErrorHandler
report
in interface ErrorManager
level
- the reporting levelerror
- the error to reportpublic void generateReport()
ErrorManager
ErrorManager.report(com.google.javascript.jscomp.CheckLevel, com.google.javascript.jscomp.JSError)
calls.generateReport
in interface ErrorManager
public abstract void println(CheckLevel level, JSError error)
generateReport()
method when generating messages.protected abstract void printSummary()
public int getErrorCount()
ErrorManager
getErrorCount
in interface ErrorManager
public int getWarningCount()
ErrorManager
getWarningCount
in interface ErrorManager
public JSError[] getErrors()
ErrorManager
getErrors
in interface ErrorManager
public JSError[] getWarnings()
ErrorManager
getWarnings
in interface ErrorManager
public void setTypedPercent(double typedPercent)
ErrorManager
setTypedPercent
in interface ErrorManager
public double getTypedPercent()
ErrorManager
getTypedPercent
in interface ErrorManager
private JSError[] toArray(CheckLevel level)