Top Description Fields Constructors Methods
org.codehaus.groovy.control

public Class CompilerConfiguration

extends Object
Class Inheritance
Imports
org.apache.groovy.util.Maps, org.codehaus.groovy.control.customizers.CompilationCustomizer, org.codehaus.groovy.control.io.NullWriter, org.codehaus.groovy.control.messages.WarningMessage, org.objectweb.asm.Opcodes, java.io.File, .PrintWriter, java.util.Arrays, .Collections, .HashMap, .HashSet, .LinkedHashSet, .LinkedList, .List, .Map, .Optional, .Properties, .Set, .StringTokenizer

Compilation control flags and coordination stuff.

Field Summary

Modifier and TypeField and Description
public static final String[]
ALLOWED_JDKS

The valid targetBytecode values.

public static final int
ASM_API_VERSION

The ASM API version used when loading/parsing classes and generating proxy adapter classes.

private BytecodeProcessor
private List<String>
classpath

Classpath for use during compilation

private final List<CompilationCustomizer>
private boolean
debug

If true, debugging code should be activated

public static final CompilerConfiguration
DEFAULT

A convenience for getting a default configuration.

public static final String
private String
defaultScriptExtension

extension used to find a groovy file

private Set<String>
disabledGlobalASTTransformations

Global AST transformations which should not be loaded even if they are defined in META-INF/services/org.codehaus.groovy.transform.ASTTransformation files.

public static final String
GROOVYDOC

Optimization Option for enabling attaching groovydoc as AST node metadata.

public static final String
INVOKEDYNAMIC

Optimization Option for enabling invokedynamic compilation.

public static final String
JDK10

This ("10") is the value for targetBytecode to compile for a JDK 10.

public static final String
JDK11

This ("11") is the value for targetBytecode to compile for a JDK 11.

public static final String
JDK12

This ("12") is the value for targetBytecode to compile for a JDK 12.

public static final String
JDK13

This ("13") is the value for targetBytecode to compile for a JDK 13.

public static final String
JDK14

This ("14") is the value for targetBytecode to compile for a JDK 14.

public static final String
JDK15

This ("15") is the value for targetBytecode to compile for a JDK 15.

public static final String
JDK16

This ("16") is the value for targetBytecode to compile for a JDK 16.

public static final String
JDK17

This ("17") is the value for targetBytecode to compile for a JDK 17.

public static final String
JDK4

This ("1.4") is the value for targetBytecode to compile for a JDK 1.4.

public static final String
JDK5

This ("1.5") is the value for targetBytecode to compile for a JDK 1.5.

public static final String
JDK6

This ("1.6") is the value for targetBytecode to compile for a JDK 1.6.

public static final String
JDK7

This ("1.7") is the value for targetBytecode to compile for a JDK 1.7.

public static final String
JDK8

This ("1.8") is the value for targetBytecode to compile for a JDK 1.8.

public static final String
JDK9

This ("9") is the value for targetBytecode to compile for a JDK 9.

public static final Map<String, Integer>
JDK_TO_BYTECODE_VERSION_MAP

JDK version to bytecode version mapping.

private Map<String, Object>
jointCompilationOptions

options for joint compilation (null by default == no joint compilation)

public static final String
MEM_STUB

Joint Compilation Option for enabling generating stubs in memory.

private int
minimumRecompilationInterval

sets the minimum of time after a script can be recompiled.

private Map<String, Boolean>
optimizationOptions

options for optimizations (empty map by default)

private PrintWriter
output

The PrintWriter does nothing.

public static final String
PARALLEL_PARSE

Optimization Option for enabling parallel parsing.

private boolean
parameters

If true, generates metadata for reflection on method parameters

private ParserPluginFactory
public static final String
POST_JDK5

This constant is for comparing targetBytecode to ensure it is set to JDK 1.5 or later.

public static final String
PRE_JDK5

This constant is for comparing targetBytecode to ensure it is set to an earlier value than JDK 1.5.

private boolean
previewFeatures

Whether the bytecode version has preview features enabled (JEP 12)

private boolean
recompileGroovySource

