Class Compiler
java.lang.Object
org.codehaus.commons.compiler.AbstractCompiler
org.codehaus.commons.compiler.jdk.Compiler
- All Implemented Interfaces:
ICompiler
javax.tools
-based implementation of the ICompiler
.-
Field Summary
FieldsFields 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
ConstructorsConstructorDescriptionCompiler()
Compiler
(JavaCompiler compiler) Initializes with a different,javax.tools.JavaCompiler
-compatible Java compiler. -
Method Summary
Modifier and TypeMethodDescription(package private) static void
compile
(JavaCompiler compiler, List<String> options, Collection<JavaFileObject> sourceFileObjects, JavaFileManager fileManager, ErrorHandler compileErrorHandler, WarningHandler warningHandler, SortedSet<Location> offsets) Compiles on theJavaFileManager
/JavaFileObject
level.(package private) static void
compile
(JavaCompiler compiler, List<String> options, ResourceFinder sourceFinder, Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator, Resource[] sourceFiles, ErrorHandler compileErrorHandler, WarningHandler warningHandler, SortedSet<Location> offsets) void
void
private static String
filesToPath
(File[] files) private static JavaFileManager
getJavaFileManager
(JavaCompiler compiler, ResourceFinder sourceFileFinder, Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator) Creates aJavaFileManager
that implements the given sourceFileFinder, sourceFileCharset, classFileFinder and classFileCreator.void
setCompilerOptions
(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 Details
-
compilerOptions
-
compiler
-
-
Constructor Details
-
Compiler
public Compiler() -
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
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
Description copied from interface:ICompiler
- 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
-
compile
static void compile(JavaCompiler compiler, List<String> options, ResourceFinder sourceFinder, Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator, Resource[] sourceFiles, @Nullable ErrorHandler compileErrorHandler, @Nullable WarningHandler warningHandler, @Nullable SortedSet<Location> offsets) throws CompileException, IOException - Throws:
CompileException
IOException
-
getJavaFileManager
private static JavaFileManager getJavaFileManager(JavaCompiler compiler, ResourceFinder sourceFileFinder, Charset sourceFileCharset, ResourceFinder classFileFinder, ResourceCreator classFileCreator) Creates aJavaFileManager
that implements the given sourceFileFinder, sourceFileCharset, classFileFinder and classFileCreator. -
compile
static void compile(JavaCompiler compiler, List<String> options, Collection<JavaFileObject> sourceFileObjects, JavaFileManager fileManager, @Nullable ErrorHandler compileErrorHandler, @Nullable WarningHandler warningHandler, @Nullable SortedSet<Location> offsets) throws CompileException, IOException Compiles on theJavaFileManager
/JavaFileObject
level.- Throws:
CompileException
IOException
-
filesToPath
-