The CompilationUnit collects all compilation data as it is generated by the compiler system. You can use this object to add additional source units to the compilation, or force the compilation to be run again (to affect only the deltas).
You can also add PhaseOperations to this compilation using the addPhaseOperation method. This is commonly used when you want to wire a new AST Transformation into the compilation.
| Modifiers | Name | Description |
|---|---|---|
static class |
CompilationUnit.ClassgenCallback |
Sets a ClassgenCallback. |
static class |
CompilationUnit.GroovyClassOperation |
|
static class |
CompilationUnit.PrimaryClassNodeOperation |
|
static class |
CompilationUnit.ProgressCallback |
|
static class |
CompilationUnit.SourceUnitOperation |
| Modifiers | Name | Description |
|---|---|---|
protected CompileUnit |
ast |
|
protected ASTTransformationsContext |
astTransformationsContext |
|
protected ClassNodeResolver |
classNodeResolver |
|
protected Map |
classSourcesByPublicClassName |
|
protected CompilationUnit.ClassgenCallback |
classgenCallback |
Initializes the CompilationUnit with defaults. |
protected boolean |
configured |
|
protected boolean |
debug |
|
protected List |
generatedClasses |
|
protected List |
names |
|
protected OptimizerVisitor |
optimizer |
|
protected CompilationUnit.ProgressCallback |
progressCallback |
|
protected LinkedList |
queuedSources |
|
protected ResolveVisitor |
resolveVisitor |
|
protected Map |
sources |
|
protected StaticImportVisitor |
staticImportVisitor |
|
protected Map |
summariesByPublicClassName |
|
protected Map |
summariesBySourceName |
|
protected Verifier |
verifier |
| Fields inherited from class | Fields |
|---|---|
class ProcessingUnit |
classLoader, configuration, errorCollector, phase, phaseComplete |
| Constructor and description |
|---|
CompilationUnit
() |
CompilationUnit
(GroovyClassLoader loader) |
CompilationUnit
(CompilerConfiguration configuration) |
CompilationUnit
(CompilerConfiguration configuration, CodeSource security, GroovyClassLoader loader) |
CompilationUnit
(CompilerConfiguration configuration, CodeSource security, GroovyClassLoader loader, GroovyClassLoader transformLoader) |
| Methods inherited from class | Name |
|---|---|
class ProcessingUnit |
completePhase, configure, getClassLoader, getConfiguration, getErrorCollector, getPhase, getPhaseDescription, gotoPhase, nextPhase, setClassLoader, setConfiguration |
class Object |
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Initializes the CompilationUnit with defaults.
Adds a ClassNode directly to the unit (ie. without source). WARNING: the source is needed for error reporting, using this method without setting a SourceUnit will cause NullPinterExceptions
Adds a InputStream source to the unit.
Returns an iterator on the unit's SourceUnits.
Adds a set of source files to the unit.
Adds a source file to the unit.
Updates the phase marker on all sources.
Resolves all types
Convenience routine to get the named ClassNode.
Get the GroovyClasses generated by compile().
Returns the class loader for loading AST transformations.
Marks a single SourceUnit with the current phase, if it isn't already there yet.
Sets a ProgressCallback. You can have only one, and setting it to null removes any existing setting.
Synonym for compile(Phases.ALL).
Copyright © 2003-2014 The Codehaus. All rights reserved.