if set to true recompilation is enabled

public static final String
RUNTIME_GROOVYDOC

Optimization Option for enabling attaching groovy.lang.Groovydoc annotation.

private String
scriptBaseClass

Base class name for scripts (must derive from Script)

private Set<String>
scriptExtensions

extensions used to find a groovy files

private String
sourceEncoding

Encoding for source files

private String
targetBytecode

sets the bytecode version target

private File
targetDirectory

Directory into which to write classes

private int
tolerance

The number of non-fatal errors to allow before bailing

private boolean
verbose

If true, the compiler should produce action information

private int

Constructor Summary

AccessConstructor and Description
public
CompilerConfiguration()

Sets the compiler flags/settings to default values.

public
CompilerConfiguration(final CompilerConfiguration
The configuration to copy.
configuration
)

Copy constructor.

public
CompilerConfiguration(final Properties
The properties to get flag values from.
configuration
)

Sets the configuration flags/settings according to values from the supplied Properties instance or if not found, supplying a default value.

Method Summary

Modifier and TypeMethod and Description
public CompilerConfiguration

Returns:

this configuration instance
addCompilationCustomizers
(final CompilationCustomizer...
the list of customizers to be added
customizers
)

Adds compilation customizers to the compilation process.

public void
configure(final Properties
The properties to get flag values from.
configuration
)

Method to configure a CompilerConfiguration by using Properties.

public BytecodeProcessor
public List<String>

Returns:

the classpath
getClasspath
()

public List<CompilationCustomizer>

Returns:

the customizers (always not null)
getCompilationCustomizers
()

Returns the list of compilation customizers.

public boolean
getDebug()

Returns true if debugging operation has been requested.

public String
public Set<String>

Returns:

a list of global AST transformation fully qualified class names
getDisabledGlobalASTTransformations
()

Returns the list of disabled global AST transformation class names.

public Map<String, Object>

Returns:

the options
getJointCompilationOptions
()

Gets the joint compilation options for this configuration.

public int
public Map<String, Boolean>

Returns:

the options (always not null)
getOptimizationOptions
()

Gets the optimization options for this configuration.

public PrintWriter
getOutput()

Deprecated not used anymore
Gets the currently configured output writer.
public boolean
getParameters()

Returns true if parameter metadata generation has been enabled.

public ParserPluginFactory
public boolean
public String
getScriptBaseClass()

Gets the name of the base class for scripts.

public Set<String>
public String
getSourceEncoding()

Gets the currently configured source file encoding.

public String

Returns:

bytecode compatibility level
getTargetBytecode
()

Returns the compiler bytecode compatibility level.

public File
getTargetDirectory()

Gets the target directory for writing classes.

public int
getTolerance()

Returns the requested error tolerance.

public boolean
getVerbose()

Returns true if verbose operation has been requested.

public int
getWarningLevel()

Gets the currently configured warning level.

public boolean
isGroovydocEnabled()

Checks if groovydoc is enabled.

public boolean
isIndyEnabled()

Checks if invoke dynamic is enabled.

public static boolean

Returns:

true if the bytecode version is JDK 1.5+
isPostJDK5
(final String
The parameter can take one of the values in ALLOWED_JDKS.
bytecodeVersion
)

Checks if the specified bytecode version string represents a JDK 1.5+ compatible bytecode version.

public static boolean

Returns:

true if the bytecode version is JDK 1.7+
isPostJDK7
(final String
The parameter can take one of the values in ALLOWED_JDKS.
bytecodeVersion
)

Checks if the specified bytecode version string represents a JDK 1.7+ compatible bytecode version.

public static boolean

Returns:

true if the bytecode version is JDK 1.8+
isPostJDK8
(final String
The parameter can take one of the values in ALLOWED_JDKS.
bytecodeVersion
)

Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.

public static boolean

Returns:

true if the bytecode version is JDK 9.0+
isPostJDK9
(final String
The parameter can take one of the values in ALLOWED_JDKS.
bytecodeVersion
)

Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.

public boolean

Returns:

preview features
isPreviewFeatures
()

Whether the bytecode version has preview features enabled (JEP 12)

