Package: org.codehaus.groovy.tools.javac

## [Java] Class JavaAwareCompilationUnit

- org.codehaus.groovy.tools.javac.JavaAwareCompilationUnit

-     public class JavaAwareCompilationUnit
      extends CompilationUnit

  Compilation Unit capable of compiling Java source files.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class CompilationUnit` | `ast, astTransformationsContext, classNodeResolver, classgenCallback, configured, debug, progressCallback, queuedSources, resolveVisitor, sources`
    `class ProcessingUnit` | `classLoader, configuration, errorCollector, phase, phaseComplete`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `JavaAwareCompilationUnit()` Creates a joint compilation unit with the default configuration.
    `JavaAwareCompilationUnit(CompilerConfiguration configuration)` Creates a joint compilation unit with the supplied configuration.
    `JavaAwareCompilationUnit(CompilerConfiguration configuration, GroovyClassLoader groovyClassLoader)` Creates a joint compilation unit with the supplied configuration and class loader.
    `JavaAwareCompilationUnit(CompilerConfiguration configuration, GroovyClassLoader groovyClassLoader, GroovyClassLoader transformClassLoader)` Creates a joint compilation unit with explicit Groovy and transform class loaders.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addSources(String[] paths)` Adds Groovy or Java sources from the supplied path strings.
    `` | `public void` | `addSources(File[] files)` Adds Groovy or Java sources from the supplied files.
    `` | `public void` | `configure(CompilerConfiguration configuration)` Configures the compilation unit and ensures the target directory is on the Groovy class loader classpath.
    `` | `public JavaCompilerFactory` | `getCompilerFactory()` Returns the factory used to create the backing Java compiler.
    `` | `public void` | `gotoPhase(int phase)` Advances the compilation unit to the requested phase and triggers javac when the semantic analysis boundary is reached.
    `` | `public void` | `setCompilerFactory(JavaCompilerFactory compilerFactory)` Sets the factory used to create the backing Java compiler.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class CompilationUnit` | `addClassNode, addFirstPhaseOperation, addFirstPhaseOperation, addJavaCompilationUnits, addNewPhaseOperation, addNewPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addPhaseOperation, addSource, addSource, addSource, addSource, addSource, addSources, addSources, applyToPrimaryClassNodes, applyToSourceUnits, compile, compile, configure, createClassVisitor, dequeued, getAST, getASTTransformationsContext, getClassNode, getClassNodeResolver, getClasses, getClassgenCallback, getFirstClassNode, getJavaCompilationUnitSet, getProgressCallback, getTransformLoader, iterator, mark, setClassNodeResolver, setClassgenCallback, setProgressCallback`
    `class ProcessingUnit` | `completePhase, configure, getClassLoader, getConfiguration, getErrorCollector, getPhase, getPhaseDescription, gotoPhase, isPhaseComplete, nextPhase, setClassLoader, setConfiguration`

- - ### Constructor Detail

    - #### public JavaAwareCompilationUnit()

      Creates a joint compilation unit with the default configuration.

    - #### public JavaAwareCompilationUnit(CompilerConfiguration configuration)

      Creates a joint compilation unit with the supplied configuration.

      Parameters:
        `configuration` - the compiler configuration to use

    - #### public JavaAwareCompilationUnit(CompilerConfiguration configuration, GroovyClassLoader groovyClassLoader)

      Creates a joint compilation unit with the supplied configuration and class loader.

      Parameters:
        `configuration` - the compiler configuration to use
        `groovyClassLoader` - the Groovy class loader to use

    - #### public JavaAwareCompilationUnit(CompilerConfiguration configuration, GroovyClassLoader groovyClassLoader, GroovyClassLoader transformClassLoader)

      Creates a joint compilation unit with explicit Groovy and transform class loaders.

      Parameters:
        `configuration` - the compiler configuration to use
        `groovyClassLoader` - the Groovy class loader to use
        `transformClassLoader` - the class loader used for AST transforms

  - ### Method Detail

    - #### public void addSources(String[] paths)

      Adds Groovy or Java sources from the supplied path strings.

      Parameters:
        `paths` - the source paths to add

    - #### public void addSources(File[] files)

      Adds Groovy or Java sources from the supplied files.

      Parameters:
        `files` - the source files to add

    - #### public void configure(CompilerConfiguration configuration)

      Configures the compilation unit and ensures the target directory is on the Groovy class loader classpath.

      Parameters:
        `configuration` - the compiler configuration to apply

    - #### public JavaCompilerFactory getCompilerFactory()

      Returns the factory used to create the backing Java compiler.

      Returns:
        the Java compiler factory

    - #### public void gotoPhase(int phase)

      Advances the compilation unit to the requested phase and triggers javac when the semantic analysis boundary is reached.

      throws:
        CompilationFailedException if compilation fails
      Parameters:
        `phase` - the target compilation phase

    - #### public void setCompilerFactory(JavaCompilerFactory compilerFactory)

      Sets the factory used to create the backing Java compiler.

      Parameters:
        `compilerFactory` - the Java compiler factory to use