public class JavaAwareCompilationUnit
extends CompilationUnit
Compilation Unit capable of compiling Java source files.
| Fields inherited from class | Fields |
|---|---|
class CompilationUnit |
ast, astTransformationsContext, classNodeResolver, classgenCallback, configured, debug, progressCallback, queuedSources, resolveVisitor, sources |
class ProcessingUnit |
classLoader, configuration, errorCollector, phase, phaseComplete |
| Constructor and description |
|---|
JavaAwareCompilationUnit()Creates a joint compilation unit with the default configuration. |
JavaAwareCompilationUnit(CompilerConfiguration configuration)Creates a joint compilation unit with the supplied configuration. |
JavaAwareCompilationUnit(CompilerConfiguration configuration, GroovyClassLoader groovyClassLoader)Creates a joint compilation unit with the supplied configuration and class loader. |
JavaAwareCompilationUnit(CompilerConfiguration configuration, GroovyClassLoader groovyClassLoader, GroovyClassLoader transformClassLoader)Creates a joint compilation unit with explicit Groovy and transform class loaders. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addSources(String[] paths)Adds Groovy or Java sources from the supplied path strings. |
|
public void |
addSources(File[] files)Adds Groovy or Java sources from the supplied files. |
|
public void |
configure(CompilerConfiguration configuration)Configures the compilation unit and ensures the target directory is on the Groovy class loader classpath. |
|
public JavaCompilerFactory |
getCompilerFactory()Returns the factory used to create the backing Java compiler. |
|
public void |
gotoPhase(int phase)Advances the compilation unit to the requested phase and triggers javac when the semantic analysis boundary is reached. |
|
public void |
setCompilerFactory(JavaCompilerFactory compilerFactory)Sets the factory used to create the backing Java compiler. |
Creates a joint compilation unit with the default configuration.
Creates a joint compilation unit with the supplied configuration.
configuration - the compiler configuration to useCreates a joint compilation unit with the supplied configuration and class loader.
configuration - the compiler configuration to usegroovyClassLoader - the Groovy class loader to useCreates a joint compilation unit with explicit Groovy and transform class loaders.
configuration - the compiler configuration to usegroovyClassLoader - the Groovy class loader to usetransformClassLoader - the class loader used for AST transformsAdds Groovy or Java sources from the supplied path strings.
paths - the source paths to addAdds Groovy or Java sources from the supplied files.
files - the source files to addConfigures the compilation unit and ensures the target directory is on the Groovy class loader classpath.
configuration - the compiler configuration to applyReturns the factory used to create the backing Java compiler.
Advances the compilation unit to the requested phase and triggers javac when the semantic analysis boundary is reached.
phase - the target compilation phaseSets the factory used to create the backing Java compiler.
compilerFactory - the Java compiler factory to useCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.