public boolean
isRuntimeGroovydocEnabled()

Checks if runtime groovydoc is enabled.

public void
setBytecodePostprocessor(final BytecodeProcessor bytecodePostprocessor)

public void
setClasspath(final String classpath)

Sets the classpath.

public void
setClasspathList(final List<String>
list of strings containing the classpath parts
parts
)

sets the classpath using a list of Strings

public void
setDebug(final boolean debug)

Turns debugging operation on or off.

public void
setDefaultScriptExtension(final String defaultScriptExtension)

public void
setDisabledGlobalASTTransformations(final Set<String>
a set of fully qualified class names of global AST transformations which should not be loaded.
disabledGlobalASTTransformations
)

Disables the specified global AST transformations.

public void
setJointCompilationOptions(final Map<String, Object>
the options
options
)

Sets the joint compilation options for this configuration.

public void
public void
setOptimizationOptions(final Map<String, Boolean>
the options.
options
)

Sets the optimization options for this configuration.

public void
setOutput(final PrintWriter output)

Deprecated not used anymore, has no effect
Sets the output writer.
public void
setParameters(final boolean parameters)

Turns parameter metadata generation on or off.

public void
public void
setPreviewFeatures(final boolean
whether to support preview features
previewFeatures
)

Sets whether the bytecode version has preview features enabled (JEP 12).

public void
setRecompileGroovySource(final boolean recompile)

public void
setScriptBaseClass(final String scriptBaseClass)

Sets the name of the base class for scripts.

public void
setScriptExtensions(final Set<String> scriptExtensions)

public void
setSourceEncoding(final String encoding)

Sets the encoding to be used when reading source files.

public void
setTargetBytecode(final String
the bytecode compatibility level
version
)

Sets the bytecode compatibility level.

private void
public void
setTargetDirectory(final File directory)

Sets the target directory.

public void
setTargetDirectory(final String directory)

Sets the target directory.

private void
setTargetDirectorySafe(final String directory)

public void
setTolerance(final int tolerance)

Sets the error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted.

public void
setVerbose(final boolean verbose)

Turns verbose operation on or off.

public void
setWarningLevel(final int level)

Sets the warning level.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOWED_JDKSback to summary
public static final String[] ALLOWED_JDKS

The valid targetBytecode values.

ASM_API_VERSIONback to summary
public static final int ASM_API_VERSION

The ASM API version used when loading/parsing classes and generating proxy adapter classes.

bytecodePostprocessorback to summary
private BytecodeProcessor bytecodePostprocessor
classpathback to summary
private List<String> classpath

Classpath for use during compilation

compilationCustomizersback to summary
private final List<CompilationCustomizer> compilationCustomizers
debugback to summary
private boolean debug

If true, debugging code should be activated

DEFAULTback to summary
public static final CompilerConfiguration DEFAULT

A convenience for getting a default configuration. Do not modify it! See CompilerConfiguration(Properties) for an example on how to make a suitable copy to modify. But if you're really starting from a default context, then you probably just want new CompilerConfiguration().

DEFAULT_SOURCE_ENCODINGback to summary
public static final String DEFAULT_SOURCE_ENCODING
defaultScriptExtensionback to summary
private String defaultScriptExtension

extension used to find a groovy file

disabledGlobalASTTransformationsback to summary
private Set<String> disabledGlobalASTTransformations

Global AST transformations which should not be loaded even if they are defined in META-INF/services/org.codehaus.groovy.transform.ASTTransformation files. By default, none are disabled.

GROOVYDOCback to summary
public static final String GROOVYDOC

Optimization Option for enabling attaching groovydoc as AST node metadata.

INVOKEDYNAMICback to summary
public static final String INVOKEDYNAMIC

Optimization Option for enabling invokedynamic compilation.

JDK10back to summary
public static final String JDK10

This ("10") is the value for targetBytecode to compile for a JDK 10.

JDK11back to summary
public static final String JDK11

This ("11") is the value for targetBytecode to compile for a JDK 11.

JDK12back to summary
public static final String JDK12

