public final class JkJavaCompiler<T>
extends java.lang.Object
JavaCompiler
instance either an external
process (forked mode).
The compiler selection follows these rules :
Modifier and Type | Field and Description |
---|---|
T |
__
Owner for parent chaining
|
static java.nio.file.PathMatcher |
JAVA_SOURCE_MATCHER
Filter to consider only Java source
|
Modifier and Type | Method and Description |
---|---|
boolean |
compile(JkJavaCompileSpec compileSpec)
Actually compile the source files to the output directory.
|
static JkJavaCompiler<java.lang.Void> |
of()
Creates a
JkJavaCompiler without specifying a JavaCompiler instance or an external process. |
static <T> JkJavaCompiler<T> |
ofParent(T parent)
Same as
of() but mentioning a owner for parent chaining. |
JkJavaCompiler<T> |
setCompileTool(javax.tools.JavaCompiler compiler,
java.lang.String... params)
Sets underlying java compiler tool to use.
|
JkJavaCompiler<T> |
setForkedWithDefaultProcess(java.lang.String... processParams)
Invoking this method will make the compilation occurs in a forked process
if no compileTool has been specified.
The forked process will be a javac command taken from the running jdk or an extra-one according the source version. |
JkJavaCompiler<T> |
setForkedWithProcess(JkProcess compileProcess)
Sets the underlying compiler with the specified process.
|
JkJavaCompiler<T> |
setJdkHomes(java.util.Map<JkJavaVersion,java.nio.file.Path> jdks)
Sets available JDK in order to choose the most appropriate version
for compiling.
|
JkJavaCompiler<T> |
setJdkHomesWithProperties(java.util.Map<java.lang.String,java.lang.String> jdkLocations)
Sets available JDK in order to choose the most appropriate version
for compiling.
|
public static final java.nio.file.PathMatcher JAVA_SOURCE_MATCHER
public final T __
public static JkJavaCompiler<java.lang.Void> of()
JkJavaCompiler
without specifying a JavaCompiler
instance or an external process.
When nothing is specified, this compiler will try the default JavaCompiler
instance provided
by the running JDK.public static <T> JkJavaCompiler<T> ofParent(T parent)
of()
but mentioning a owner for parent chaining.public JkJavaCompiler<T> setCompileTool(javax.tools.JavaCompiler compiler, java.lang.String... params)
public JkJavaCompiler<T> setForkedWithProcess(JkProcess compileProcess)
public JkJavaCompiler<T> setJdkHomes(java.util.Map<JkJavaVersion,java.nio.file.Path> jdks)
public JkJavaCompiler<T> setForkedWithDefaultProcess(java.lang.String... processParams)
public JkJavaCompiler<T> setJdkHomesWithProperties(java.util.Map<java.lang.String,java.lang.String> jdkLocations)
setJdkHomes(Map).
public boolean compile(JkJavaCompileSpec compileSpec)
false
if a compilation error occurred.java.lang.IllegalStateException
- if a compilation error occurred and the 'withFailOnError' flag is true
.