Package org.codehaus.groovy.tools.javac
Class JavaStubGenerator
java.lang.Object
org.codehaus.groovy.tools.javac.JavaStubGenerator
Generates Java stub source for Groovy classes during joint compilation.
-
Constructor Summary
ConstructorsConstructorDescriptionJavaStubGenerator(File outputPath) Creates a stub generator that writes to the supplied output directory using the default charset.JavaStubGenerator(File outputPath, boolean requireSuperResolved, String encoding) Creates a stub generator with explicit output options. -
Method Summary
Modifier and TypeMethodDescriptionvoidclean()Deletes generated stub files and clears the tracked stub set.voidgenerateClass(ClassNode classNode) Generates a Java stub for the supplied class when it is eligible for stub generation.Returns the generated in-memory or file-backed Java file objects.
-
Constructor Details
-
JavaStubGenerator
Creates a stub generator that writes to the supplied output directory using the default charset.- Parameters:
outputPath- the destination directory, ornullfor in-memory stubs
-
JavaStubGenerator
Creates a stub generator with explicit output options.- Parameters:
outputPath- the destination directory, ornullfor in-memory stubsrequireSuperResolved- whether generation should wait until the superclass is resolvedencoding- the source encoding to use for generated files
-
-
Method Details
-
generateClass
Generates a Java stub for the supplied class when it is eligible for stub generation.- Parameters:
classNode- the class to generate a stub for- Throws:
FileNotFoundException- if a file-based stub cannot be created
-
getJavaStubCompilationUnitSet
Returns the generated in-memory or file-backed Java file objects.- Returns:
- the current set of generated Java stub compilation units
-
clean
public void clean()Deletes generated stub files and clears the tracked stub set.
-