This ("12") is the value for targetBytecode to compile for a JDK 12.

JDK13back to summary
public static final String JDK13

This ("13") is the value for targetBytecode to compile for a JDK 13.

JDK14back to summary
public static final String JDK14

This ("14") is the value for targetBytecode to compile for a JDK 14.

JDK15back to summary
public static final String JDK15

This ("15") is the value for targetBytecode to compile for a JDK 15.

JDK16back to summary
public static final String JDK16

This ("16") is the value for targetBytecode to compile for a JDK 16.

JDK17back to summary
public static final String JDK17

This ("17") is the value for targetBytecode to compile for a JDK 17.

JDK4back to summary
public static final String JDK4

This ("1.4") is the value for targetBytecode to compile for a JDK 1.4.

JDK5back to summary
public static final String JDK5

This ("1.5") is the value for targetBytecode to compile for a JDK 1.5.

JDK6back to summary
public static final String JDK6

This ("1.6") is the value for targetBytecode to compile for a JDK 1.6.

JDK7back to summary
public static final String JDK7

This ("1.7") is the value for targetBytecode to compile for a JDK 1.7.

JDK8back to summary
public static final String JDK8

This ("1.8") is the value for targetBytecode to compile for a JDK 1.8.

JDK9back to summary
public static final String JDK9

This ("9") is the value for targetBytecode to compile for a JDK 9.

JDK_TO_BYTECODE_VERSION_MAPback to summary
public static final Map<String, Integer> JDK_TO_BYTECODE_VERSION_MAP

JDK version to bytecode version mapping.

jointCompilationOptionsback to summary
private Map<String, Object> jointCompilationOptions

options for joint compilation (null by default == no joint compilation)

MEM_STUBback to summary
public static final String MEM_STUB

Joint Compilation Option for enabling generating stubs in memory.

minimumRecompilationIntervalback to summary
private int minimumRecompilationInterval

sets the minimum of time after a script can be recompiled.

optimizationOptionsback to summary
private Map<String, Boolean> optimizationOptions

options for optimizations (empty map by default)

outputback to summary
private PrintWriter output

The PrintWriter does nothing.

PARALLEL_PARSEback to summary
public static final String PARALLEL_PARSE

Optimization Option for enabling parallel parsing.

parametersback to summary
private boolean parameters

If true, generates metadata for reflection on method parameters

pluginFactoryback to summary
private ParserPluginFactory pluginFactory
POST_JDK5back to summary
public static final String POST_JDK5

Deprecated

This constant is for comparing targetBytecode to ensure it is set to JDK 1.5 or later.

Annotations
@Deprecated
PRE_JDK5back to summary
public static final String PRE_JDK5

Deprecated

This constant is for comparing targetBytecode to ensure it is set to an earlier value than JDK 1.5.

Annotations
@Deprecated
previewFeaturesback to summary
private boolean previewFeatures

Whether the bytecode version has preview features enabled (JEP 12)

recompileGroovySourceback to summary
private boolean recompileGroovySource

if set to true recompilation is enabled

RUNTIME_GROOVYDOCback to summary
public static final String RUNTIME_GROOVYDOC

Optimization Option for enabling attaching groovy.lang.Groovydoc annotation.

scriptBaseClassback to summary
private String scriptBaseClass

Base class name for scripts (must derive from Script)

scriptExtensionsback to summary
private Set<String> scriptExtensions

extensions used to find a groovy files

sourceEncodingback to summary
private String sourceEncoding

Encoding for source files

targetBytecodeback to summary
private String targetBytecode

sets the bytecode version target

targetDirectoryback to summary
private File targetDirectory

Directory into which to write classes

toleranceback to summary
private int tolerance

The number of non-fatal errors to allow before bailing

verboseback to summary
private boolean verbose

If true, the compiler should produce action information

warningLevelback to summary
private int warningLevel

See WarningMessage for levels.

Constructor Detail

CompilerConfigurationback to summary
public CompilerConfiguration()

Sets the compiler flags/settings to default values. The following system properties are referenced when setting the configuration:

