Interface JctCompilation
This provides access to a number of useful pieces of information including the file manager used for the compilation, compiler logs, and diagnostics.
- Since:
 - 0.0.1
 - Author:
 - Ashley Scopes
 
- 
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable ModuleContainerGroupGet the module container group for the annotation processor module path.default @Nullable PackageContainerGroupGet the package container group for the annotation processor path.Get the command line arguments that were passed to the compiler.default @Nullable OutputContainerGroupGet the output container group for class outputs.default @Nullable PackageContainerGroupGet the package container group for the class path.Get the compilation units used in the compilation.Get the diagnostics that were reported by the compilation, in the order that they were reported.Get the file manager that was used to store and manage files.default @Nullable ModuleContainerGroupGet the module container group for the module path.default @Nullable ModuleContainerGroupGet the module container group for the module source path.default @Nullable OutputContainerGroupGet the output container group for the native header file outputs.Get the lines of output produced by the compiler, if any were captured.default @Nullable ModuleContainerGroupGet the module container group for the patch module path.default @Nullable PackageContainerGroupGet the package container group for the platform class path (a.k.a. the bootstrap class path).default @Nullable OutputContainerGroupGet the output container group for source outputs.default @Nullable PackageContainerGroupGet the package container group for the source path.default @Nullable ModuleContainerGroupGet the module container group for all system modules that are part of the JDK distribution.default @Nullable ModuleContainerGroupGet the module container group for the upgrade module path.booleanDetermine if warnings were treated as errors.default booleanDetermine if the compilation was a failure or not.booleanDetermine if the compilation was successful or not. 
- 
Method Details
- 
getArguments
Get the command line arguments that were passed to the compiler.- Returns:
 - the command line arguments.
 - Since:
 - 0.5.0
 
 - 
isFailOnWarnings
boolean isFailOnWarnings()Determine if warnings were treated as errors.- Returns:
 trueif warnings were treated as errors, orfalseotherwise.
 - 
isSuccessful
boolean isSuccessful()Determine if the compilation was successful or not.- Returns:
 trueif successful, orfalseif not successful.
 - 
isFailure
Determine if the compilation was a failure or not.- Returns:
 trueif not successful, orfalseif successful.
 - 
getOutputLines
Get the lines of output produced by the compiler, if any were captured.This is separate to diagnostics.
- Returns:
 - the lines of output.
 
 - 
getCompilationUnits
Get the compilation units used in the compilation.- Returns:
 - the compilation units.
 
 - 
getDiagnostics
Get the diagnostics that were reported by the compilation, in the order that they were reported.- Returns:
 - the diagnostics
 
 - 
getFileManager
Get the file manager that was used to store and manage files.This can be used to obtain a classloader for any compiled sources, which can then be used to reflectively test what the compiler produced.
- Returns:
 - the file manager.
 
 - 
getClassOutputs
Get the output container group for class outputs.This usually consists of any
*.classfiles produced by the compiler, and is equivalent totarget/classesin a Maven project.- Returns:
 - the output container group, or 
nullif it does not exist. 
 - 
getSourceOutputs
Get the output container group for source outputs.This consists of any generated source code created by annotation processors, and is equivalent to
target/generated-sourcesin a Maven project.- Returns:
 - the output container group, or 
nullif it does not exist. 
 - 
getClassPath
Get the package container group for the class path.This represents the class path used for compilation.
- Returns:
 - the package container group, or 
nullif it does not exist. 
 - 
getSourcePath
Get the package container group for the source path.This is equivalent to
src/main/javaandsrc/main/resourcesin a Maven project.- Returns:
 - the package container group, or 
nullif it does not exist. 
 - 
getAnnotationProcessorPath
Get the package container group for the annotation processor path.- Returns:
 - the package container group, or 
nullif it does not exist. 
 - 
getAnnotationProcessorModulePath
Get the module container group for the annotation processor module path.- Returns:
 - the module container group, or 
nullif it does not exist. 
 - 
getPlatformClassPath
Get the package container group for the platform class path (a.k.a. the bootstrap class path).You generally do not need to use this. The platform class path mechanism has been mostly replaced by the use of the system modules path as of Java 11. It is simply provided for backwards compatibility.
- Returns:
 - the package container group, or 
nullif it does not exist. 
 - 
getNativeHeaderOutputs
Get the output container group for the native header file outputs.If you invoke
javacwith the-Hflag, then this represents the directory that C/C++ header file stubs for JNI are written to.- Returns:
 - the output container group, or 
nullif it does not exist. 
 - 
getModuleSourcePath
Get the module container group for the module source path.Many build tools do not provide a direct equivalent of this mechanism as of now, but this is a source path introduced in Java 9 that allows specifying multiple named JPMS modules to compile under a single compilation invocation.
For example, you may use this in a project to compile an API module, a default implementation module, and a module containing unit tests all together.
- Returns:
 - the module container group, or 
nullif it does not exist. 
 - 
getUpgradeModulePath
Get the module container group for the upgrade module path.You generally will not need to use this, as this is a mechanism used to upgrade modules in-place incrementally with fixes without redistributing the entire application.
- Returns:
 - the module container group, or 
nullif it does not exist. 
 - 
getSystemModules
Get the module container group for all system modules that are part of the JDK distribution.This will usually just point to the Java standard library.
- Returns:
 - the module container group, or 
nullif it does not exist. 
 - 
getModulePath
Get the module container group for the module path.This is equivalent to the class path, but holds any JPMS modules.
- Returns:
 - the module container group, or 
nullif it does not exist. 
 - 
getPatchModulePath
Get the module container group for the patch module path.You generally will not need to use this. It consists of patchable module sources that can be used to inject additional classes into a module. This can be used for cases like unit tests where you wish to embed the unit test classes into the existing application module to exploit features such as package private access.
- Returns:
 - the module container group, or 
nullif it does not exist. 
 
 -