| java.lang.Object org.codehaus.groovy.control.ErrorCollector
ErrorCollector | public class ErrorCollector (Code) | | A base class for collecting messages and errors during processing.
Each CompilationUnit should have one and SourceUnits should share
their ErrorCollector with the CompilationUnit.
author: Chris Poirier author: Jochen Theodorou version: $Id: ErrorCollector.java 4534 2006-12-21 17:34:36Z blackdrag $ |
Method Summary | |
public void | addCollectorContents(ErrorCollector er) | public void | addError(Message message) Adds a non-fatal error to the message set. | public void | addError(Message message, boolean fatal) Adds an optionally-fatal error to the message set. | public void | addError(SyntaxException error, SourceUnit source) Convenience wrapper for addError(). | public void | addError(String text, CSTNode context, SourceUnit source) Convenience wrapper for addError(). | public void | addErrorAndContinue(Message message) Adds an error to the message set, but don't fail. | public void | addException(Exception cause, SourceUnit source) | public void | addFatalError(Message message) Adds a fatal exception to the message set and throws
the unit as a PhaseFailedException. | public void | addWarning(WarningMessage message) Adds a WarningMessage to the message set. | public void | addWarning(int importance, String text, CSTNode context, SourceUnit source) Convenience wrapper for addWarning() that won't create an object
unless it is relevant. | public void | addWarning(int importance, String text, Object data, CSTNode context, SourceUnit source) Convenience wrapper for addWarning() that won't create an object
unless it is relevant. | protected void | failIfErrors() Causes the current phase to fail by throwing a
CompilationFailedException. | public Message | getError(int index) Returns the specified error message, or null. | public int | getErrorCount() Returns the number of errors. | public List | getErrors() Returns the list of errors, or null if there are none. | public Exception | getException(int index) Convenience routine to return the specified error's
underlying Exception, or null if it isn't one. | public Message | getLastError() | public SyntaxException | getSyntaxError(int index) Convenience routine to return the specified error's
underlying SyntaxException, or null if it isn't one. | public WarningMessage | getWarning(int index) Returns the specified warning message, or null. | public int | getWarningCount() Returns the number of warnings. | public List | getWarnings() Returns the list of warnings, or null if there are none. | public boolean | hasErrors() Returns true if there are any errors pending. | public boolean | hasWarnings() Returns true if there are any warnings pending. | public void | write(PrintWriter writer, Janitor janitor) Writes error messages to the specified PrintWriter. |
errors | protected LinkedList errors(Code) | | ErrorMessages collected during processing
|
warnings | protected LinkedList warnings(Code) | | WarningMessages collected during processing
|
addError | public void addError(Message message, boolean fatal) throws CompilationFailedException(Code) | | Adds an optionally-fatal error to the message set. Throws
the unit as a PhaseFailedException, if the error is fatal.
|
addErrorAndContinue | public void addErrorAndContinue(Message message)(Code) | | Adds an error to the message set, but don't fail.
|
addWarning | public void addWarning(WarningMessage message)(Code) | | Adds a WarningMessage to the message set.
|
addWarning | public void addWarning(int importance, String text, CSTNode context, SourceUnit source)(Code) | | Convenience wrapper for addWarning() that won't create an object
unless it is relevant.
|
addWarning | public void addWarning(int importance, String text, Object data, CSTNode context, SourceUnit source)(Code) | | Convenience wrapper for addWarning() that won't create an object
unless it is relevant.
|
getError | public Message getError(int index)(Code) | | Returns the specified error message, or null.
|
getErrorCount | public int getErrorCount()(Code) | | Returns the number of errors.
|
getErrors | public List getErrors()(Code) | | Returns the list of errors, or null if there are none.
|
getException | public Exception getException(int index)(Code) | | Convenience routine to return the specified error's
underlying Exception, or null if it isn't one.
|
getLastError | public Message getLastError()(Code) | | Returns the last error reported
|
getSyntaxError | public SyntaxException getSyntaxError(int index)(Code) | | Convenience routine to return the specified error's
underlying SyntaxException, or null if it isn't one.
|
getWarning | public WarningMessage getWarning(int index)(Code) | | Returns the specified warning message, or null.
|
getWarningCount | public int getWarningCount()(Code) | | Returns the number of warnings.
|
getWarnings | public List getWarnings()(Code) | | Returns the list of warnings, or null if there are none.
|
hasErrors | public boolean hasErrors()(Code) | | Returns true if there are any errors pending.
|
hasWarnings | public boolean hasWarnings()(Code) | | Returns true if there are any warnings pending.
|
|
|