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

public class JavaStubCompilationUnit extends CompilationUnit
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, sources`

  ### Fields inherited from class org.codehaus.groovy.control.ProcessingUnit

  `classLoader, configuration, errorCollector, phase, phaseComplete`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JavaStubCompilationUnit(CompilerConfiguration config, GroovyClassLoader gcl)`
  Creates 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 Type
  Method
  Description
  `SourceUnit`
  `addSource(File file)`
  Adds a source file when its extension is accepted for stub generation.
  `SourceUnit`
  `addSource(URL url)`
  Adds a source URL when its extension is accepted for stub generation.
  `void`
  `compile()`
  Compiles sources through the conversion phase to generate stubs only.
  `void`
  `configure(CompilerConfiguration config)`
  Configures the compilation unit and makes the target directory visible to the Groovy class loader.
  `int`
  `getStubCount()`
  Returns 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, setProgressCallback`

  ### Methods inherited from class org.codehaus.groovy.control.ProcessingUnit

  `completePhase, getClassLoader, getConfiguration, getErrorCollector, getPhase, getPhaseDescription, gotoPhase, isPhaseComplete, nextPhase, setClassLoader, setConfiguration`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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