Property KeyRelated Property Getter
groovy.antlr4getPluginFactory
groovy.source.encoding (defaulting to file.encoding)getSourceEncoding
groovy.target.bytecodegetTargetBytecode
groovy.target.directorygetTargetDirectory
groovy.parametersgetParameters()
groovy.preview.featuresisPreviewFeatures
groovy.default.scriptExtensiongetDefaultScriptExtension
The following system properties are referenced when setting the configuration optimization options:
Property KeyRelated Property Getter
groovy.target.indygetOptimizationOptions
groovy.attach.groovydocgetOptimizationOptions
groovy.attach.runtime.groovydocgetOptimizationOptions
CompilerConfigurationback to summary
public CompilerConfiguration(final CompilerConfiguration configuration)

Copy constructor. Use this if you have a mostly correct configuration for your compilation but you want to make a some changes programmatically. An important reason to prefer this approach is that your code will most likely be forward compatible with future changes to this configuration API.

An example of this copy constructor at work:

// In all likelihood there is already a configuration in your code's context
// for you to copy, but for the sake of this example we'll use the global default.
CompilerConfiguration myConfiguration = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
myConfiguration.setDebug(true);
Parameters
configuration:CompilerConfiguration

The configuration to copy.

CompilerConfigurationback to summary
public CompilerConfiguration(final Properties configuration) throws ConfigurationException

Sets the configuration flags/settings according to values from the supplied Properties instance or if not found, supplying a default value. Note that unlike CompilerConfiguration(), the "defaults" here do not in general include checking the settings in System#getProperties(). If you want to set a few flags but keep Groovy's default configuration behavior then be sure to make your settings in a Properties object that is backed by System.getProperties() (which is done using this constructor). That might be done like this:

