Class JavaStubGenerator

java.lang.Object
org.codehaus.groovy.tools.javac.JavaStubGenerator

public class JavaStubGenerator extends Object
Generates Java stub source for Groovy classes during joint compilation.
  • Constructor Details

    • JavaStubGenerator

      public JavaStubGenerator(File outputPath)
      Creates a stub generator that writes to the supplied output directory using the default charset.
      Parameters:
      outputPath - the destination directory, or null for in-memory stubs
    • JavaStubGenerator

      public JavaStubGenerator(File outputPath, boolean requireSuperResolved, String encoding)
      Creates a stub generator with explicit output options.
      Parameters:
      outputPath - the destination directory, or null for in-memory stubs
      requireSuperResolved - whether generation should wait until the superclass is resolved
      encoding - the source encoding to use for generated files
  • Method Details

    • generateClass

      public void generateClass(ClassNode classNode) throws FileNotFoundException
      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

      public Set<JavaFileObject> 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.