public class ErrorCollector extends java.lang.Object implements IdeErrorReporter
ErrorReporter
when the
CompilerEnvirons
is set to
ide-mode (for IDEs).Constructor and Description |
---|
ErrorCollector() |
Modifier and Type | Method and Description |
---|---|
void |
error(java.lang.String message,
java.lang.String sourceName,
int fileOffset,
int length)
Report an error.
|
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.
|
java.util.List<ParseProblem> |
getErrors()
Returns the list of errors and warnings produced during parsing.
|
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.
|
java.lang.String |
toString() |
void |
warning(java.lang.String message,
java.lang.String sourceName,
int offset,
int length)
Report a warning.
|
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.
|
public void warning(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)
warning(String,String,int,int)
is used instead.warning
in interface ErrorReporter
message
- a String describing the warningsourceName
- a String describing the JavaScript source
where the warning occured; typically a filename or URLline
- the line number associated with the warninglineSource
- the text of the line (may be null)lineOffset
- the offset into lineSource where problem was detectedjava.lang.UnsupportedOperationException
public void warning(java.lang.String message, java.lang.String sourceName, int offset, int length)
IdeErrorReporter
The implementing class may choose to ignore the warning if it desires.
warning
in interface IdeErrorReporter
message
- a String
describing the warningsourceName
- a String
describing the JavaScript source
where the warning occured; typically a filename or URLoffset
- the warning's 0-indexed char position in the input streamlength
- the length of the region contributing to the warningpublic void error(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)
warning(String,String,int,int)
is used instead.error
in interface ErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occured; typically a filename or URLline
- the line number associated with the errorlineSource
- the text of the line (may be null)lineOffset
- the offset into lineSource where problem was detectedjava.lang.UnsupportedOperationException
public void error(java.lang.String message, java.lang.String sourceName, int fileOffset, int length)
IdeErrorReporter
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.
error
in interface IdeErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occured; typically a filename or URLfileOffset
- 0-indexed char position of the error in the input streamlength
- the length of the region contributing to the errorpublic EvaluatorException runtimeError(java.lang.String message, java.lang.String sourceName, int line, java.lang.String lineSource, int lineOffset)
ErrorReporter
runtimeError
in interface ErrorReporter
message
- a String describing the errorsourceName
- a String describing the JavaScript source
where the error occured; typically a filename or URLline
- the line number associated with the errorlineSource
- the text of the line (may be null)lineOffset
- the offset into lineSource where problem was detectedpublic java.util.List<ParseProblem> getErrors()
public java.lang.String toString()
toString
in class java.lang.Object