|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.control.ErrorCollector
public class ErrorCollector extends java.lang.Object
A base class for collecting messages and errors during processing. Each CompilationUnit should have an ErrorCollector, and the SourceUnits should share their ErrorCollector with the CompilationUnit.
Field Summary | |
---|---|
protected CompilerConfiguration |
configuration
Configuration and other settings that control processing |
protected java.util.LinkedList |
errors
ErrorMessages collected during processing |
protected java.util.LinkedList |
warnings
WarningMessages collected during processing |
Constructor Summary | |
ErrorCollector(CompilerConfiguration configuration)
Initialize the ErrorReporter. |
Method Summary | |
---|---|
void
|
addCollectorContents(ErrorCollector er)
|
void
|
addError(Message message)
Adds a non-fatal error to the message set, which may cause a failure if the error threshold is exceeded. |
void
|
addError(Message message, boolean fatal)
Adds an optionally-fatal error to the message set. |
void
|
addError(SyntaxException error, SourceUnit source)
Convenience wrapper for addError(). |
void
|
addError(java.lang.String text, CSTNode context, SourceUnit source)
Convenience wrapper for addError(). |
void
|
addErrorAndContinue(Message message)
Adds an error to the message set, but does not cause a failure. |
void
|
addException(java.lang.Exception cause, SourceUnit source)
|
void
|
addFatalError(Message message)
Adds a fatal exception to the message set and throws the unit as a PhaseFailedException. |
void
|
addWarning(WarningMessage message)
Adds a WarningMessage to the message set. |
void
|
addWarning(int importance, java.lang.String text, CSTNode context, SourceUnit source)
Convenience wrapper for addWarning() that won't create an object unless it is relevant. |
void
|
addWarning(int importance, java.lang.String text, java.lang.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. |
Message
|
getError(int index)
Returns the specified error message, or null. |
int
|
getErrorCount()
Returns the number of errors. |
java.util.List
|
getErrors()
Returns the list of errors, or null if there are none. |
java.lang.Exception
|
getException(int index)
Convenience routine to return the specified error's underlying Exception, or null if it isn't one. |
Message
|
getLastError()
Returns the last error reported |
SyntaxException
|
getSyntaxError(int index)
Convenience routine to return the specified error's underlying SyntaxException, or null if it isn't one. |
WarningMessage
|
getWarning(int index)
Returns the specified warning message, or null. |
int
|
getWarningCount()
Returns the number of warnings. |
java.util.List
|
getWarnings()
Returns the list of warnings, or null if there are none. |
boolean
|
hasErrors()
Returns true if there are any errors pending. |
boolean
|
hasWarnings()
Returns true if there are any warnings pending. |
void
|
write(java.io.PrintWriter writer, Janitor janitor)
Writes error messages to the specified PrintWriter. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
protected CompilerConfiguration configuration
protected java.util.LinkedList errors
protected java.util.LinkedList warnings
Constructor Detail |
---|
public ErrorCollector(CompilerConfiguration configuration)
Method Detail |
---|
public void addCollectorContents(ErrorCollector er)
public void addError(Message message)
public void addError(Message message, boolean fatal)
fatal
- if true then then processing will stop
public void addError(SyntaxException error, SourceUnit source)
public void addError(java.lang.String text, CSTNode context, SourceUnit source)
public void addErrorAndContinue(Message message)
public void addException(java.lang.Exception cause, SourceUnit source)
public void addFatalError(Message message)
public void addWarning(WarningMessage message)
public void addWarning(int importance, java.lang.String text, CSTNode context, SourceUnit source)
public void addWarning(int importance, java.lang.String text, java.lang.Object data, CSTNode context, SourceUnit source)
protected void failIfErrors()
public Message getError(int index)
public int getErrorCount()
public java.util.List getErrors()
public java.lang.Exception getException(int index)
public Message getLastError()
public SyntaxException getSyntaxError(int index)
public WarningMessage getWarning(int index)
public int getWarningCount()
public java.util.List getWarnings()
public boolean hasErrors()
public boolean hasWarnings()
public void write(java.io.PrintWriter writer, Janitor janitor)
Groovy Documentation