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 theICompiler.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.tools.JavaCompilercompilerprivate java.util.Collection<java.lang.String>compilerOptions-
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static voidcompile(javax.tools.JavaCompiler compiler, java.util.List<java.lang.String> options, java.util.Collection<javax.tools.JavaFileObject> sourceFileObjects, javax.tools.JavaFileManager fileManager, ErrorHandler compileErrorHandler, WarningHandler warningHandler, java.util.SortedSet<Location> offsets)Compiles on theJavaFileManager/JavaFileObjectlevel.(package private) static voidcompile(javax.tools.JavaCompiler compiler, java.util.List<java.lang.String> options, ResourceFinder sourceFinder, java.nio.charset.Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator, Resource[] sourceFiles, ErrorHandler compileErrorHandler, WarningHandler warningHandler, java.util.SortedSet<Location> offsets)voidcompile(Resource[] sourceResources)voidcompile(Resource[] sourceResources, java.util.SortedSet<Location> offsets)private static java.lang.StringfilesToPath(java.io.File[] files)private static javax.tools.JavaFileManagergetJavaFileManager(javax.tools.JavaCompiler compiler, ResourceFinder sourceFileFinder, java.nio.charset.Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator)Creates aJavaFileManagerthat implements the given sourceFileFinder, sourceFileCharset, classFileFinder and classFileCreator.voidsetCompilerOptions(java.lang.String[] compilerOptions)Adds command line options that are passed unchecked to theCompiler.voidsetVerbose(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
-
-
-
-
Method Detail
-
setVerbose
public void setVerbose(boolean verbose)
Description copied from interface:ICompilerEquivalent 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:
CompileExceptionjava.io.IOException
-
compile
public void compile(Resource[] sourceResources, @Nullable java.util.SortedSet<Location> offsets) throws CompileException, java.io.IOException
- Throws:
CompileExceptionjava.io.IOException
-
compile
static void compile(javax.tools.JavaCompiler compiler, java.util.List<java.lang.String> options, ResourceFinder sourceFinder, java.nio.charset.Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator, Resource[] sourceFiles, @Nullable ErrorHandler compileErrorHandler, @Nullable WarningHandler warningHandler, @Nullable java.util.SortedSet<Location> offsets) throws CompileException, java.io.IOException- Throws:
CompileExceptionjava.io.IOException
-
getJavaFileManager
private static javax.tools.JavaFileManager getJavaFileManager(javax.tools.JavaCompiler compiler, ResourceFinder sourceFileFinder, java.nio.charset.Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator)Creates aJavaFileManagerthat implements the given sourceFileFinder, sourceFileCharset, classFileFinder and classFileCreator.
-
compile
static void compile(javax.tools.JavaCompiler compiler, java.util.List<java.lang.String> options, java.util.Collection<javax.tools.JavaFileObject> sourceFileObjects, javax.tools.JavaFileManager fileManager, @Nullable ErrorHandler compileErrorHandler, @Nullable WarningHandler warningHandler, @Nullable java.util.SortedSet<Location> offsets) throws CompileException, java.io.IOExceptionCompiles on theJavaFileManager/JavaFileObjectlevel.- Throws:
CompileExceptionjava.io.IOException
-
filesToPath
private static java.lang.String filesToPath(java.io.File[] files)
-
-