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.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | CompilationUnit.ClassgenCallback
A callback interface you can use during the |
| public abstract static class | CompilationUnit.GroovyClassOperation
Deprecated
|
| public static interface | |
| public static interface | |
| public static interface | |
| private static interface | |
| public abstract static class | CompilationUnit.PrimaryClassNodeOperation
Deprecated
|
| public static interface | CompilationUnit.ProgressCallback
A callback interface you can use to get a callback after every unit of the compile process. |
| public abstract static class | CompilationUnit.SourceUnitOperation
Deprecated
|
| Modifier and Type | Field and Description |
|---|---|
| protected CompileUnit | ast
The overall AST for this CompilationUnit. |
| protected ASTTransformationsContext | astTransformationsContext
The AST transformations state data. |
| private final CompilationUnit. | classgen
Runs the class generation phase on a single |
| protected CompilationUnit. | classgenCallback
A callback called during the |
| protected ClassNodeResolver | |
| protected boolean | configured
True after the first |
| protected boolean | debug
If set, outputs a little more information during compilation when errors occur. |
| private List | generatedClasses
The classes generated during classgen. |
| private Set | |
| private Deque | |
| private Deque | |
| protected CompilationUnit. | progressCallback
A callback for use during |
| protected Queue | |
| private final CompilationUnit. | resolve
Resolves all types. |
| protected ResolveVisitor | |
| protected Map | sources
The source units from which this unit is built. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CompilationUnit(final GroovyClassLoader loader)
Initializes the CompilationUnit with defaults except for class loader. |
| public | CompilationUnit(final CompilerConfiguration configuration)
Initializes the CompilationUnit with no security considerations. |
| public | CompilationUnit(final CompilerConfiguration configuration, final CodeSource codeSource, final GroovyClassLoader loader)
Initializes the CompilationUnit with a CodeSource for controlling security stuff and a class loader for loading classes. |
| public | CompilationUnit(final CompilerConfiguration
- compilation configuration configuration, final CodeSource - security setting for the compilation codeSource, final GroovyClassLoader - loader used to resolve classes against during compilation loader, final GroovyClassLoader - the loader for transforms transformLoader)Initializes the CompilationUnit with a CodeSource for controlling security stuff, a class loader for loading classes, and a class loader for loading AST transformations. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | addFirstPhaseOperation(final CompilationUnit.
Deprecated
|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| private void | |
| public SourceUnit | |
| public SourceUnit | |
| public SourceUnit | |
| public SourceUnit | |
| public SourceUnit | |
| public void | |
| public void | |
| private void | |
| public void | |
| public void | |
| private void | |
| private void | |
| public void | |
| public void | |
| public void | configure(final CompilerConfiguration configuration)
Overrides org. |
| protected ClassVisitor | |
| protected boolean | Returns: true if there was a queued sourceDequeues any source units add through addSource and resets the compiler phase to initialization. |
| public CompileUnit | |
| public ASTTransformationsContext | |
| public List | |
| public CompilationUnit. | |
| public ClassNode | |
| public ClassNodeResolver | |
| public ClassNode | getFirstClassNode()
Convenience routine to get the first ClassNode, for when you are sure there is only one. |
| public Set | |
| private List | |
| public CompilationUnit. | |
| private static List | |
| private static int | |
| private static int | |
| public GroovyClassLoader | |
| public Iterator | |
| protected void | |
| private void | |
| private void | |
| private void | |
| public void | |
| public void | |
| public void | |
| private void | |
| private static void |
| ast | back to summary |
|---|---|
| protected CompileUnit ast The overall AST for this CompilationUnit. | |
| astTransformationsContext | back to summary |
|---|---|
| protected ASTTransformationsContext astTransformationsContext The AST transformations state data. | |
| classgen | back to summary |
|---|---|
| private final CompilationUnit. Runs the class generation phase on a single | |
| classgenCallback | back to summary |
|---|---|
| protected CompilationUnit. A callback called during the | |
| classNodeResolver | back to summary |
|---|---|
| protected ClassNodeResolver classNodeResolver | |
| configured | back to summary |
|---|---|
| protected boolean configured True after the first | |
| debug | back to summary |
|---|---|
| protected boolean debug If set, outputs a little more information during compilation when errors occur. | |
| generatedClasses | back to summary |
|---|---|
| private List<GroovyClass> generatedClasses The classes generated during classgen. | |
| javaCompilationUnitSet | back to summary |
|---|---|
| private Set<JavaFileObject> javaCompilationUnitSet | |
| newPhaseOperations | back to summary |
|---|---|
| private Deque<CompilationUnit. | |
| phaseOperations | back to summary |
|---|---|
| private Deque<CompilationUnit. | |
| progressCallback | back to summary |
|---|---|
| protected CompilationUnit. A callback for use during | |
| queuedSources | back to summary |
|---|---|
| protected Queue<SourceUnit> queuedSources | |
| resolve | back to summary |
|---|---|
| private final CompilationUnit. Resolves all types. | |
| resolveVisitor | back to summary |
|---|---|
| protected ResolveVisitor resolveVisitor | |
| sources | back to summary |
|---|---|
| protected Map<String, SourceUnit> sources The source units from which this unit is built. | |
| CompilationUnit | back to summary |
|---|---|
| public CompilationUnit() Initializes the CompilationUnit with defaults. | |
| CompilationUnit | back to summary |
|---|---|
| public CompilationUnit(final GroovyClassLoader loader) Initializes the CompilationUnit with defaults except for class loader. | |
| CompilationUnit | back to summary |
|---|---|
| public CompilationUnit(final CompilerConfiguration configuration) Initializes the CompilationUnit with no security considerations. | |
| CompilationUnit | back to summary |
|---|---|
| public CompilationUnit(final CompilerConfiguration configuration, final CodeSource codeSource, final GroovyClassLoader loader) Initializes the CompilationUnit with a CodeSource for controlling security stuff and a class loader for loading classes. | |
| CompilationUnit | back to summary |
|---|---|
| public CompilationUnit(final CompilerConfiguration configuration, final CodeSource codeSource, final GroovyClassLoader loader, final GroovyClassLoader transformLoader) Initializes the CompilationUnit with a CodeSource for controlling security stuff, a class loader for loading classes, and a class loader for loading AST transformations. Note The transform loader must be able to load compiler classes.
That means
| |
| addClassNode | back to summary |
|---|---|
| public void addClassNode(final ClassNode node) 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 | |
| addFirstPhaseOperation | back to summary |
|---|---|
| public void addFirstPhaseOperation(final CompilationUnit. | |
| addFirstPhaseOperation | back to summary |
|---|---|
| public void addFirstPhaseOperation(final CompilationUnit. Deprecated
| |
| addJavaCompilationUnits | back to summary |
|---|---|
| public void addJavaCompilationUnits(final Set<JavaFileObject> javaCompilationUnitSet) | |
| addNewPhaseOperation | back to summary |
|---|---|
| public void addNewPhaseOperation(final CompilationUnit. | |
| addNewPhaseOperation | back to summary |
|---|---|
| public void addNewPhaseOperation(final CompilationUnit. Deprecated
| |
| addPhaseOperation | back to summary |
|---|---|
| public void addPhaseOperation(final CompilationUnit. | |
| addPhaseOperation | back to summary |
|---|---|
| public void addPhaseOperation(final CompilationUnit. | |
| addPhaseOperation | back to summary |
|---|---|
| public void addPhaseOperation(final CompilationUnit. | |
| addPhaseOperation | back to summary |
|---|---|
| public void addPhaseOperation(final CompilationUnit. Deprecated
| |
| addPhaseOperation | back to summary |
|---|---|
| public void addPhaseOperation(final CompilationUnit. Deprecated
| |
| addPhaseOperation | back to summary |
|---|---|
| public void addPhaseOperation(final CompilationUnit. Deprecated
| |
| addPhaseOperations | back to summary |
|---|---|
| private void addPhaseOperations() | |
| addSource | back to summary |
|---|---|
| public SourceUnit addSource(final File file) Adds a source file to the unit. | |
| addSource | back to summary |
|---|---|
| public SourceUnit addSource(final URL url) Adds a source file to the unit. | |
| addSource | back to summary |
|---|---|
| public SourceUnit addSource(final String name, final InputStream stream) Adds a InputStream source to the unit. | |
| addSource | back to summary |
|---|---|
| public SourceUnit addSource(final String name, final String scriptText) | |
| addSource | back to summary |
|---|---|
| public SourceUnit addSource(final SourceUnit source) Adds a SourceUnit to the unit. | |
| addSources | back to summary |
|---|---|
| public void addSources(final String[] paths) Adds a set of file paths to the unit. | |
| addSources | back to summary |
|---|---|
| public void addSources(final File[] files) Adds a set of source files to the unit. | |
| applyCompilationCustomizers | back to summary |
|---|---|
| private void applyCompilationCustomizers() | |
| applyToPrimaryClassNodes | back to summary |
|---|---|
| public void applyToPrimaryClassNodes(final CompilationUnit. Deprecated
| |
| applyToSourceUnits | back to summary |
|---|---|
| public void applyToSourceUnits(final CompilationUnit. Deprecated
| |
| buildASTs | back to summary |
|---|---|
| private void buildASTs() | |
| changeBugText | back to summary |
|---|---|
| private void changeBugText(final GroovyBugError e, final SourceUnit context) | |
| compile | back to summary |
|---|---|
| public void compile() throws CompilationFailedException Synonym for | |
| compile | back to summary |
|---|---|
| public void compile(int throughPhase) throws CompilationFailedException Compiles the compilation unit from sources. | |
| configure | back to summary |
|---|---|
| public void configure(final CompilerConfiguration configuration) Overrides org. Configures its debugging mode and classloader classpath from a given compiler configuration.
This cannot be done more than once due to limitations in
| |
| createClassVisitor | back to summary |
|---|---|
| protected ClassVisitor createClassVisitor() | |
| dequeued | back to summary |
|---|---|
| protected boolean dequeued() throws CompilationFailedException Dequeues any source units add through addSource and resets the compiler phase to initialization. Note this does not mean a file is recompiled. If a SourceUnit has already passed a phase it is skipped until a higher phase is reached.
| |
| getAST | back to summary |
|---|---|
| public CompileUnit getAST() Returns the CompileUnit that roots our AST. | |
| getASTTransformationsContext | back to summary |
|---|---|
public ASTTransformationsContext getASTTransformationsContext()
| |
| getClasses | back to summary |
|---|---|
| public List Get the GroovyClasses generated by compile(). | |
| getClassgenCallback | back to summary |
|---|---|
| public CompilationUnit. | |
| getClassNode | back to summary |
|---|---|
| public ClassNode getClassNode(final String name) Convenience routine to get the named ClassNode. | |
| getClassNodeResolver | back to summary |
|---|---|
| public ClassNodeResolver getClassNodeResolver() | |
| getFirstClassNode | back to summary |
|---|---|
| public ClassNode getFirstClassNode() Convenience routine to get the first ClassNode, for when you are sure there is only one. | |
| getJavaCompilationUnitSet | back to summary |
|---|---|
| public Set | |
| getPrimaryClassNodes | back to summary |
|---|---|
| private List | |
| getProgressCallback | back to summary |
|---|---|
| public CompilationUnit. | |
| getSorted | back to summary |
|---|---|
| private static List | |
| getSuperClassCount | back to summary |
|---|---|
| private static int getSuperClassCount(ClassNode classNode) | |
| getSuperInterfaceCount | back to summary |
|---|---|
| private static int getSuperInterfaceCount(final ClassNode classNode) | |
| getTransformLoader | back to summary |
|---|---|
| public GroovyClassLoader getTransformLoader() Returns the class loader for loading AST transformations. | |
| iterator | back to summary |
|---|---|
| public Iterator Returns an iterator on the unit's SourceUnits. | |
| mark | back to summary |
|---|---|
| protected void mark() throws CompilationFailedException Updates the phase marker on all sources. | |
| processNewPhaseOperations | back to summary |
|---|---|
| private void processNewPhaseOperations(final int phase) | |
| processPhaseOperations | back to summary |
|---|---|
| private void processPhaseOperations(final int phase) | |
| recordPhaseOpsInAllOtherPhases | back to summary |
|---|---|
| private void recordPhaseOpsInAllOtherPhases(final int phase) | |
| setClassgenCallback | back to summary |
|---|---|
| public void setClassgenCallback(final CompilationUnit. Sets a ClassgenCallback. You can have only one, and setting
it to | |
| setClassNodeResolver | back to summary |
|---|---|
| public void setClassNodeResolver(final ClassNodeResolver classNodeResolver) | |
| setProgressCallback | back to summary |
|---|---|
| public void setProgressCallback(final CompilationUnit. Sets a ProgressCallback. You can have only one, and setting
it to | |
| sortClasses | back to summary |
|---|---|
| private void sortClasses() | |
| validatePhase | back to summary |
|---|---|
| private static void validatePhase(final int phase) | |
classgen
phase of compilation as the compiler traverses the ClassNode tree.
You will be called-back for each primary and inner class.
Use setClassgenCallback() before running compile() to set your callback.
| Modifier and Type | Method and Description |
|---|---|
| public void |
| call | back to summary |
|---|---|
| public void call(ClassVisitor writer, ClassNode node) throws CompilationFailedException | |
Deprecated
| Access | Constructor and Description |
|---|---|
| public |
| GroovyClassOperation | back to summary |
|---|---|
| public GroovyClassOperation() | |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public default void |
| call | back to summary |
|---|---|
| public void call(GroovyClass groovyClass) throws CompilationFailedException | |
| doPhaseOperation | back to summary |
|---|---|
| public default void doPhaseOperation(final CompilationUnit unit) throws CompilationFailedException Implements org.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public default void | doPhaseOperation(final CompilationUnit unit)
Implements org. |
| public default boolean |
| call | back to summary |
|---|---|
| public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException | |
| doPhaseOperation | back to summary |
|---|---|
| public default void doPhaseOperation(final CompilationUnit unit) throws CompilationFailedException Implements org. A loop driver for applying operations to all primary ClassNodes in our AST. Automatically skips units that have already been processed through the current phase.
| |
| needSortedInput | back to summary |
|---|---|
| public default boolean needSortedInput() | |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public default void | doPhaseOperation(final CompilationUnit unit)
Implements org. |
| call | back to summary |
|---|---|
| public void call(SourceUnit source) throws CompilationFailedException | |
| doPhaseOperation | back to summary |
|---|---|
| public default void doPhaseOperation(final CompilationUnit unit) throws CompilationFailedException Implements org. A loop driver for applying operations to all SourceUnits. Automatically skips units that have already been processed through the current phase.
| |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| doPhaseOperation | back to summary |
|---|---|
| public void doPhaseOperation(CompilationUnit unit) | |
Deprecated
| Access | Constructor and Description |
|---|---|
| public |
| PrimaryClassNodeOperation | back to summary |
|---|---|
| public PrimaryClassNodeOperation() | |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| call | back to summary |
|---|---|
| public void call(ProcessingUnit context, int phase) throws CompilationFailedException | |
Deprecated
| Access | Constructor and Description |
|---|---|
| public |
| SourceUnitOperation | back to summary |
|---|---|
| public SourceUnitOperation() | |