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
JDK-base implementation of theICompiler
.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<java.lang.String>
compilerOptions
private javax.tools.JavaFileManager
fileManagerEnn
private static javax.tools.JavaCompiler
SYSTEM_JAVA_COMPILER
-
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()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
compile(Resource[] sourceResources)
private javax.tools.JavaFileManager
getJavaFileManager()
Creates the underlyingJavaFileManager
lazily, becauseAbstractCompiler.setSourcePath(File[])
and consorts are called after initialization.private javax.tools.JavaFileManager
getJavaFileManager2()
private static javax.tools.JavaCompiler
getSystemJavaCompiler()
void
setCompilerOptions(java.lang.String[] compilerOptions)
Adds command line options that are passed unchecked to theCompiler
.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
-
-
-
-
Field Detail
-
SYSTEM_JAVA_COMPILER
private static final javax.tools.JavaCompiler SYSTEM_JAVA_COMPILER
-
compilerOptions
private java.util.Collection<java.lang.String> compilerOptions
-
fileManagerEnn
@Nullable private javax.tools.JavaFileManager fileManagerEnn
-
-
Method Detail
-
setVerbose
public void setVerbose(boolean verbose)
Description copied from interface:ICompiler
Equivalent of-verbose
.
-
setCompilerOptions
public void setCompilerOptions(java.lang.String[] compilerOptions)
Adds command line options that are passed unchecked to theCompiler
.Notice: Don't use the '-g' options - these are controlled through
AbstractCompiler.setDebugLines(boolean)
,AbstractCompiler.setDebugVars(boolean)
andAbstractCompiler.setDebugSource(boolean)
.- Parameters:
compilerOptions
- All command line options supported by the JDK JAVAC tool
-
compile
public void compile(Resource[] sourceResources) throws CompileException, java.io.IOException
Description copied from interface:ICompiler
- Parameters:
sourceResources
- Contain the compilation units to compile- Throws:
CompileException
java.io.IOException
-
getSystemJavaCompiler
private static javax.tools.JavaCompiler getSystemJavaCompiler()
-
getJavaFileManager
private javax.tools.JavaFileManager getJavaFileManager()
Creates the underlyingJavaFileManager
lazily, becauseAbstractCompiler.setSourcePath(File[])
and consorts are called after initialization.
-
getJavaFileManager2
private javax.tools.JavaFileManager getJavaFileManager2()
-
-