Package org.mozilla.javascript.ast
Class ErrorCollector
- java.lang.Object
- 
- org.mozilla.javascript.ast.ErrorCollector
 
- 
- All Implemented Interfaces:
- IdeErrorReporter,- ErrorReporter
 
 public class ErrorCollector extends java.lang.Object implements IdeErrorReporter An error reporter that gathers the errors and warnings for later display. This a usefulErrorReporterwhen theCompilerEnvironsis set to ide-mode (for IDEs).
- 
- 
Constructor SummaryConstructors Constructor Description ErrorCollector()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiderror(java.lang.String message, java.lang.String sourceName, int fileOffset, int length)Report an error.voiderror(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)This is not called during AST generation.java.util.List<ParseProblem>getErrors()Returns the list of errors and warnings produced during parsing.EvaluatorExceptionruntimeError(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)Creates an EvaluatorException that may be thrown.java.lang.StringtoString()voidwarning(java.lang.String message, java.lang.String sourceName, int offset, int length)Report a warning.voidwarning(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)This is not called during AST generation.
 
- 
- 
- 
Method Detail- 
warningpublic void warning(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)This is not called during AST generation.warning(String,String,int,int)is used instead.- Specified by:
- warningin interface- ErrorReporter
- Parameters:
- message- a String describing the warning
- sourceName- a String describing the JavaScript source where the warning occured; typically a filename or URL
- line- the line number associated with the warning
- lineSource- the text of the line (may be null)
- lineOffset- the offset into lineSource where problem was detected
- Throws:
- java.lang.UnsupportedOperationException
 
 - 
warningpublic void warning(java.lang.String message, java.lang.String sourceName, int offset, int length)Report a warning.The implementing class may choose to ignore the warning if it desires. - Specified by:
- warningin interface- IdeErrorReporter
- Parameters:
- message- a- Stringdescribing the warning
- sourceName- a- Stringdescribing the JavaScript source where the warning occured; typically a filename or URL
- offset- the warning's 0-indexed char position in the input stream
- length- the length of the region contributing to the warning
 
 - 
errorpublic void error(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)This is not called during AST generation.warning(String,String,int,int)is used instead.- Specified by:
- errorin interface- ErrorReporter
- Parameters:
- message- a String describing the error
- sourceName- a String describing the JavaScript source where the error occured; typically a filename or URL
- line- the line number associated with the error
- lineSource- the text of the line (may be null)
- lineOffset- the offset into lineSource where problem was detected
- Throws:
- java.lang.UnsupportedOperationException
 
 - 
errorpublic void error(java.lang.String message, java.lang.String sourceName, int fileOffset, int length)Report an error.The implementing class is free to throw an exception if it desires. If execution has not yet begun, the JavaScript engine is free to find additional errors rather than terminating the translation. It will not execute a script that had errors, however. - Specified by:
- errorin interface- IdeErrorReporter
- Parameters:
- message- a String describing the error
- sourceName- a String describing the JavaScript source where the error occured; typically a filename or URL
- fileOffset- 0-indexed char position of the error in the input stream
- length- the length of the region contributing to the error
 
 - 
runtimeErrorpublic EvaluatorException runtimeError(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset) Creates an EvaluatorException that may be thrown.runtimeErrors, unlike errors, will always terminate the current script. - Specified by:
- runtimeErrorin interface- ErrorReporter
- Parameters:
- message- a String describing the error
- sourceName- a String describing the JavaScript source where the error occured; typically a filename or URL
- line- the line number associated with the error
- lineSource- the text of the line (may be null)
- lineOffset- the offset into lineSource where problem was detected
- Returns:
- an EvaluatorException that will be thrown.
 
 - 
getErrorspublic java.util.List<ParseProblem> getErrors() Returns the list of errors and warnings produced during parsing.
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-