Class JavaStubCompilationUnit


public class JavaStubCompilationUnit extends CompilationUnit
Compilation unit to only generate stubs.
  • Constructor Details

    • JavaStubCompilationUnit

      public JavaStubCompilationUnit(CompilerConfiguration config, GroovyClassLoader gcl, File destDir)
      Creates a compilation unit that generates Java stubs into the supplied destination directory.
      Parameters:
      config - the compiler configuration
      gcl - the Groovy class loader to use
      destDir - the destination directory for generated stubs
    • JavaStubCompilationUnit

      public JavaStubCompilationUnit(CompilerConfiguration config, GroovyClassLoader gcl)
      Creates a compilation unit that generates Java stubs into the configured stub directory.
      Parameters:
      config - the compiler configuration
      gcl - 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

      public void compile() throws CompilationFailedException
      Compiles sources through the conversion phase to generate stubs only.
      Overrides:
      compile in class CompilationUnit
      Throws:
      CompilationFailedException - if stub generation fails
    • configure

      public void configure(CompilerConfiguration config)
      Configures the compilation unit and makes the target directory visible to the Groovy class loader.
      Overrides:
      configure in class CompilationUnit
      Parameters:
      config - the compiler configuration to apply
    • addSource

      public SourceUnit addSource(File file)
      Adds a source file when its extension is accepted for stub generation.
      Overrides:
      addSource in class CompilationUnit
      Parameters:
      file - the source file to add
      Returns:
      the created source unit, or null if the extension is not accepted
    • addSource

      public SourceUnit addSource(URL url)
      Adds a source URL when its extension is accepted for stub generation.
      Overrides:
      addSource in class CompilationUnit
      Parameters:
      url - the source URL to add
      Returns:
      the created source unit, or null if the extension is not accepted