Properties myProperties = new Properties(System.getProperties());
myProperties.setProperty("groovy.output.debug", "true");
myConfiguration = new CompilerConfiguration(myProperties);
And you also have to contend with a possible SecurityException when getting the system properties (See System#getProperties()). A safer approach would be to copy a default CompilerConfiguration and make your changes there using the setter:
// In all likelihood there is already a configuration for you to copy,
// but for the sake of this example we'll use the global default.
CompilerConfiguration myConfiguration = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
myConfiguration.setDebug(true);
The following properties are referenced when setting the configuration:
Property KeyRelated Property Getter
groovy.warningsgetWarningLevel
groovy.source.encoding (defaulting to file.encoding)getSourceEncoding
groovy.target.directorygetTargetDirectory
groovy.target.bytecodegetTargetBytecode
groovy.parametersgetParameters()
groovy.preview.featuresisPreviewFeatures
groovy.classpathgetClasspath
groovy.output.verbosegetVerbose
groovy.output.debuggetDebug
groovy.errors.tolerancegetTolerance
groovy.default.scriptExtensiongetDefaultScriptExtension
groovy.script.basegetScriptBaseClass
groovy.recompilegetRecompileGroovySource
groovy.recompile.minimumIntervalgetMinimumRecompilationInterval
groovy.disabled.global.ast.transformationsgetDisabledGlobalASTTransformations
Parameters
configuration:Properties

The properties to get flag values from.

Method Detail

addCompilationCustomizersback to summary
public CompilerConfiguration addCompilationCustomizers(final CompilationCustomizer... customizers)

Adds compilation customizers to the compilation process. A compilation customizer is a class node operation which performs various operations going from adding imports to access control.

Parameters
customizers:CompilationCustomizer[]

the list of customizers to be added

Returns:CompilerConfiguration

this configuration instance

configureback to summary
public void configure(final Properties configuration) throws ConfigurationException

Method to configure a CompilerConfiguration by using Properties. For a list of available properties look at CompilerConfiguration(Properties).

Parameters
configuration:Properties

The properties to get flag values from.

getBytecodePostprocessorback to summary
public BytecodeProcessor getBytecodePostprocessor()
getClasspathback to summary
public List<String> getClasspath()
Returns:List<String>

the classpath

getCompilationCustomizersback to summary
public List<CompilationCustomizer> getCompilationCustomizers()

Returns the list of compilation customizers.

Returns:List<CompilationCustomizer>

the customizers (always not null)

getDebugback to summary
public boolean getDebug()

Returns true if debugging operation has been requested.

getDefaultScriptExtensionback to summary
public String getDefaultScriptExtension()
getDisabledGlobalASTTransformationsback to summary
public Set<String> getDisabledGlobalASTTransformations()

Returns the list of disabled global AST transformation class names.

Returns:Set<String>

a list of global AST transformation fully qualified class names

getJointCompilationOptionsback to summary
public Map<String, Object> getJointCompilationOptions()

Gets the joint compilation options for this configuration.

Returns:Map<String, Object>

the options

getMinimumRecompilationIntervalback to summary
public int getMinimumRecompilationInterval()
getOptimizationOptionsback to summary
public Map<String, Boolean> getOptimizationOptions()

Gets the optimization options for this configuration.

Returns:Map<String, Boolean>

the options (always not null)

getOutputback to summary
public PrintWriter getOutput()

Deprecated

not used anymore

Gets the currently configured output writer.

Annotations
@Deprecated
getParametersback to summary
public boolean getParameters()

Returns true if parameter metadata generation has been enabled.

getPluginFactoryback to summary
public ParserPluginFactory getPluginFactory()
getRecompileGroovySourceback to summary
public boolean getRecompileGroovySource()
getScriptBaseClassback to summary
public String getScriptBaseClass()

Gets the name of the base class for scripts. It must be a subclass of Script.

getScriptExtensionsback to summary
public Set<String> getScriptExtensions()
getSourceEncodingback to summary
public String getSourceEncoding()

Gets the currently configured source file encoding.

getTargetBytecodeback to summary
public String getTargetBytecode()

Returns the compiler bytecode compatibility level. Defaults to the minimum officially supported bytecode version for any particular Groovy version.

Returns:String

bytecode compatibility level

getTargetDirectoryback to summary
public File getTargetDirectory()

Gets the target directory for writing classes.

getToleranceback to summary
public int getTolerance()

Returns the requested error tolerance.

getVerboseback to summary
public boolean getVerbose()

Returns true if verbose operation has been requested.

getWarningLevelback to summary
public int getWarningLevel()

Gets the currently configured warning level. See WarningMessage for level details.

isGroovydocEnabledback to summary
public boolean isGroovydocEnabled()

Checks if groovydoc is enabled.

isIndyEnabledback to summary
public boolean isIndyEnabled()

Checks if invoke dynamic is enabled.

isPostJDK5back to summary
public static boolean isPostJDK5(final String bytecodeVersion)

Checks if the specified bytecode version string represents a JDK 1.5+ compatible bytecode version.

Parameters
bytecodeVersion:String

The parameter can take one of the values in ALLOWED_JDKS.

Returns:boolean

true if the bytecode version is JDK 1.5+

isPostJDK7back to summary
public static boolean isPostJDK7(final String bytecodeVersion)

Checks if the specified bytecode version string represents a JDK 1.7+ compatible bytecode version.

Parameters
bytecodeVersion:String

The parameter can take one of the values in ALLOWED_JDKS.

Returns:boolean

true if the bytecode version is JDK 1.7+

isPostJDK8back to summary
public static boolean isPostJDK8(final String bytecodeVersion)

Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.

Parameters
bytecodeVersion:String

The parameter can take one of the values in ALLOWED_JDKS.

Returns:boolean

true if the bytecode version is JDK 1.8+

isPostJDK9back to summary
public static boolean isPostJDK9(final String bytecodeVersion)

Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.

Parameters
bytecodeVersion:String

The parameter can take one of the values in ALLOWED_JDKS.

Returns:boolean

true if the bytecode version is JDK 9.0+

isPreviewFeaturesback to summary
public boolean isPreviewFeatures()

Whether the bytecode version has preview features enabled (JEP 12)

Returns:boolean

preview features

isRuntimeGroovydocEnabledback to summary
public boolean isRuntimeGroovydocEnabled()

Checks if runtime groovydoc is enabled.

setBytecodePostprocessorback to summary
public void setBytecodePostprocessor(final BytecodeProcessor bytecodePostprocessor)
setClasspathback to summary
public void setClasspath(final String classpath)

Sets the classpath.

setClasspathListback to summary
public void setClasspathList(final List<String> parts)

sets the classpath using a list of Strings

Parameters
parts:List<String>

list of strings containing the classpath parts

setDebugback to summary
public void setDebug(final boolean debug)

Turns debugging operation on or off.

setDefaultScriptExtensionback to summary
public void setDefaultScriptExtension(final String defaultScriptExtension)
setDisabledGlobalASTTransformationsback to summary
public void setDisabledGlobalASTTransformations(final Set<String> disabledGlobalASTTransformations)

Disables the specified global AST transformations. In order to avoid class loading side effects, it is not recommended to use MyASTTransformation.class.getName() but instead directly use the class name as a string. Disabled AST transformations only apply to automatically loaded global AST transformations, that is to say transformations defined in a META-INF/services/org.codehaus.groovy.transform.ASTTransformation file. If you explicitly add a global AST transformation in your compilation process, for example using the org.codehaus.groovy.control.customizers.ASTTransformationCustomizer or using a org.codehaus.groovy.control.CompilationUnit.IPrimaryClassNodeOperation, then nothing will prevent the transformation from being loaded.

Parameters
disabledGlobalASTTransformations:Set<String>

a set of fully qualified class names of global AST transformations which should not be loaded.

setJointCompilationOptionsback to summary
public void setJointCompilationOptions(final Map<String, Object> options)

Sets the joint compilation options for this configuration. Using null will disable joint compilation.

Parameters
options:Map<String, Object>

the options

setMinimumRecompilationIntervalback to summary
public void setMinimumRecompilationInterval(final int time)
setOptimizationOptionsback to summary
public void setOptimizationOptions(final Map<String, Boolean> options)

Sets the optimization options for this configuration. No entry or a true for that entry means to enable that optimization, a false means the optimization is disabled. Valid keys are "all" and "int".

Parameters
options:Map<String, Boolean>

the options.

Exceptions
IllegalArgumentException:
if the options are null
setOutputback to summary
public void setOutput(final PrintWriter output)

Deprecated

not used anymore, has no effect

Sets the output writer.

Annotations
@Deprecated
setParametersback to summary
public void setParameters(final boolean parameters)

Turns parameter metadata generation on or off.

setPluginFactoryback to summary
public void setPluginFactory(final ParserPluginFactory pluginFactory)
setPreviewFeaturesback to summary
public void setPreviewFeatures(final boolean previewFeatures)

Sets whether the bytecode version has preview features enabled (JEP 12).

Parameters
previewFeatures:boolean

whether to support preview features

setRecompileGroovySourceback to summary
public void setRecompileGroovySource(final boolean recompile)
setScriptBaseClassback to summary
public void setScriptBaseClass(final String scriptBaseClass)

Sets the name of the base class for scripts. It must be a subclass of Script.

setScriptExtensionsback to summary
public void setScriptExtensions(final Set<String> scriptExtensions)
setSourceEncodingback to summary
public void setSourceEncoding(final String encoding)

Sets the encoding to be used when reading source files.

setTargetBytecodeback to summary
public void setTargetBytecode(final String version)

Sets the bytecode compatibility level. The parameter can take one of the values in ALLOWED_JDKS.

Parameters
version:String

the bytecode compatibility level

setTargetBytecodeIfValidback to summary
private void setTargetBytecodeIfValid(final String version)
setTargetDirectoryback to summary
public void setTargetDirectory(final File directory)

Sets the target directory.

setTargetDirectoryback to summary
public void setTargetDirectory(final String directory)

Sets the target directory.

setTargetDirectorySafeback to summary
private void setTargetDirectorySafe(final String directory)
setToleranceback to summary
public void setTolerance(final int tolerance)

Sets the error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted.

setVerboseback to summary
public void setVerbose(final boolean verbose)

Turns verbose operation on or off.

setWarningLevelback to summary
public void setWarningLevel(final int level)

Sets the warning level. See WarningMessage for level details.