Clients shouldn't implement this interface.
Create a new instance using newBuilder().
public TaskFactory< | Builds the task factory for the compilation. |
public JavaCompilationWorkerTaskIdentifier | Builds the task identifier that should be used to start the configured task. |
public static JavaCompilationTaskBuilder | Creates a new builder instance. |
public void | setAddExports( Sets the add-exports configuration to pass to javac . |
public void | setAddReads( Sets the add-reads configuration to pass to javac . |
public void | setAllowTargetReleaseMismatch( |
public void | setAnnotationProcessorOptions( Sets the global key-value string options that should be passed to the annotation processors. |
public void | setAnnotationProcessors( Sets the annotation processors that should be used during the compilation. |
public void | setAutomaticCompilationIdentifier( Sets the compilation identifier of the worker task to be automatically determined based on the configuration. |
public void | setBootClassPath( Sets the compilation boot classpath. |
public void | setBuildIncremental( Sets whether or not to compile the sources using the incremental compiler implementation. |
public void | setClassPath( Sets the input compilation classpath. |
public void | setCompilationIdentifier( Sets the compilation identifier for the worker task. |
public void | setDebugInfo( Sets the debug informations that should be included in the generated class files. |
public void | setGenerateNativeHeaders( Sets whether or not native headers should be generated for the compiled classes. |
public void | setModuleMainClass( Sets the module main class name to inject into the generated module-info.class file. |
public void | setModulePath( Sets the module path for the compilation. |
public void | setModuleVersion( Sets the module version string to inject into the generated module-info.class file. |
public void | setParallelProcessing( Sets whether or not the annotation processors should be run in a parallel way. |
public void | setParameterNames( Sets if the parameter names should be included in the generated class files. |
public void | setParameters( Sets the parameters that are directly passed to the javac backed during compilation. |
public void | setPatchEnablePreview( Sets if the --enable-preview requirement in the generated class files should be patched. |
public void | setProcessorInputLocations( Sets the read-only input locations that the annotation processors can read. |
public void | setSDKs( Sets the SDKs that should be used during the compilation. |
public void | setSourceDirectories( Sets the source directory for the compilation. |
public void | setSourceVersion( Sets the source version of the source files. |
public void | setSuppressWarnings( Sets the global warning types that should be suppressed by the compiler task. |
public void | setTargetVersion( Sets the target version of the generated class files. |
The task works specified by the configuration in this builder. The task should be started with the buildTaskIdentifier() as the task identifier.
The builder can be reused after this call.
The builder can be reused after this call.
javac
.javac
.WARNING: Using this flag may cause your class files to be binary incompatible with the platform you intend to run it on. This flag uses undocumented javac API to trick it into generating bytecode for different versions than it's used to. Using this may cause crashes in your application in unexpected ways.
If this is set to true
, the compiler task will set the source, target, and --release values in a way
that may allow generating bytecode for different Java versions than the one dicatated by the source version.
true
to enable mismatched values.The task directory context is used to infer working directory related information for the compilation identifier.
null
if none.
Setting this to false
will cause the compiler task to fall back to the legacy compiler
implementation that always compiles every input source file.
This can be used if you experience errors in the incremental compiler, or need to take advantage of legacy features. The non-incremental compilation may not be supported in some cases.
The default is true
.
false
to not build incrementally.null
.
Corresponds to the -g
javac
option.
The default is to include all debugging information.
null
to use the default. The
elements should be any of the contants defined in JavaDebugInfoType.
The default is false
.
true
to generate native headers.module-info.class
file. The compiler task will insert the specified class name as the main class into the generated module-info class file. If there's no compiled module, nothing will be done.
The compiler task doesn't verify if a class with the specified name exists.
If the compilation targets Java 8 or earlier, the module path will be ignored.
module-info.class
file. The compiler task will insert the specified version string as the main version into the generated module-info class file. If there's no compiled module, nothing will be done.
The incremental compiler runs the annotation processing in a parallel way to improve performance. If you
experience issues with it, or need the resulf of Processor.process(false
.
The default is true
.
false
to disable parallel annotation processing
Corresponds to the -parameters
javac
option.
The default is true
.
true
to include parameter names.javac
backed during compilation. Some of the parameters may be specially handled by the compiler task. If available, it is recommended to configure the options using the appropriate builder method.
Setting this flag to true
causes the compiler task to patch the minor version of the generated class
files if the --enable-preview
parameter is also used for compilation.
It will allow you to run the classes without specifying --enable-preview
for the java
command.
Note that this feature may break on future Java versions. This flag essentially modifies the minor version
of the class files from 0xFFFF
to 0x0000
.
true
to enable --enable-preview patching.
The processors can access the files in the specified locations by using
StandardLocation.locationFor(
null
.The SDKs are used to determine the JVM that compiles the sources, to resolve class and module paths.
If an SDK is not specified with the name Java
, the
default is included.
The sources that are the input of the compilation are determined based on the argument.
null
to use the default.The elements should be any of the constants in JavaCompilerWarningType.
null
to use the default.