Package org.codehaus.commons.compiler.jdk

# Class Compiler

java.lang.Object
org.codehaus.commons.compiler.AbstractCompiler
org.codehaus.commons.compiler.jdk.Compiler

All Implemented Interfaces:
  `ICompiler`

public class Compiler extends AbstractCompiler
`javax.tools`-based implementation of the `ICompiler`.

## Field Summary

### Fields inherited from class org.codehaus.commons.compiler.AbstractCompiler

`bootClassPath, classFileCreator, classFileFinder, classPath, compileErrorHandler, debugLines, debugSource, debugVars, extensionDirectories, sourceCharset, sourceFinder, sourceVersion, targetVersion, warningHandler`

### Fields inherited from interface org.codehaus.commons.compiler.ICompiler

`CREATE_NEXT_TO_SOURCE_FILE, FIND_NEXT_TO_SOURCE_FILE, NO_DESTINATION_DIRECTORY`

## Constructor Summary

Constructors
Constructor
Description
`Compiler()`
`Compiler(JavaCompiler compiler)`
Initializes with a different, `javax.tools.JavaCompiler`-compatible Java compiler.

## Method Summary

Modifier and Type
Method
Description
`void`
`compile(Resource[] sourceResources)`
See `ICompiler.compile(File[])`.
`void`
`compile(Resource[] sourceResources, SortedSet<Location> offsets)`
`void`
`setCompilerOptions(String[] compilerOptions)`
Adds command line options that are passed unchecked to the
invalid reference

    java.lang.Compiler

.
`void`
`setVerbose(boolean verbose)`
Equivalent of `-verbose`.

### Methods inherited from class org.codehaus.commons.compiler.AbstractCompiler

`compile, setBootClassPath, setCharacterEncoding, setClassFileCreator, setClassFileFinder, setClassFileFinder, setClassPath, setCompileErrorHandler, setDebugLines, setDebugSource, setDebugVars, setDestinationDirectory, setEncoding, setExtensionDirectories, setSourceCharset, setSourceFinder, setSourcePath, setSourceVersion, setTargetVersion, setWarningHandler`

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

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

## Constructor Details

### Compiler

public Compiler()

### Compiler

public Compiler(JavaCompiler compiler)
Initializes with a different, `javax.tools.JavaCompiler`-compatible Java compiler.

## Method Details

### setVerbose

public void setVerbose(boolean verbose)
Description copied from interface: `ICompiler`
Equivalent of `-verbose`.

### setCompilerOptions

public void setCompilerOptions(String[] compilerOptions)
Adds command line options that are passed unchecked to the
invalid reference

    java.lang.Compiler

.

Notice: Don't use the '-g' options - these are controlled through `AbstractCompiler.setDebugLines(boolean)`, `AbstractCompiler.setDebugVars(boolean)` and `AbstractCompiler.setDebugSource(boolean)`.

Parameters:
  `compilerOptions` - All command line options supported by the JDK JAVAC tool

### compile

public void compile(Resource[] sourceResources) throws CompileException, IOException
Description copied from interface: `ICompiler`
See `ICompiler.compile(File[])`.

Parameters:
  `sourceResources` - Contain the compilation units to compile
Throws:
  `CompileException`
  `IOException`

### compile

public void compile(Resource[] sourceResources, @Nullable SortedSet<Location> offsets) throws CompileException, IOException

Throws:
  `CompileException`
  `IOException`