Package org.codehaus.groovy.control

# Class CompilerConfiguration

java.lang.Object
org.codehaus.groovy.control.CompilerConfiguration

public class CompilerConfiguration extends Object
Compilation control flags and coordination stuff.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String[]`
  `ALLOWED_JDKS`
  The valid targetBytecode values.
  `static final int`
  `ASM_API_VERSION`
  The ASM API version used when loading/parsing classes and generating proxy adapter classes.
  `static final CompilerConfiguration`
  `DEFAULT`
  A convenience for getting a default configuration.
  `static final String`
  `DEFAULT_SOURCE_ENCODING`
  The default source encoding.
  `static final String`
  `DEFAULT_TARGET_BYTECODE`
  `static final String`
  `GROOVYDOC`
  Optimization Option for enabling attaching groovydoc as AST node metadata.
  `static final String`
  `INVOKEDYNAMIC`
  Optimization Option for enabling `invokedynamic` compilation.
  `static final Map<String,Integer>`
  `JDK_TO_BYTECODE_VERSION_MAP`
  JDK version to bytecode version mapping.
  `static final String`
  `JDK10`
  This (`"10"`) is the value for targetBytecode to compile for a JDK 10.
  `static final String`
  `JDK11`
  This (`"11"`) is the value for targetBytecode to compile for a JDK 11.
  `static final String`
  `JDK12`
  This (`"12"`) is the value for targetBytecode to compile for a JDK 12.
  `static final String`
  `JDK13`
  This (`"13"`) is the value for targetBytecode to compile for a JDK 13.
  `static final String`
  `JDK14`
  This (`"14"`) is the value for targetBytecode to compile for a JDK 14.
  `static final String`
  `JDK15`
  This (`"15"`) is the value for targetBytecode to compile for a JDK 15.
  `static final String`
  `JDK16`
  This (`"16"`) is the value for targetBytecode to compile for a JDK 16.
  `static final String`
  `JDK17`
  This (`"17"`) is the value for targetBytecode to compile for a JDK 17.
  `static final String`
  `JDK18`
  This (`"18"`) is the value for targetBytecode to compile for a JDK 18.
  `static final String`
  `JDK19`
  This (`"19"`) is the value for targetBytecode to compile for a JDK 19.
  `static final String`
  `JDK20`
  This (`"20"`) is the value for targetBytecode to compile for a JDK 20.
  `static final String`
  `JDK4`
  This (`"1.4"`) is the value for targetBytecode to compile for a JDK 1.4.
  `static final String`
  `JDK5`
  This (`"1.5"`) is the value for targetBytecode to compile for a JDK 1.5.
  `static final String`
  `JDK6`
  This (`"1.6"`) is the value for targetBytecode to compile for a JDK 1.6.
  `static final String`
  `JDK7`
  This (`"1.7"`) is the value for targetBytecode to compile for a JDK 1.7.
  `static final String`
  `JDK8`
  This (`"1.8"`) is the value for targetBytecode to compile for a JDK 1.8.
  `static final String`
  `JDK9`
  This (`"9"`) is the value for targetBytecode to compile for a JDK 9.
  `static final String`
  `MEM_STUB`
  Joint Compilation Option for enabling generating stubs in memory.
  `static final String`
  `PARALLEL_PARSE`
  Optimization Option for enabling parallel parsing.
  `static final String`
  `POST_JDK5`
  Deprecated.
  `static final String`
  `PRE_JDK5`
  Deprecated.
  `static final String`
  `RUNTIME_GROOVYDOC`
  Optimization Option for enabling attaching `Groovydoc` annotation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CompilerConfiguration()`
  Sets the compiler flags/settings to default values.
  `CompilerConfiguration(Properties configuration)`
  Sets the configuration flags/settings according to values from the supplied `Properties` instance or if not found, supplying a default value.
  `CompilerConfiguration(CompilerConfiguration configuration)`
  Copy constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CompilerConfiguration`
  `addCompilationCustomizers(CompilationCustomizer... customizers)`
  Adds compilation customizers to the compilation process.
  `void`
  `configure(Properties configuration)`
  Method to configure a CompilerConfiguration by using Properties.
  `BytecodeProcessor`
  `getBytecodePostprocessor()`
  `int`
  `getBytecodeVersion()`
  Returns the ASM bytecode version.
  `List<String>`
  `getClasspath()`
  `List<CompilationCustomizer>`
  `getCompilationCustomizers()`
  Returns the list of compilation customizers.
  `boolean`
  `getDebug()`
  Returns true if debugging operation has been requested.
  `String`
  `getDefaultScriptExtension()`
  `Set<String>`
  `getDisabledGlobalASTTransformations()`
  Returns the list of disabled global AST transformation class names.
  `Map<String,Object>`
  `getJointCompilationOptions()`
  Gets the joint compilation options for this configuration.
  `int`
  `getLogClassgenStackTraceMaxDepth()`
  Returns stack trace max depth of logging class generation.
  `int`
  `getMinimumRecompilationInterval()`
  `Map<String,Boolean>`
  `getOptimizationOptions()`
  Gets the optimization options for this configuration.
  `PrintWriter`
  `getOutput()`
  Deprecated.
  not used anymore
  `boolean`
  `getParameters()`
  Returns true if parameter metadata generation has been enabled.
  `ParserPluginFactory`
  `getPluginFactory()`
  `boolean`
  `getRecompileGroovySource()`
  `String`
  `getScriptBaseClass()`
  Gets the name of the base class for scripts.
  `Set<String>`
  `getScriptExtensions()`
  `String`
  `getSourceEncoding()`
  Gets the currently configured source file encoding.
  `String`
  `getTargetBytecode()`
  Retrieves the compiler bytecode compatibility level.
  `File`
  `getTargetDirectory()`
  Gets the target directory for writing classes.
  `int`
  `getTolerance()`
  Returns the requested error tolerance.
  `boolean`
  `getVerbose()`
  Returns true if verbose operation has been requested.
  `int`
  `getWarningLevel()`
  Gets the currently configured warning level.
  `boolean`
  `isGroovydocEnabled()`
  Checks if groovydoc is enabled.
  `boolean`
  `isIndyEnabled()`
  Checks if invoke dynamic is enabled.
  `boolean`
  `isLogClassgen()`
  Returns whether logging class generation is enabled.
  `static boolean`
  `isPostJDK10(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 10+ compatible bytecode version.
  `static boolean`
  `isPostJDK11(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 11+ compatible bytecode version.
  `static boolean`
  `isPostJDK12(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 12+ compatible bytecode version.
  `static boolean`
  `isPostJDK13(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 13+ compatible bytecode version.
  `static boolean`
  `isPostJDK14(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 14+ compatible bytecode version.
  `static boolean`
  `isPostJDK15(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 15+ compatible bytecode version.
  `static boolean`
  `isPostJDK16(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 16+ compatible bytecode version.
  `static boolean`
  `isPostJDK17(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 17+ compatible bytecode version.
  `static boolean`
  `isPostJDK18(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 18+ compatible bytecode version.
  `static boolean`
  `isPostJDK5(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 1.5+ compatible bytecode version.
  `static boolean`
  `isPostJDK7(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 1.7+ compatible bytecode version.
  `static boolean`
  `isPostJDK8(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.
  `static boolean`
  `isPostJDK9(String bytecodeVersion)`
  Checks if the specified bytecode version string represents a JDK 9+ compatible bytecode version.
  `boolean`
  `isPreviewFeatures()`
  Whether the bytecode version has preview features enabled (JEP 12)
  `boolean`
  `isRuntimeGroovydocEnabled()`
  Checks if runtime groovydoc is enabled.
  `void`
  `setBytecodePostprocessor(BytecodeProcessor bytecodePostprocessor)`
  `void`
  `setClasspath(String classpath)`
  Sets the classpath.
  `void`
  `setClasspathList(List<String> parts)`
  sets the classpath using a list of Strings
  `void`
  `setDebug(boolean debug)`
  Turns debugging operation on or off.
  `void`
  `setDefaultScriptExtension(String defaultScriptExtension)`
  `void`
  `setDisabledGlobalASTTransformations(Set<String> disabledGlobalASTTransformations)`
  Disables the specified global AST transformations.
  `void`
  `setJointCompilationOptions(Map<String,Object> options)`
  Sets the joint compilation options for this configuration.
  `void`
  `setLogClassgen(boolean logClassgen)`
  Sets whether logging class generation is enabled.
  `void`
  `setLogClassgenStackTraceMaxDepth(int logClassgenStackTraceMaxDepth)`
  Sets stack trace max depth of logging class generation.
  `void`
  `setMinimumRecompilationInterval(int time)`
  `void`
  `setOptimizationOptions(Map<String,Boolean> options)`
  Sets the optimization options for this configuration.
  `void`
  `setOutput(PrintWriter output)`
  Deprecated.
  not used anymore, has no effect
  `void`
  `setParameters(boolean parameters)`
  Turns parameter metadata generation on or off.
  `void`
  `setPluginFactory(ParserPluginFactory pluginFactory)`
  `void`
  `setPreviewFeatures(boolean previewFeatures)`
  Sets whether the bytecode version has preview features enabled (JEP 12).
  `void`
  `setRecompileGroovySource(boolean recompile)`
  `void`
  `setScriptBaseClass(String scriptBaseClass)`
  Sets the name of the base class for scripts.
  `void`
  `setScriptExtensions(Set<String> scriptExtensions)`
  `void`
  `setSourceEncoding(String encoding)`
  Sets the encoding to be used when reading source files.
  `void`
  `setTargetBytecode(String version)`
  Sets the bytecode compatibility level.
  `void`
  `setTargetDirectory(File directory)`
  Sets the target directory.
  `void`
  `setTargetDirectory(String directory)`
  Sets the target directory.
  `void`
  `setTolerance(int tolerance)`
  Sets the error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted.
  `void`
  `setVerbose(boolean verbose)`
  Turns verbose operation on or off.
  `void`
  `setWarningLevel(int level)`
  Sets the warning level.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INVOKEDYNAMIC

    public static final String INVOKEDYNAMIC
    Optimization Option for enabling `invokedynamic` compilation.
    See Also:
      - Constant Field Values

  - ### GROOVYDOC

    public static final String GROOVYDOC
    Optimization Option for enabling attaching groovydoc as AST node metadata.
    See Also:
      - Constant Field Values

  - ### RUNTIME_GROOVYDOC

    public static final String RUNTIME_GROOVYDOC
    Optimization Option for enabling attaching `Groovydoc` annotation.
    See Also:
      - Constant Field Values

  - ### PARALLEL_PARSE

    public static final String PARALLEL_PARSE
    Optimization Option for enabling parallel parsing.
    See Also:
      - Constant Field Values

  - ### MEM_STUB

    public static final String MEM_STUB
    Joint Compilation Option for enabling generating stubs in memory.
    See Also:
      - Constant Field Values

  - ### JDK4

    public static final String JDK4
    This (`"1.4"`) is the value for targetBytecode to compile for a JDK 1.4.
    See Also:
      - Constant Field Values

  - ### JDK5

    public static final String JDK5
    This (`"1.5"`) is the value for targetBytecode to compile for a JDK 1.5.
    See Also:
      - Constant Field Values

  - ### JDK6

    public static final String JDK6
    This (`"1.6"`) is the value for targetBytecode to compile for a JDK 1.6.
    See Also:
      - Constant Field Values

  - ### JDK7

    public static final String JDK7
    This (`"1.7"`) is the value for targetBytecode to compile for a JDK 1.7.
    See Also:
      - Constant Field Values

  - ### JDK8

    public static final String JDK8
    This (`"1.8"`) is the value for targetBytecode to compile for a JDK 1.8.
    See Also:
      - Constant Field Values

  - ### JDK9

    public static final String JDK9
    This (`"9"`) is the value for targetBytecode to compile for a JDK 9.
    See Also:
      - Constant Field Values

  - ### JDK10

    public static final String JDK10
    This (`"10"`) is the value for targetBytecode to compile for a JDK 10.
    See Also:
      - Constant Field Values

  - ### JDK11

    public static final String JDK11
    This (`"11"`) is the value for targetBytecode to compile for a JDK 11.
    See Also:
      - Constant Field Values

  - ### JDK12

    public static final String JDK12
    This (`"12"`) is the value for targetBytecode to compile for a JDK 12.
    See Also:
      - Constant Field Values

  - ### JDK13

    public static final String JDK13
    This (`"13"`) is the value for targetBytecode to compile for a JDK 13.
    See Also:
      - Constant Field Values

  - ### JDK14

    public static final String JDK14
    This (`"14"`) is the value for targetBytecode to compile for a JDK 14.
    See Also:
      - Constant Field Values

  - ### JDK15

    public static final String JDK15
    This (`"15"`) is the value for targetBytecode to compile for a JDK 15.
    See Also:
      - Constant Field Values

  - ### JDK16

    public static final String JDK16
    This (`"16"`) is the value for targetBytecode to compile for a JDK 16.
    See Also:
      - Constant Field Values

  - ### JDK17

    public static final String JDK17
    This (`"17"`) is the value for targetBytecode to compile for a JDK 17.
    See Also:
      - Constant Field Values

  - ### JDK18

    public static final String JDK18
    This (`"18"`) is the value for targetBytecode to compile for a JDK 18.
    See Also:
      - Constant Field Values

  - ### JDK19

    public static final String JDK19
    This (`"19"`) is the value for targetBytecode to compile for a JDK 19.
    See Also:
      - Constant Field Values

  - ### JDK20

    public static final String JDK20
    This (`"20"`) is the value for targetBytecode to compile for a JDK 20.
    See Also:
      - Constant Field Values

  - ### POST_JDK5

    @Deprecated public static final String POST_JDK5
    Deprecated.
    This constant is for comparing targetBytecode to ensure it is set to JDK 1.5 or later.
    See Also:
      - Constant Field Values

  - ### PRE_JDK5

    @Deprecated 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.
    See Also:
      - Constant Field Values

  - ### JDK_TO_BYTECODE_VERSION_MAP

    public static final Map<String,Integer> JDK_TO_BYTECODE_VERSION_MAP
    JDK version to bytecode version mapping.

  - ### DEFAULT_TARGET_BYTECODE

    public static final String DEFAULT_TARGET_BYTECODE

  - ### ALLOWED_JDKS

    public static final String[] ALLOWED_JDKS
    The valid targetBytecode values.

  - ### ASM_API_VERSION

    public static final int ASM_API_VERSION
    The ASM API version used when loading/parsing classes and generating proxy adapter classes.
    See Also:
      - Constant Field Values

  - ### DEFAULT_SOURCE_ENCODING

    public static final String DEFAULT_SOURCE_ENCODING
    The default source encoding.
    See Also:
      - Constant Field Values

  - ### DEFAULT

    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()`.

- ## Constructor Details

  - ### CompilerConfiguration

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

    > Property Key | Related Property Getter
    > --- | ---
    > `groovy.source.encoding` (defaulting to `file.encoding`) | `getSourceEncoding()`
    > `groovy.target.bytecode` | `getTargetBytecode()`
    > `groovy.target.directory` | `getTargetDirectory()`
    > `groovy.parameters` | `getParameters()`
    > `groovy.preview.features` | `isPreviewFeatures()`
    > `groovy.default.scriptExtension` | `getDefaultScriptExtension()`

    The following system properties are referenced when setting the configuration optimization options:

    > Property Key | Related Property Getter
    > --- | ---
    > `groovy.target.indy` | `getOptimizationOptions()`
    > `groovy.parallel.parse` | `getOptimizationOptions()`
    > `groovy.attach.groovydoc` | `getOptimizationOptions()`
    > `groovy.attach.runtime.groovydoc` | `getOptimizationOptions()`

  - ### CompilerConfiguration

    public CompilerConfiguration(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` - The configuration to copy.

  - ### CompilerConfiguration

    public CompilerConfiguration(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 Key | Related Property Getter
    > --- | ---
    > `groovy.warnings` | `getWarningLevel()`
    > `groovy.source.encoding` (defaulting to `file.encoding`) | `getSourceEncoding()`
    > `groovy.target.directory` | `getTargetDirectory()`
    > `groovy.target.bytecode` | `getTargetBytecode()`
    > `groovy.parameters` | `getParameters()`
    > `groovy.preview.features` | `isPreviewFeatures()`
    > `groovy.classpath` | `getClasspath()`
    > `groovy.output.verbose` | `getVerbose()`
    > `groovy.output.debug` | `getDebug()`
    > `groovy.errors.tolerance` | `getTolerance()`
    > `groovy.default.scriptExtension` | `getDefaultScriptExtension()`
    > `groovy.script.base` | `getScriptBaseClass()`
    > `groovy.recompile` | `getRecompileGroovySource()`
    > `groovy.recompile.minimumInterval` | `getMinimumRecompilationInterval()`
    > `groovy.disabled.global.ast.transformations` | `getDisabledGlobalASTTransformations()`

    Parameters:
      `configuration` - The properties to get flag values from.
    Throws:
      `ConfigurationException`

- ## Method Details

  - ### isPostJDK5

    public static boolean isPostJDK5(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 1.5+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 1.5+

  - ### isPostJDK7

    public static boolean isPostJDK7(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 1.7+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 1.7+

  - ### isPostJDK8

    public static boolean isPostJDK8(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 1.8+

  - ### isPostJDK9

    public static boolean isPostJDK9(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 9+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 9+

  - ### isPostJDK10

    public static boolean isPostJDK10(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 10+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 10+

  - ### isPostJDK11

    public static boolean isPostJDK11(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 11+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 11+

  - ### isPostJDK12

    public static boolean isPostJDK12(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 12+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 12+

  - ### isPostJDK13

    public static boolean isPostJDK13(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 13+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 13+

  - ### isPostJDK14

    public static boolean isPostJDK14(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 14+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 14+

  - ### isPostJDK15

    public static boolean isPostJDK15(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 15+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 15+

  - ### isPostJDK16

    public static boolean isPostJDK16(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 16+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 16+

  - ### isPostJDK17

    public static boolean isPostJDK17(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 17+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 17+

  - ### isPostJDK18

    public static boolean isPostJDK18(String bytecodeVersion)
    Checks if the specified bytecode version string represents a JDK 18+ compatible bytecode version.
    Parameters:
      `bytecodeVersion` - The parameter can take one of the values in `ALLOWED_JDKS`.
    Returns:
      true if the bytecode version is JDK 18+

  - ### configure

    public void configure(Properties configuration) throws ConfigurationException
    Method to configure a CompilerConfiguration by using Properties. For a list of available properties look at `CompilerConfiguration(Properties)`.
    Parameters:
      `configuration` - The properties to get flag values from.
    Throws:
      `ConfigurationException`

  - ### getWarningLevel

    public int getWarningLevel()
    Gets the currently configured warning level. See `WarningMessage` for level details.

  - ### setWarningLevel

    public void setWarningLevel(int level)
    Sets the warning level. See `WarningMessage` for level details.

  - ### getSourceEncoding

    public String getSourceEncoding()
    Gets the currently configured source file encoding.

  - ### setSourceEncoding

    public void setSourceEncoding(String encoding)
    Sets the encoding to be used when reading source files.

  - ### getOutput

    @Deprecated public PrintWriter getOutput()
    Deprecated.
    not used anymore
    Gets the currently configured output writer.

  - ### setOutput

    @Deprecated public void setOutput(PrintWriter output)
    Deprecated.
    not used anymore, has no effect
    Sets the output writer.

  - ### getTargetDirectory

    public File getTargetDirectory()
    Gets the target directory for writing classes.

  - ### setTargetDirectory

    public void setTargetDirectory(String directory)
    Sets the target directory.

  - ### setTargetDirectory

    public void setTargetDirectory(File directory)
    Sets the target directory.

  - ### getClasspath

    public List<String> getClasspath()
    Returns:
      the classpath

  - ### setClasspath

    public void setClasspath(String classpath)
    Sets the classpath.

  - ### setClasspathList

    public void setClasspathList(List<String> parts)
    sets the classpath using a list of Strings
    Parameters:
      `parts` - list of strings containing the classpath parts

  - ### getVerbose

    public boolean getVerbose()
    Returns true if verbose operation has been requested.

  - ### setVerbose

    public void setVerbose(boolean verbose)
    Turns verbose operation on or off.

  - ### getDebug

    public boolean getDebug()
    Returns true if debugging operation has been requested.

  - ### setDebug

    public void setDebug(boolean debug)
    Turns debugging operation on or off.

  - ### getParameters

    public boolean getParameters()
    Returns true if parameter metadata generation has been enabled.

  - ### setParameters

    public void setParameters(boolean parameters)
    Turns parameter metadata generation on or off.

  - ### getTolerance

    public int getTolerance()
    Returns the requested error tolerance.

  - ### setTolerance

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

  - ### getScriptBaseClass

    public String getScriptBaseClass()
    Gets the name of the base class for scripts. It must be a subclass of Script.

  - ### setScriptBaseClass

    public void setScriptBaseClass(String scriptBaseClass)
    Sets the name of the base class for scripts. It must be a subclass of Script.

  - ### getPluginFactory

    public ParserPluginFactory getPluginFactory()

  - ### setPluginFactory

    public void setPluginFactory(ParserPluginFactory pluginFactory)

  - ### setScriptExtensions

    public void setScriptExtensions(Set<String> scriptExtensions)

  - ### getScriptExtensions

    public Set<String> getScriptExtensions()

  - ### getDefaultScriptExtension

    public String getDefaultScriptExtension()

  - ### setDefaultScriptExtension

    public void setDefaultScriptExtension(String defaultScriptExtension)

  - ### getRecompileGroovySource

    public boolean getRecompileGroovySource()

  - ### setRecompileGroovySource

    public void setRecompileGroovySource(boolean recompile)

  - ### getMinimumRecompilationInterval

    public int getMinimumRecompilationInterval()

  - ### setMinimumRecompilationInterval

    public void setMinimumRecompilationInterval(int time)

  - ### setTargetBytecode

    public void setTargetBytecode(String version)
    Sets the bytecode compatibility level. The parameter can take one of the values in `ALLOWED_JDKS`.
    Parameters:
      `version` - the bytecode compatibility level

  - ### getTargetBytecode

    public String getTargetBytecode()
    Retrieves the compiler bytecode compatibility level. Defaults to the minimum officially supported bytecode version for any particular Groovy version.
    Returns:
      bytecode compatibility level

  - ### getBytecodeVersion

    public int getBytecodeVersion()
    Returns the ASM bytecode version.
    Since:
      4.0.0

  - ### isPreviewFeatures

    public boolean isPreviewFeatures()
    Whether the bytecode version has preview features enabled (JEP 12)
    Returns:
      preview features

  - ### setPreviewFeatures

    public void setPreviewFeatures(boolean previewFeatures)
    Sets whether the bytecode version has preview features enabled (JEP 12).
    Parameters:
      `previewFeatures` - whether to support preview features

  - ### isLogClassgen

    public boolean isLogClassgen()
    Returns whether logging class generation is enabled.
    Since:
      4.0.0

  - ### setLogClassgen

    public void setLogClassgen(boolean logClassgen)
    Sets whether logging class generation is enabled.
    Since:
      4.0.0

  - ### getLogClassgenStackTraceMaxDepth

    public int getLogClassgenStackTraceMaxDepth()
    Returns stack trace max depth of logging class generation.
    Since:
      4.0.0

  - ### setLogClassgenStackTraceMaxDepth

    public void setLogClassgenStackTraceMaxDepth(int logClassgenStackTraceMaxDepth)
    Sets stack trace max depth of logging class generation.
    Since:
      4.0.0

  - ### getJointCompilationOptions

    public Map<String,Object> getJointCompilationOptions()
    Gets the joint compilation options for this configuration.
    Returns:
      the options

  - ### setJointCompilationOptions

    public void setJointCompilationOptions(Map<String,Object> options)
    Sets the joint compilation options for this configuration. Using null will disable joint compilation.
    Parameters:
      `options` - the options

  - ### getOptimizationOptions

    public Map<String,Boolean> getOptimizationOptions()
    Gets the optimization options for this configuration.
    Returns:
      the options (always not null)

  - ### setOptimizationOptions

    public void setOptimizationOptions(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` - the options.
    Throws:
      `IllegalArgumentException` - if the options are null

  - ### addCompilationCustomizers

    public CompilerConfiguration addCompilationCustomizers(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` - the list of customizers to be added
    Returns:
      this configuration instance

  - ### getCompilationCustomizers

    public List<CompilationCustomizer> getCompilationCustomizers()
    Returns the list of compilation customizers.
    Returns:
      the customizers (always not null)

  - ### getDisabledGlobalASTTransformations

    public Set<String> getDisabledGlobalASTTransformations()
    Returns the list of disabled global AST transformation class names.
    Returns:
      a list of global AST transformation fully qualified class names

  - ### setDisabledGlobalASTTransformations

    public void setDisabledGlobalASTTransformations(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 `ASTTransformationCustomizer` or using a `CompilationUnit.IPrimaryClassNodeOperation`, then nothing will prevent the transformation from being loaded.
    Parameters:
      `disabledGlobalASTTransformations` - a set of fully qualified class names of global AST transformations which should not be loaded.

  - ### getBytecodePostprocessor

    public BytecodeProcessor getBytecodePostprocessor()

  - ### setBytecodePostprocessor

    public void setBytecodePostprocessor(BytecodeProcessor bytecodePostprocessor)

  - ### isIndyEnabled

    public boolean isIndyEnabled()
    Checks if invoke dynamic is enabled.

  - ### isGroovydocEnabled

    public boolean isGroovydocEnabled()
    Checks if groovydoc is enabled.

  - ### isRuntimeGroovydocEnabled

    public boolean isRuntimeGroovydocEnabled()
    Checks if runtime groovydoc is enabled.