Class AbstractJctCompiler
- All Implemented Interfaces:
JctCompiler
JctCompilationImpl
as the compilation result.
Implementations should extend this class and override anything they require. In most cases, you should not need to override anything other than the constructor.
This class is not thread-safe.
If you wish to create a common set of configuration settings for instances of
this class, you should consider writing a custom JctCompilerConfigurer
object to apply
the desired operations, and then apply it to instances of this class using
configure(JctCompilerConfigurer)
.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Field Summary
Fields inherited from interface io.github.ascopes.jct.compilers.JctCompiler
DEFAULT_ANNOTATION_PROCESSOR_DISCOVERY, DEFAULT_COMPILATION_MODE, DEFAULT_DEBUGGING_INFO, DEFAULT_DIAGNOSTIC_LOGGING_MODE, DEFAULT_FAIL_ON_WARNINGS, DEFAULT_FILE_MANAGER_LOGGING_MODE, DEFAULT_FIX_JVM_MODULE_PATH_MISMATCH, DEFAULT_INHERIT_CLASS_PATH, DEFAULT_INHERIT_MODULE_PATH, DEFAULT_INHERIT_SYSTEM_MODULE_PATH, DEFAULT_LOCALE, DEFAULT_LOG_CHARSET, DEFAULT_PARAMETER_INFO_ENABLED, DEFAULT_PREVIEW_FEATURES, DEFAULT_SHOW_DEPRECATION_WARNINGS, DEFAULT_SHOW_WARNINGS, DEFAULT_VERBOSE
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractJctCompiler
(String defaultName) Initialize this compiler. -
Method Summary
Modifier and TypeMethodDescriptionaddAnnotationProcessorOptions
(Iterable<String> annotationProcessorOptions) Add options to pass to any annotation processors.addAnnotationProcessors
(Iterable<? extends Processor> annotationProcessors) Add annotation processors to invoke.addCompilerOptions
(Iterable<String> compilerOptions) Add command line options to pass tojavac
.annotationProcessorDiscovery
(AnnotationProcessorDiscovery annotationProcessorDiscovery) Set how to perform annotation processor discovery.buildFlags
(JctFlagBuilder flagBuilder) Build the list of flags from this compiler object using the flag builder.compilationMode
(CompilationMode compilationMode) Set the compilation mode to use for this compiler.Invoke the compilation and return the compilation result.compile
(Workspace workspace, Collection<String> classNames) Invoke the compilation and return the compilation result.final <E extends Exception>
AbstractJctCompilerconfigure
(JctCompilerConfigurer<E> configurer) Apply a given configurer to this compiler.debuggingInfo
(Set<DebuggingInfo> debuggingInfo) Set the debugging info level to use.diagnosticLoggingMode
(LoggingMode diagnosticLoggingMode) Set how to handle diagnostic capture.failOnWarnings
(boolean enabled) Set whether to enable treating warnings as errors or not.fileManagerLoggingMode
(LoggingMode fileManagerLoggingMode) Set how to handle logging calls to underlying file managers.fixJvmModulePathMismatch
(boolean fixJvmModulePathMismatch) Get whether we will attempt to fix modules appearing on the classpath, or non-modules appearing on the module path.Get how to perform annotation processor discovery.Get an immutable snapshot view of the current annotation processor options that are set.Get an immutable snapshot view of the current annotation processors that are explicitly set to be run, in the order that they were provided to the compiler.Get the compilation factory to use for building a compilation.Get the compilation mode that is in use.abstract Jsr199CompilerFactory
Get the JSR-199 compiler factory to use for initialising an internal compiler.Get an immutable snapshot view of the current compiler options that are set.Get the debugging info that is enabled.abstract String
Get the default release to use if no release or target version is specified.Get the current diagnostic logging mode.Get the effective release to use for the actual compilation.Get the file manager factory to use for building AbstractJctCompiler file manager during compilation.Get the current file manager logging mode.abstract JctFlagBuilderFactory
Get the flag builder factory to use for building flags.Get the output locale.Get the charset being used to write compiler logs with.getName()
Get the friendly printable name of this compiler object.Get the current release version that is set, ornull
if left to the compiler to decide.Get the current source version that is set, ornull
if left to the compiler to decide.Get the current target version that is set, ornull
if left to the compiler default.inheritClassPath
(boolean inheritClassPath) Set whether the class path is inherited from the active JVM or not.inheritModulePath
(boolean inheritModulePath) Set whether the module path is inherited from the active JVM or not.inheritSystemModulePath
(boolean inheritSystemModulePath) Set whether the system module path is inherited from the active JVM or not.boolean
Determine whether warnings are being treated as errors or not.boolean
Get whether we will attempt to fix modules appearing on the classpath, or non-modules appearing on the module path.boolean
Get whether the class path is inherited from the active JVM or not.boolean
Get whether the module path is inherited from the active JVM or not.boolean
Get whether the system module path is inherited from the active JVM or not.boolean
Determine if including reflective parameter info is enabled or not.boolean
Determine whether preview features are enabled or not.boolean
Determine whether deprecation warnings are enabled or not.boolean
Determine whether warnings are enabled or not.boolean
Determine whether verbose logging is enabled or not.Set the output locale.logCharset
(Charset logCharset) Set the charset being used to write compiler logs with.Set the friendly name of this compiler.parameterInfoEnabled
(boolean parameterInfoEnabled) Set whether to include parameter reflective info by default in compiled classes or not.previewFeatures
(boolean enabled) Set whether to enable compiler preview features or not.Set the release version.showDeprecationWarnings
(boolean enabled) Set whether to enable deprecation warnings or not.showWarnings
(boolean enabled) Set whether to enable displaying warnings or not.Set the source version.Set the target version.final String
toString()
Get the string representation of the compiler.verbose
(boolean enabled) Set whether to use verbose output or not.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.ascopes.jct.compilers.JctCompiler
addAnnotationProcessorOptions, addAnnotationProcessors, addCompilerOptions, compile, release, release, source, source, target, target, useRuntimeRelease
-
Constructor Details
-
AbstractJctCompiler
Initialize this compiler.- Parameters:
defaultName
- the printable default name to use for the compiler.
-
-
Method Details
-
compile
Description copied from interface:JctCompiler
Invoke the compilation and return the compilation result.The actual classes to compile will be dynamically discovered. If you wish to specify the specific classes to compile, see
JctCompiler.compile(Workspace, String...)
orJctCompiler.compile(Workspace, Collection)
.- Specified by:
compile
in interfaceJctCompiler
- Parameters:
workspace
- the workspace to compile.- Returns:
- the compilation result.
- See Also:
-
compile
Description copied from interface:JctCompiler
Invoke the compilation and return the compilation result.Only classes matching the given class names will be compiled.
If you wish to let JCT determine which classes to compile dynamically, see
JctCompiler.compile(Workspace)
instead.Note that nested instance/static nested classes cannot be specified individually here. To compile them, you must also compile their outer class that they are defined within.
- Specified by:
compile
in interfaceJctCompiler
- Parameters:
workspace
- the workspace to compile.classNames
- the class names to compile.- Returns:
- the compilation result.
- See Also:
-
configure
public final <E extends Exception> AbstractJctCompiler configure(JctCompilerConfigurer<E> configurer) throws E Description copied from interface:JctCompiler
Apply a given configurer to this compiler.Configurers can be lambdas, method references, or objects.
// Using an object configurer var werrorConfigurer = new JctCompilerConfigurer<RuntimeException>() { @Override public void configure(JctCompiler compiler) { compiler.failOnWarnings(true); } }; compiler.configure(werrorConfigurer); // Using a lambda configurer compiler.configure(c -> c.verbose(true));
Configurers take a type parameter that corresponds to an exception type. This is the exception type that can be thrown by the configurer, or
RuntimeException
if no checked exception is thrown. This mechanism allows configurers to propagate checked exceptions to their caller where needed.class FileFlagConfigurer implements JctCompilerConfigurer<IOException> { private final Path path; public FileFlagConfigurer(String... path) { this(Path.of(path)); } public FileFlagConfigurer(Path path) { this.path = path; } @Override public void configure(JctCompiler compiler) throws IOException { var flags = Files.lines(path) .map(String::trim) .filter(not(String::isBlank)) .toList(); compiler.addCompilerOptions(flags); } } @Test void testSomething() throws IOException { ... compiler.configure(new FileFlagConfigurer("src", "test", "resources", "flags.txt")); ... }
- Specified by:
configure
in interfaceJctCompiler
- Type Parameters:
E
- any exception that may be thrown.- Parameters:
configurer
- the configurer to invoke.- Returns:
- this compiler object for further call chaining.
- Throws:
E
- any exception that may be thrown by the configurer. If no checked exception is thrown, then this should be treated asRuntimeException
.
-
getName
Description copied from interface:JctCompiler
Get the friendly printable name of this compiler object.- Specified by:
getName
in interfaceJctCompiler
- Returns:
- the name of the compiler.
-
name
Description copied from interface:JctCompiler
Set the friendly name of this compiler.This will be used by the
JUnit5 support
to name unit test cases.- Specified by:
name
in interfaceJctCompiler
- Parameters:
name
- the name to set.- Returns:
- this compiler object for further call chaining.
-
isVerbose
Description copied from interface:JctCompiler
Determine whether verbose logging is enabled or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_VERBOSE
.Note that enabling this is compiler-specific behaviour. There is no guarantee that the output target or the format or verbosity of output will be consistent between different compiler implementations.
- Specified by:
isVerbose
in interfaceJctCompiler
- Returns:
- whether verbose logging is enabled or not.
-
verbose
Description copied from interface:JctCompiler
Set whether to use verbose output or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_VERBOSE
.Note that enabling this is compiler-specific behaviour. There is no guarantee that the output target or the format or verbosity of output will be consistent between different compiler implementations.
- Specified by:
verbose
in interfaceJctCompiler
- Parameters:
enabled
-true
for verbose output,false
for normal output.- Returns:
- this compiler for further call chaining.
-
isPreviewFeatures
Description copied from interface:JctCompiler
Determine whether preview features are enabled or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_PREVIEW_FEATURES
.- Specified by:
isPreviewFeatures
in interfaceJctCompiler
- Returns:
- whether preview features are enabled or not.
-
previewFeatures
Description copied from interface:JctCompiler
Set whether to enable compiler preview features or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_PREVIEW_FEATURES
.Generally, this feature should be avoided if testing across multiple versions of Java, as preview features are often not finalised and may change without warning.
- Specified by:
previewFeatures
in interfaceJctCompiler
- Parameters:
enabled
-true
to enable preview features, orfalse
to disable them.- Returns:
- this compiler object for further call chaining.
-
isShowWarnings
Description copied from interface:JctCompiler
Determine whether warnings are enabled or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_SHOW_WARNINGS
.- Specified by:
isShowWarnings
in interfaceJctCompiler
- Returns:
- whether warnings are enabled or not.
-
showWarnings
Description copied from interface:JctCompiler
Set whether to enable displaying warnings or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_SHOW_WARNINGS
.- Specified by:
showWarnings
in interfaceJctCompiler
- Parameters:
enabled
-true
to enable warnings.false
to disable them.- Returns:
- this compiler object for further call chaining.
-
isShowDeprecationWarnings
Description copied from interface:JctCompiler
Determine whether deprecation warnings are enabled or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_SHOW_DEPRECATION_WARNINGS
.- Specified by:
isShowDeprecationWarnings
in interfaceJctCompiler
- Returns:
- whether deprecation warnings are enabled or not.
-
showDeprecationWarnings
Description copied from interface:JctCompiler
Set whether to enable deprecation warnings or not.This is ignored if
JctCompiler.showWarnings(boolean)
is disabled.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_SHOW_DEPRECATION_WARNINGS
.- Specified by:
showDeprecationWarnings
in interfaceJctCompiler
- Parameters:
enabled
-true
to enable deprecation warnings.false
to disable them.- Returns:
- this compiler object for further call chaining.
-
isFailOnWarnings
Description copied from interface:JctCompiler
Determine whether warnings are being treated as errors or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_FAIL_ON_WARNINGS
.- Specified by:
isFailOnWarnings
in interfaceJctCompiler
- Returns:
- whether warnings are being treated as errors or not.
-
failOnWarnings
Description copied from interface:JctCompiler
Set whether to enable treating warnings as errors or not.Some compilers may call this flag something different, such as "
-Werror
".This is ignored if
JctCompiler.showWarnings(boolean)
is disabled.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_FAIL_ON_WARNINGS
.- Specified by:
failOnWarnings
in interfaceJctCompiler
- Parameters:
enabled
-true
to enable treating warnings as errors.false
to disable them.- Returns:
- this compiler object for further call chaining.
-
getCompilationMode
Description copied from interface:JctCompiler
Get the compilation mode that is in use.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_COMPILATION_MODE
.- Specified by:
getCompilationMode
in interfaceJctCompiler
- Returns:
- the compilation mode.
-
compilationMode
Description copied from interface:JctCompiler
Set the compilation mode to use for this compiler.This allows you to override whether sources are compiled or annotation-processed without running the full compilation process. Tuning this may provide faster test cases in some situations.
Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_COMPILATION_MODE
.- Specified by:
compilationMode
in interfaceJctCompiler
- Parameters:
compilationMode
- the compilation mode to use.- Returns:
- this compiler object for further call chaining.
-
getAnnotationProcessorOptions
Description copied from interface:JctCompiler
Get an immutable snapshot view of the current annotation processor options that are set.- Specified by:
getAnnotationProcessorOptions
in interfaceJctCompiler
- Returns:
- the current annotation processor options that are set.
-
addAnnotationProcessorOptions
public AbstractJctCompiler addAnnotationProcessorOptions(Iterable<String> annotationProcessorOptions) Description copied from interface:JctCompiler
Add options to pass to any annotation processors.- Specified by:
addAnnotationProcessorOptions
in interfaceJctCompiler
- Parameters:
annotationProcessorOptions
- the options to pass.- Returns:
- this compiler object for further call chaining.
-
getAnnotationProcessors
Description copied from interface:JctCompiler
Get an immutable snapshot view of the current annotation processors that are explicitly set to be run, in the order that they were provided to the compiler.- Specified by:
getAnnotationProcessors
in interfaceJctCompiler
- Returns:
- the current annotation processors that are set.
-
addAnnotationProcessors
public AbstractJctCompiler addAnnotationProcessors(Iterable<? extends Processor> annotationProcessors) Description copied from interface:JctCompiler
Add annotation processors to invoke.Warning: This bypasses the discovery process of annotation processors provided in the annotation processor path and annotation processor module paths, as well as any other locations such as class paths and module paths.
- Specified by:
addAnnotationProcessors
in interfaceJctCompiler
- Parameters:
annotationProcessors
- the processors to invoke.- Returns:
- this compiler object for further call chaining.
-
getCompilerOptions
Description copied from interface:JctCompiler
Get an immutable snapshot view of the current compiler options that are set.- Specified by:
getCompilerOptions
in interfaceJctCompiler
- Returns:
- the current compiler options that are set.
-
addCompilerOptions
Description copied from interface:JctCompiler
Add command line options to pass tojavac
.- Specified by:
addCompilerOptions
in interfaceJctCompiler
- Parameters:
compilerOptions
- the options to add.- Returns:
- this compiler object for further call chaining.
-
getEffectiveRelease
Description copied from interface:JctCompiler
Get the effective release to use for the actual compilation.Generally, this value will be an integer within a string. The value is represented as a string to allow supporting compilers which may use non-integer version numbers.
This may be determined from the
source
,target
,release
, anddefault release.
- Specified by:
getEffectiveRelease
in interfaceJctCompiler
- Returns:
- the effective release.
-
getRelease
Description copied from interface:JctCompiler
Get the current release version that is set, ornull
if left to the compiler to decide. default.Generally, this value will be an integer within a string. The value is represented as a string to allow supporting compilers which may use non-integer version numbers.
Unless explicitly defined, the default setting is expected to be a sane compiler-specific default.
- Specified by:
getRelease
in interfaceJctCompiler
- Returns:
- the release version string, if set.
-
release
Description copied from interface:JctCompiler
Set the release version.This will clear any source and target version that is set.
Generally, this value will be an integer within a string. The value is represented as a string to allow supporting compilers which may use non-integer version numbers.
Unless explicitly defined, the default setting is expected to be a sane compiler-specific default.
- Specified by:
release
in interfaceJctCompiler
- Parameters:
release
- the version to set.- Returns:
- this compiler object for further call chaining.
-
getSource
Description copied from interface:JctCompiler
Get the current source version that is set, ornull
if left to the compiler to decide. default.Unless explicitly defined, the default setting is expected to be a sane compiler-specific default.
- Specified by:
getSource
in interfaceJctCompiler
- Returns:
- the source version string, if set.
-
source
Description copied from interface:JctCompiler
Set the source version.This will clear any release version that is set.
Unless explicitly defined, the default setting is expected to be a sane compiler-specific default.
Source and target versions have mostly been replaced with the release version mechanism which controls both flags and can ensure other behaviours are consistent. This feature is still provided in case you have a specific use case that is not covered by this functionality.
- Specified by:
source
in interfaceJctCompiler
- Parameters:
source
- the version to set.- Returns:
- this compiler object for further call chaining.
-
getTarget
Description copied from interface:JctCompiler
Get the current target version that is set, ornull
if left to the compiler default.Unless explicitly defined, the default setting is expected to be a sane compiler-specific default.
- Specified by:
getTarget
in interfaceJctCompiler
- Returns:
- the target version string, if set.
-
target
Description copied from interface:JctCompiler
Set the target version.This will clear any release version that is set.
Unless explicitly defined, the default setting is expected to be a sane compiler-specific default.
Source and target versions have mostly been replaced with the release version mechanism which controls both flags and can ensure other behaviours are consistent. This feature is still provided in case you have a specific use case that is not covered by this functionality.
- Specified by:
target
in interfaceJctCompiler
- Parameters:
target
- the version to set.- Returns:
- this compiler object for further call chaining.
-
isFixJvmModulePathMismatch
Description copied from interface:JctCompiler
Get whether we will attempt to fix modules appearing on the classpath, or non-modules appearing on the module path.This enables correct classpath and module path detection when the test pack is a module but the code being compiled in the test is not, and vice versa. We need this because many build systems decide whether to populate the
--module-path
or the--classpath
with JPMS-enabled dependencies based on whether the project under compilation is a JPMS module itself.This only applies if
JctCompiler.isInheritModulePath()
orJctCompiler.isInheritClassPath()
is enabled, and only applies to the current JVM classpath and module path.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_FIX_JVM_MODULE_PATH_MISMATCH
.- Specified by:
isFixJvmModulePathMismatch
in interfaceJctCompiler
- Returns:
true
if enabled, orfalse
if disabled.
-
fixJvmModulePathMismatch
Description copied from interface:JctCompiler
Get whether we will attempt to fix modules appearing on the classpath, or non-modules appearing on the module path.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_FIX_JVM_MODULE_PATH_MISMATCH
.- Specified by:
fixJvmModulePathMismatch
in interfaceJctCompiler
- Parameters:
fixJvmModulePathMismatch
- whether to enable the mismatch fixing or not.- Returns:
- this compiler object for further call chaining.
-
isInheritClassPath
Description copied from interface:JctCompiler
Get whether the class path is inherited from the active JVM or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_INHERIT_CLASS_PATH
.- Specified by:
isInheritClassPath
in interfaceJctCompiler
- Returns:
- whether the current class path is being inherited or not.
-
inheritClassPath
Description copied from interface:JctCompiler
Set whether the class path is inherited from the active JVM or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_INHERIT_CLASS_PATH
.- Specified by:
inheritClassPath
in interfaceJctCompiler
- Parameters:
inheritClassPath
-true
to include it, orfalse
to exclude it.- Returns:
- this compiler object for further call chaining.
-
isInheritModulePath
Description copied from interface:JctCompiler
Get whether the module path is inherited from the active JVM or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_INHERIT_MODULE_PATH
.- Specified by:
isInheritModulePath
in interfaceJctCompiler
- Returns:
- whether the module path is being inherited or not.
-
inheritModulePath
Description copied from interface:JctCompiler
Set whether the module path is inherited from the active JVM or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_INHERIT_MODULE_PATH
.- Specified by:
inheritModulePath
in interfaceJctCompiler
- Parameters:
inheritModulePath
-true
to include it, orfalse
to exclude it.- Returns:
- this compiler object for further call chaining.
-
isInheritSystemModulePath
Description copied from interface:JctCompiler
Get whether the system module path is inherited from the active JVM or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_INHERIT_SYSTEM_MODULE_PATH
.- Specified by:
isInheritSystemModulePath
in interfaceJctCompiler
- Returns:
- whether the system module path is being inherited or not.
-
inheritSystemModulePath
Description copied from interface:JctCompiler
Set whether the system module path is inherited from the active JVM or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_INHERIT_SYSTEM_MODULE_PATH
.- Specified by:
inheritSystemModulePath
in interfaceJctCompiler
- Parameters:
inheritSystemModulePath
-true
to include it, orfalse
to exclude it.- Returns:
- this compiler object for further call chaining.
-
getLocale
Description copied from interface:JctCompiler
Get the output locale.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_LOCALE
.- Specified by:
getLocale
in interfaceJctCompiler
- Returns:
- the output locale to use.
-
locale
Description copied from interface:JctCompiler
Set the output locale.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_LOCALE
.- Specified by:
locale
in interfaceJctCompiler
- Parameters:
locale
- the locale to use.- Returns:
- this compiler for further call chaining.
-
getLogCharset
Description copied from interface:JctCompiler
Get the charset being used to write compiler logs with.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_LOG_CHARSET
.- Specified by:
getLogCharset
in interfaceJctCompiler
- Returns:
- the charset.
-
logCharset
Description copied from interface:JctCompiler
Set the charset being used to write compiler logs with.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_LOG_CHARSET
.- Specified by:
logCharset
in interfaceJctCompiler
- Parameters:
logCharset
- the charset to use.- Returns:
- this compiler for further call chaining.
-
getFileManagerLoggingMode
Description copied from interface:JctCompiler
Get the current file manager logging mode.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_FILE_MANAGER_LOGGING_MODE
.- Specified by:
getFileManagerLoggingMode
in interfaceJctCompiler
- Returns:
- the current file manager logging mode.
-
fileManagerLoggingMode
Description copied from interface:JctCompiler
Set how to handle logging calls to underlying file managers.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_FILE_MANAGER_LOGGING_MODE
.- Specified by:
fileManagerLoggingMode
in interfaceJctCompiler
- Parameters:
fileManagerLoggingMode
- the mode to use for file manager logging.- Returns:
- this compiler for further call chaining.
-
getDiagnosticLoggingMode
Description copied from interface:JctCompiler
Get the current diagnostic logging mode.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_DIAGNOSTIC_LOGGING_MODE
.- Specified by:
getDiagnosticLoggingMode
in interfaceJctCompiler
- Returns:
- the current diagnostic logging mode.
-
diagnosticLoggingMode
Description copied from interface:JctCompiler
Set how to handle diagnostic capture.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_DIAGNOSTIC_LOGGING_MODE
.- Specified by:
diagnosticLoggingMode
in interfaceJctCompiler
- Parameters:
diagnosticLoggingMode
- the mode to use for diagnostic capture.- Returns:
- this compiler for further call chaining.
-
getAnnotationProcessorDiscovery
Description copied from interface:JctCompiler
Get how to perform annotation processor discovery.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_ANNOTATION_PROCESSOR_DISCOVERY
.Specifying any annotation processors explicitly with
JctCompiler.addAnnotationProcessors(Iterable)
orJctCompiler.addAnnotationProcessors(Processor...)
will bypass this setting, treating it as being disabled.- Specified by:
getAnnotationProcessorDiscovery
in interfaceJctCompiler
- Returns:
- the processor discovery mode to use.
-
annotationProcessorDiscovery
public AbstractJctCompiler annotationProcessorDiscovery(AnnotationProcessorDiscovery annotationProcessorDiscovery) Description copied from interface:JctCompiler
Set how to perform annotation processor discovery.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_ANNOTATION_PROCESSOR_DISCOVERY
.Specifying any annotation processors explicitly with
JctCompiler.addAnnotationProcessors(Iterable)
orJctCompiler.addAnnotationProcessors(Processor...)
will bypass this setting, treating it as being disabled.- Specified by:
annotationProcessorDiscovery
in interfaceJctCompiler
- Parameters:
annotationProcessorDiscovery
- the processor discovery mode to use.- Returns:
- this compiler for further call chaining.
-
getDebuggingInfo
Description copied from interface:JctCompiler
Get the debugging info that is enabled.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_DEBUGGING_INFO
.- Specified by:
getDebuggingInfo
in interfaceJctCompiler
- Returns:
- the set of debugging info flags that are enabled.
-
debuggingInfo
Description copied from interface:JctCompiler
Set the debugging info level to use.- Specified by:
debuggingInfo
in interfaceJctCompiler
- Parameters:
debuggingInfo
- the set of debugging info flags to enable.- Returns:
- this compiler for further call chaining.
-
isParameterInfoEnabled
Description copied from interface:JctCompiler
Determine if including reflective parameter info is enabled or not.Unless otherwise changed or specified, implementations should default to
JctCompiler.DEFAULT_PARAMETER_INFO_ENABLED
.- Specified by:
isParameterInfoEnabled
in interfaceJctCompiler
- Returns:
- the parameter info inclusion preference.
-
parameterInfoEnabled
Description copied from interface:JctCompiler
Set whether to include parameter reflective info by default in compiled classes or not.- Specified by:
parameterInfoEnabled
in interfaceJctCompiler
- Parameters:
parameterInfoEnabled
- whether to include the parameter reflective info or not.- Returns:
- this compiler for further call chaining.
-
toString
-
getFlagBuilderFactory
Get the flag builder factory to use for building flags.- Returns:
- the factory.
-
getCompilerFactory
Get the JSR-199 compiler factory to use for initialising an internal compiler.- Returns:
- the factory.
-
getFileManagerFactory
Get the file manager factory to use for building AbstractJctCompiler file manager during compilation.Since v1.1.0, this method has provided a default implementation. Before this, it was abstract. The default implementation calls
JctFileManagers.newJctFileManagerFactory(JctCompiler)
.- Returns:
- the factory.
-
getCompilationFactory
Get the compilation factory to use for building a compilation.By default, this uses a common internal implementation that is designed to work with compilers that have interfaces the same as, and behave the same as Javac.
Some obscure compiler implementations with potentially satanic rituals for initialising and configuring components correctly may need to provide a custom implementation here instead. In this case, this method should be overridden. Base classes are not provided for you to extend in this case as this is usually not something you want to be doing. Instead, you should implement
JctCompilationFactory
directly.- Returns:
- the compilation factory.
-
getDefaultRelease
Get the default release to use if no release or target version is specified.This can not be configured generally, as it is defined by the internal compiler implementation.
Generally, this value will be an integer within a string. The value is represented as a string to allow supporting compilers which may use non-integer version numbers.
- Specified by:
getDefaultRelease
in interfaceJctCompiler
- Returns:
- the default release version to use when no version is specified by the user.
-
buildFlags
Build the list of flags from this compiler object using the flag builder.Implementations should not need to override this unless there is a special edge case that needs configuring differently. This is exposed to assist in these kinds of cases.
- Parameters:
flagBuilder
- the flag builder to apply the flag configuration to.- Returns:
- the string flags to use.
-