Package org.codehaus.groovy.tools.javac
Class JavaStubCompilationUnit
java.lang.Object
org.codehaus.groovy.control.ProcessingUnit
org.codehaus.groovy.control.CompilationUnit
org.codehaus.groovy.tools.javac.JavaStubCompilationUnit
Compilation unit to only generate stubs.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.codehaus.groovy.control.CompilationUnit
CompilationUnit.ClassgenCallback, CompilationUnit.GroovyClassOperation, CompilationUnit.IGroovyClassOperation, CompilationUnit.IPrimaryClassNodeOperation, CompilationUnit.ISourceUnitOperation, CompilationUnit.PrimaryClassNodeOperation, CompilationUnit.ProgressCallback, CompilationUnit.SourceUnitOperation -
Field Summary
Fields inherited from class org.codehaus.groovy.control.CompilationUnit
ast, astTransformationsContext, classgenCallback, classNodeResolver, configured, debug, progressCallback, queuedSources, resolveVisitor, sourcesFields inherited from class org.codehaus.groovy.control.ProcessingUnit
classLoader, configuration, errorCollector, phase, phaseComplete -
Constructor Summary
ConstructorsConstructorDescriptionCreates a compilation unit that generates Java stubs into the configured stub directory.JavaStubCompilationUnit(CompilerConfiguration config, GroovyClassLoader gcl, File destDir) Creates a compilation unit that generates Java stubs into the supplied destination directory. -
Method Summary
Modifier and TypeMethodDescriptionAdds a source file when its extension is accepted for stub generation.Adds a source URL when its extension is accepted for stub generation.voidcompile()Compiles sources through the conversion phase to generate stubs only.voidconfigure(CompilerConfiguration config) Configures the compilation unit and makes the target directory visible to the Groovy class loader.intReturns the number of stubs generated during the last compilation run.Methods inherited from class org.codehaus.groovy.control.CompilationUnit
addClassNode, addFirstPhaseOperation, addFirstPhaseOperation, addJavaCompilationUnits, addNewPhaseOperation, addNewPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addSource, addSource, addSource, addSources, addSources, applyToPrimaryClassNodes, applyToSourceUnits, compile, createClassVisitor, dequeued, getAST, getASTTransformationsContext, getClasses, getClassgenCallback, getClassNode, getClassNodeResolver, getFirstClassNode, getJavaCompilationUnitSet, getProgressCallback, getTransformLoader, iterator, mark, setClassgenCallback, setClassNodeResolver, setProgressCallbackMethods inherited from class org.codehaus.groovy.control.ProcessingUnit
completePhase, getClassLoader, getConfiguration, getErrorCollector, getPhase, getPhaseDescription, gotoPhase, isPhaseComplete, nextPhase, setClassLoader, setConfiguration
-
Constructor Details
-
JavaStubCompilationUnit
Creates a compilation unit that generates Java stubs into the supplied destination directory.- Parameters:
config- the compiler configurationgcl- the Groovy class loader to usedestDir- the destination directory for generated stubs
-
JavaStubCompilationUnit
Creates a compilation unit that generates Java stubs into the configured stub directory.- Parameters:
config- the compiler configurationgcl- the Groovy class loader to use
-
-
Method Details
-
getStubCount
public int getStubCount()Returns the number of stubs generated during the last compilation run.- Returns:
- the generated stub count
-
compile
Compiles sources through the conversion phase to generate stubs only.- Overrides:
compilein classCompilationUnit- Throws:
CompilationFailedException- if stub generation fails
-
configure
Configures the compilation unit and makes the target directory visible to the Groovy class loader.- Overrides:
configurein classCompilationUnit- Parameters:
config- the compiler configuration to apply
-
addSource
Adds a source file when its extension is accepted for stub generation.- Overrides:
addSourcein classCompilationUnit- Parameters:
file- the source file to add- Returns:
- the created source unit, or
nullif the extension is not accepted
-
addSource
Adds a source URL when its extension is accepted for stub generation.- Overrides:
addSourcein classCompilationUnit- Parameters:
url- the source URL to add- Returns:
- the created source unit, or
nullif the extension is not accepted
-