Package: org.codehaus.groovy.control

## [Java] Class CompilerConfiguration

- org.codehaus.groovy.control.CompilerConfiguration

-     public class CompilerConfiguration
      extends Object

  Compilation control flags and coordination stuff.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String[]` | `ALLOWED_JDKS` | The valid targetBytecode values.
    `static int` | `ASM_API_VERSION` | The ASM API version used when loading/parsing classes and generating proxy adapter classes.
    `static String` | `CLOSURE_PACKING` | System-property name for the GEP-27 incubating option that automatically packs provably-safe `@CompileStatic` closures (hoisting their bodies to a shared adapter instead of a class).
    `static String` | `CLOSURE_PACKING_REPORT` | System-property name for the GEP-27 incubating option that, on the CLOSURE_PACKING path, reports (as compiler warnings) each closure that could not be packed and why.
    `static CompilerConfiguration` | `DEFAULT` | A convenience for getting a default configuration.
    `static String` | `DEFAULT_SOURCE_ENCODING` | The default source encoding.
    `static String` | `DEFAULT_TARGET_BYTECODE` |
    `static String` | `ERROR_RECOVERY` | Option for enabling ANTLR parser error recovery on the Parrot parser.
    `static String` | `GROOVYDOC` | Optimization Option for enabling attaching groovydoc as AST node metadata.
    `static String` | `INVOKEDYNAMIC` | Optimization Option for enabling `invokedynamic` compilation.
    `static String` | `JDK10` | This (`"10"`) is the value for targetBytecode to compile for a JDK 10.
    `static String` | `JDK11` | This (`"11"`) is the value for targetBytecode to compile for a JDK 11.
    `static String` | `JDK12` | This (`"12"`) is the value for targetBytecode to compile for a JDK 12.
    `static String` | `JDK13` | This (`"13"`) is the value for targetBytecode to compile for a JDK 13.
    `static String` | `JDK14` | This (`"14"`) is the value for targetBytecode to compile for a JDK 14.
    `static String` | `JDK15` | This (`"15"`) is the value for targetBytecode to compile for a JDK 15.
    `static String` | `JDK16` | This (`"16"`) is the value for targetBytecode to compile for a JDK 16.
    `static String` | `JDK17` | This (`"17"`) is the value for targetBytecode to compile for a JDK 17.
    `static String` | `JDK18` | This (`"18"`) is the value for targetBytecode to compile for a JDK 18.
    `static String` | `JDK19` | This (`"19"`) is the value for targetBytecode to compile for a JDK 19.
    `static String` | `JDK20` | This (`"20"`) is the value for targetBytecode to compile for a JDK 20.
    `static String` | `JDK21` | This (`"21"`) is the value for targetBytecode to compile for a JDK 21.
    `static String` | `JDK22` | This (`"22"`) is the value for targetBytecode to compile for a JDK 22.
    `static String` | `JDK23` | This (`"23"`) is the value for targetBytecode to compile for a JDK 23.
    `static String` | `JDK24` | This (`"24"`) is the value for targetBytecode to compile for a JDK 24.
    `static String` | `JDK25` | This (`"25"`) is the value for targetBytecode to compile for a JDK 25.
    `static String` | `JDK26` | This (`"26"`) is the value for targetBytecode to compile for a JDK 26.
    `static String` | `JDK27` | This (`"27"`) is the value for targetBytecode to compile for a JDK 27.
    `static String` | `JDK4` | This (`"1.4"`) is the value for targetBytecode to compile for a JDK 1.4.
    `static String` | `JDK5` | This (`"1.5"`) is the value for targetBytecode to compile for a JDK 1.5.
    `static String` | `JDK6` | This (`"1.6"`) is the value for targetBytecode to compile for a JDK 1.6.
    `static String` | `JDK7` | This (`"1.7"`) is the value for targetBytecode to compile for a JDK 1.7.
    `static String` | `JDK8` | This (`"1.8"`) is the value for targetBytecode to compile for a JDK 1.8.
    `static String` | `JDK9` | This (`"9"`) is the value for targetBytecode to compile for a JDK 9.
    `static Map<String, Integer>` | `JDK_TO_BYTECODE_VERSION_MAP` | JDK version to bytecode version mapping.
    `static String` | `LAMBDA_HOISTING` | System-property name for the GEP-27 incubating option that hoists eligible SAM lambdas to a metafactory method instead of generating a per-lambda class.
    `static String` | `MEM_STUB` | Joint Compilation Option for enabling generating stubs in memory.
    `static String` | `PARALLEL_PARSE` | Optimization Option for enabling parallel parsing.
    `static String` | `RUNTIME_GROOVYDOC` | Optimization Option for enabling attaching Groovydoc annotation.

  - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public CompilerConfiguration` | `addCompilationCustomizers(CompilationCustomizer customizers)` Adds compilation customizers to the compilation process.
    `` | `public void` | `configure(Properties configuration)` Method to configure a CompilerConfiguration by using Properties.
    `` | `public BytecodeProcessor` | `getBytecodePostprocessor()` Returns the optional bytecode post-processor.
    `` | `public final int` | `getBytecodeVersion()` Returns the targeted bytecode (aka Java class file) version number.
    `` | `public List<String>` | `getClasspath()` Returns: the classpath
    `` | `public List<CompilationCustomizer>` | `getCompilationCustomizers()` Returns the list of compilation customizers.
    `` | `public boolean` | `getDebug()` Returns true if debugging operation has been requested.
    `` | `public String` | `getDefaultScriptExtension()` Returns the default file extension used for generated scripts.
    `` | `public Set<String>` | `getDisabledGlobalASTTransformations()` Returns the list of disabled global AST transformation class names.
    `` | `public Map<String, Object>` | `getJointCompilationOptions()` Gets the joint compilation options for this configuration.
    `` | `public int` | `getLogClassgenStackTraceMaxDepth()` Returns stack trace max depth of logging class generation
    `` | `public int` | `getMinimumRecompilationInterval()` Returns the minimum interval between recompilation checks.
    `` | `public Map<String, Boolean>` | `getOptimizationOptions()` Gets the optimization options for this configuration.
    `` | `public PrintWriter` | `getOutput()` Gets the currently configured output writer.
    `` | `public boolean` | `getParameters()` Returns true if parameter metadata generation has been enabled.
    `` | `public ParserPluginFactory` | `getPluginFactory()` Returns the parser plugin factory to use for source parsing.
    `` | `public boolean` | `getRecompileGroovySource()` Indicates whether Groovy sources should be recompiled when they change.
    `` | `public String` | `getScriptBaseClass()` Gets the name of the base class for scripts.
    `` | `public Set<String>` | `getScriptExtensions()` Returns the recognized script file extensions.
    `` | `public String` | `getSourceEncoding()` Gets the currently configured source file encoding.
    `` | `public String` | `getTargetBytecode()` Retrieves the compiler bytecode compatibility level.
    `` | `public File` | `getTargetDirectory()` Gets the target directory for writing classes.
    `` | `public int` | `getTargetPhase()` Gets the target compile phase: the last phase to be processed when CompilationUnit.compile is called without an explicit phase (GROOVY-12204).
    `` | `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` | `isClassTagPreemptionDisabled()` Whether @ClassTag preemption is disabled globally under static compilation (GROOVY-12115).
    `` | `public boolean` | `isErrorRecoveryEnabled()` Checks if ANTLR parser error recovery is enabled.
    `` | `public boolean` | `isForInPerIterationCaptureEnabled()` Checks if per-iteration capture of for-in (enhanced for-each) loop variables is enabled (GROOVY-11792).
    `` | `public boolean` | `isGroovydocEnabled()` Checks if groovydoc is enabled.
    `` | `public boolean` | `isIndyEnabled()` Checks if invoke dynamic is enabled.
    `` | `public boolean` | `isLogClassgen()` Returns whether logging class generation is enabled
    `` | `public static boolean` | `isPostJDK10(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 10+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK11(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 11+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK12(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 12+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK13(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 13+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK14(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 14+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK15(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 15+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK16(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 16+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK17(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 17+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK18(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 18+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK5(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 1.5+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK7(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 1.7+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK8(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 1.8+ compatible bytecode version.
    `` | `public static boolean` | `isPostJDK9(String bytecodeVersion)` Checks if the specified bytecode version string represents a JDK 9+ compatible bytecode version.
    `` | `public boolean` | `isPreviewFeatures()` Whether the bytecode version has preview features enabled (JEP 12)
    `` | `public boolean` | `isRuntimeGroovydocEnabled()` Checks if runtime groovydoc is enabled.
    `` | `public void` | `setBytecodePostprocessor(BytecodeProcessor bytecodePostprocessor)` Sets the bytecode post-processor applied to generated classes.
    `` | `public void` | `setClassTagPreemptionDisabled(boolean classTagPreemptionDisabled)` Disables (or re-enables) @ClassTag preemption globally under static compilation (GROOVY-12115).
    `` | `public void` | `setClasspath(String classpath)` Sets the classpath.
    `` | `public void` | `setClasspathList(List<String> parts)` sets the classpath using a list of Strings
    `` | `public void` | `setDebug(boolean debug)` Turns debugging operation on or off.
    `` | `public void` | `setDefaultScriptExtension(String defaultScriptExtension)` Sets the default file extension used for generated scripts.
    `` | `public void` | `setDisabledGlobalASTTransformations(Set<String> disabledGlobalASTTransformations)` Disables the specified global AST transformations.
    `` | `public void` | `setForInPerIterationCaptureEnabled(boolean forInPerIterationCapture)` Enables or disables per-iteration capture of for-in (enhanced for-each) loop variables shared with closures, lambdas, or anonymous inner classes (GROOVY-11792).
    `` | `public void` | `setJointCompilationOptions(Map<String, Object> options)` Sets the joint compilation options for this configuration.
    `` | `public void` | `setLogClassgen(boolean logClassgen)` Sets whether logging class generation is enabled
    `` | `public void` | `setLogClassgenStackTraceMaxDepth(int logClassgenStackTraceMaxDepth)` Sets stack trace max depth of logging class generation
    `` | `public void` | `setMinimumRecompilationInterval(int time)` Sets the minimum interval between recompilation checks.
    `` | `public void` | `setOptimizationOptions(Map<String, Boolean> options)` Sets the optimization options for this configuration.
    `` | `public void` | `setOutput(PrintWriter output)` Sets the output writer.
    `` | `public void` | `setParameters(boolean parameters)` Turns parameter metadata generation on or off.
    `` | `public void` | `setPluginFactory(ParserPluginFactory pluginFactory)` Sets the parser plugin factory to use for source parsing.
    `` | `public void` | `setPreviewFeatures(boolean previewFeatures)` Sets whether the bytecode version has preview features enabled (JEP 12).
    `` | `public void` | `setRecompileGroovySource(boolean recompile)` Sets whether changed Groovy sources should be recompiled.
    `` | `public void` | `setScriptBaseClass(String scriptBaseClass)` Sets the name of the base class for scripts.
    `` | `public void` | `setScriptExtensions(Set<String> scriptExtensions)` Replaces the set of recognized script file extensions.
    `` | `public void` | `setSourceEncoding(String encoding)` Sets the encoding to be used when reading source files.
    `` | `public void` | `setTargetBytecode(String version)` Sets the bytecode compatibility level.
    `` | `public void` | `setTargetDirectory(String directory)` Sets the target directory.
    `` | `public void` | `setTargetDirectory(File directory)` Sets the target directory.
    `` | `public void` | `setTargetPhase(int targetPhase)` Sets the target compile phase: the last phase to be processed when CompilationUnit.compile is called without an explicit phase (GROOVY-12204).
    `` | `public void` | `setTargetPhase(CompilePhase targetPhase)` Convenience overload of setTargetPhase(int) taking the CompilePhase enum, e.g. for configuration scripts: `configuration.targetPhase = CompilePhase.INSTRUCTION_SELECTION`.
    `` | `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.
    `` | `public void` | `setVerbose(boolean verbose)` Turns verbose operation on or off.
    `` | `public void` | `setWarningLevel(int level)` Sets the warning level.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### 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.

    - #### @Incubating
      public static final String CLOSURE_PACKING

      System-property name for the GEP-27 incubating option that automatically packs provably-safe `@CompileStatic` closures (hoisting their bodies to a shared adapter instead of a class). Incubating: this switch may change or be removed until the feature graduates.

    - #### @Incubating
      public static final String CLOSURE_PACKING_REPORT

      System-property name for the GEP-27 incubating option that, on the CLOSURE_PACKING path, reports (as compiler warnings) each closure that could not be packed and why.

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

    - #### public static final String DEFAULT_SOURCE_ENCODING

      The default source encoding.

    - #### public static final String DEFAULT_TARGET_BYTECODE

    - #### public static final String ERROR_RECOVERY

      Option for enabling ANTLR parser error recovery on the Parrot parser.

      Disabled by default. When enabled (typically for IDE editing), the parser resynchronizes after recognition errors so multiple diagnostics can be collected in one pass instead of failing fast on the first error. Stored in getOptimizationOptions() for consistency with other compiler feature flags (e.g. GROOVYDOC).

      See Also:
        isErrorRecoveryEnabled()
      Since:
        5.0.0

    - #### 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.

    - #### @Deprecated
      public static final String JDK10

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

    - #### @Deprecated
      public static final String JDK11

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

    - #### @Deprecated
      public static final String JDK12

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

    - #### @Deprecated
      public static final String JDK13

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

    - #### @Deprecated
      public static final String JDK14

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

    - #### @Deprecated
      public static final String JDK15

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

    - #### @Deprecated
      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 JDK18

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

    - #### public static final String JDK19

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

    - #### public static final String JDK20

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

    - #### public static final String JDK21

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

    - #### public static final String JDK22

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

    - #### public static final String JDK23

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

    - #### public static final String JDK24

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

    - #### public static final String JDK25

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

    - #### public static final String JDK26

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

    - #### public static final String JDK27

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

    - #### @Deprecated
      public static final String JDK4

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

    - #### @Deprecated
      public static final String JDK5

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

    - #### @Deprecated
      public static final String JDK6

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

    - #### @Deprecated
      public static final String JDK7

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

    - #### @Deprecated
      public static final String JDK8

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

    - #### @Deprecated
      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.

    - #### @Incubating
      public static final String LAMBDA_HOISTING

      System-property name for the GEP-27 incubating option that hoists eligible SAM lambdas to a metafactory method instead of generating a per-lambda class.

    - #### public static final String MEM_STUB

      Joint Compilation Option for enabling generating stubs in memory.

    - #### public static final String PARALLEL_PARSE

      Optimization Option for enabling parallel parsing.

    - #### public static final String RUNTIME_GROOVYDOC

      Optimization Option for enabling attaching Groovydoc annotation.

  - ### Constructor Detail

    - #### 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
      > `groovy.parser.error.recovery` | getOptimizationOptions / isErrorRecoveryEnabled

      Additional language-compatibility system properties (not optimization options):

      > Property Key | Related Property Getter
      > --- | ---
      > `groovy.forin.per.iteration.capture` | isForInPerIterationCaptureEnabled

    - #### 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.

    - #### public CompilerConfiguration(Properties configuration)

      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
      > `groovy.forin.per.iteration.capture` | isForInPerIterationCaptureEnabled

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

  - ### Method Detail

    - #### 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

    - #### public void configure(Properties configuration)

      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.

    - #### public BytecodeProcessor getBytecodePostprocessor()

      Returns the optional bytecode post-processor.

      Returns:
        the configured bytecode post-processor, or `null`

    - #### public final int getBytecodeVersion()

      Returns the targeted bytecode (aka Java class file) version number.

      Since:
        4.0.0

    - #### public List<String> getClasspath()

      Returns:
        the classpath

    - #### public List<CompilationCustomizer> getCompilationCustomizers()

      Returns the list of compilation customizers.

      Returns:
        the customizers (always not null)

    - #### public boolean getDebug()

      Returns true if debugging operation has been requested.

    - #### public String getDefaultScriptExtension()

      Returns the default file extension used for generated scripts.

      Returns:
        the default script extension

    - #### 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

    - #### public Map<String, Object> getJointCompilationOptions()

      Gets the joint compilation options for this configuration.

      Returns:
        the options

    - #### public int getLogClassgenStackTraceMaxDepth()

      Returns stack trace max depth of logging class generation

      Returns:
        stack trace max depth of logging class generation
      Since:
        4.0.0

    - #### public int getMinimumRecompilationInterval()

      Returns the minimum interval between recompilation checks.

      Returns:
        the recompilation interval in milliseconds

    - #### public Map<String, Boolean> getOptimizationOptions()

      Gets the optimization options for this configuration.

      Returns:
        the options (always not null)

    - #### @Deprecated
      public PrintWriter getOutput()

      Gets the currently configured output writer.

      deprecated:
        not used anymore

    - #### public boolean getParameters()

      Returns true if parameter metadata generation has been enabled.

    - #### public ParserPluginFactory getPluginFactory()

      Returns the parser plugin factory to use for source parsing.

      Returns:
        the configured parser plugin factory

    - #### public boolean getRecompileGroovySource()

      Indicates whether Groovy sources should be recompiled when they change.

      Returns:
        `true` if recompilation is enabled

    - #### public String getScriptBaseClass()

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

    - #### public Set<String> getScriptExtensions()

      Returns the recognized script file extensions.

      Returns:
        the configured script extensions

    - #### public String getSourceEncoding()

      Gets the currently configured source file encoding.

    - #### 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

    - #### public File getTargetDirectory()

      Gets the target directory for writing classes.

    - #### public int getTargetPhase()

      Gets the target compile phase: the last phase to be processed when CompilationUnit.compile is called without an explicit phase (GROOVY-12204). Defaults to Phases.ALL.

      Returns:
        the target phase number, one of the Phases constants
      See Also:
        setTargetPhase(int)
      Since:
        6.0.0

    - #### 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. See WarningMessage for level details.

    - #### public boolean isClassTagPreemptionDisabled()

      Whether @ClassTag preemption is disabled globally under static compilation (GROOVY-12115). Preemption requires the API author's declared intent (`@ClassTag(preempt=true)`) and is contained to the declaring class; this flag lets the consuming build veto every preemptive upgrade anyway. Additive injection, such as for `asChecked`, is never gated by this flag. False (the default) honours declared intent.

      Returns:
        whether preemption is disabled
      Since:
        6.0.0

    - #### public boolean isErrorRecoveryEnabled()

      Checks if ANTLR parser error recovery is enabled.

      Disabled by default. Enable via ERROR_RECOVERY or the `groovy.parser.error.recovery` system property. Intended for IDE editing (multiple syntax diagnostics per pass). Leave off for production compilation: fail-fast is cheaper and avoids building partial trees.

      Returns:
        `true` if parser error recovery is enabled
      Since:
        5.0.0

    - #### public boolean isForInPerIterationCaptureEnabled()

      Checks if per-iteration capture of for-in (enhanced for-each) loop variables is enabled (GROOVY-11792). Classic `for` and `while` loops are not affected by this flag.

      This is a language-compatibility switch (not a performance optimization) and is independent of getOptimizationOptions(). Enabled by default. Disable via system property `groovy.forin.per.iteration.capture=false` or setForInPerIterationCaptureEnabled(boolean) setForInPerIterationCaptureEnabled(false), which restores the historical behaviour where a single shared Reference is updated across for-in iterations.

      Returns:
        `true` if each for-in iteration should allocate a fresh reference for loop variables shared with closures, lambdas, or anonymous inner classes
      See Also:
        setForInPerIterationCaptureEnabled(boolean)

    - #### public boolean isGroovydocEnabled()

      Checks if groovydoc is enabled.

    - #### public boolean isIndyEnabled()

      Checks if invoke dynamic is enabled. Enabled by default since Groovy 4.0. Can be disabled by setting the system property `groovy.target.indy` to `false` or by setting the `indy` optimization option to `false`. Disabling indy emits classic call-site bytecode that requires the optional `groovy-callsite` module on the compile and runtime classpaths (see GROOVY-11158). The ability to disable may be removed in a future version.

    - #### public boolean isLogClassgen()

      Returns whether logging class generation is enabled

      Returns:
        whether logging class generation is enabled
      Since:
        4.0.0

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### 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+

    - #### 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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### @Deprecated
      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+

    - #### public boolean isPreviewFeatures()

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

      Returns:
        preview features

    - #### public boolean isRuntimeGroovydocEnabled()

      Checks if runtime groovydoc is enabled.

    - #### public void setBytecodePostprocessor(BytecodeProcessor bytecodePostprocessor)

      Sets the bytecode post-processor applied to generated classes.

      Parameters:
        `bytecodePostprocessor` - the post-processor to use

    - #### public void setClassTagPreemptionDisabled(boolean classTagPreemptionDisabled)

      Disables (or re-enables) @ClassTag preemption globally under static compilation (GROOVY-12115).

      Parameters:
        `classTagPreemptionDisabled` - whether to disable preemption
      Since:
        6.0.0

    - #### public void setClasspath(String classpath)

      Sets the classpath.

    - #### public void setClasspathList(List<String> parts)

      sets the classpath using a list of Strings

      Parameters:
        `parts` - list of strings containing the classpath parts

    - #### public void setDebug(boolean debug)

      Turns debugging operation on or off.

    - #### public void setDefaultScriptExtension(String defaultScriptExtension)

      Sets the default file extension used for generated scripts.

      Parameters:
        `defaultScriptExtension` - the default script extension

    - #### 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 org.codehaus.groovy.control.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.

    - #### public void setForInPerIterationCaptureEnabled(boolean forInPerIterationCapture)

      Enables or disables per-iteration capture of for-in (enhanced for-each) loop variables shared with closures, lambdas, or anonymous inner classes (GROOVY-11792). Classic `for` and `while` loops are not affected. Default is `true`. Setting `false` restores the historical single shared Reference across iterations.

      Parameters:
        `forInPerIterationCapture` - `true` to allocate a fresh reference each for-in iteration for shared loop variables
      See Also:
        isForInPerIterationCaptureEnabled()

    - #### 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

    - #### public void setLogClassgen(boolean logClassgen)

      Sets whether logging class generation is enabled

      Parameters:
        `logClassgen` - whether to enable logging class generation
      Since:
        4.0.0

    - #### public void setLogClassgenStackTraceMaxDepth(int logClassgenStackTraceMaxDepth)

      Sets stack trace max depth of logging class generation

      Parameters:
        `logClassgenStackTraceMaxDepth` - stack trace max depth of logging class generation
      Since:
        4.0.0

    - #### public void setMinimumRecompilationInterval(int time)

      Sets the minimum interval between recompilation checks.

      Parameters:
        `time` - the recompilation interval in milliseconds

    - #### 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 include `"all"`, `"int"`, INVOKEDYNAMIC, PARALLEL_PARSE, GROOVYDOC, and RUNTIME_GROOVYDOC. For-in per-iteration capture (GROOVY-11792) is not an optimization option; use setForInPerIterationCaptureEnabled(boolean) instead.

      throws:
        IllegalArgumentException if the options are null
      Parameters:
        `options` - the options.

    - #### @Deprecated
      public void setOutput(PrintWriter output)

      Sets the output writer.

      deprecated:
        not used anymore, has no effect

    - #### public void setParameters(boolean parameters)

      Turns parameter metadata generation on or off.

    - #### public void setPluginFactory(ParserPluginFactory pluginFactory)

      Sets the parser plugin factory to use for source parsing.

      Parameters:
        `pluginFactory` - the parser plugin factory to use

    - #### public void setPreviewFeatures(boolean previewFeatures)

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

      Parameters:
        `previewFeatures` - whether to support preview features

    - #### public void setRecompileGroovySource(boolean recompile)

      Sets whether changed Groovy sources should be recompiled.

      Parameters:
        `recompile` - `true` to enable recompilation checks

    - #### public void setScriptBaseClass(String scriptBaseClass)

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

    - #### public void setScriptExtensions(Set<String> scriptExtensions)

      Replaces the set of recognized script file extensions.

      Parameters:
        `scriptExtensions` - the script extensions to use

    - #### public void setSourceEncoding(String encoding)

      Sets the encoding to be used when reading source files.

    - #### 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

    - #### public void setTargetDirectory(String directory)

      Sets the target directory.

    - #### public void setTargetDirectory(File directory)

      Sets the target directory.

    - #### public void setTargetPhase(int targetPhase)

      Sets the target compile phase: the last phase to be processed when CompilationUnit.compile is called without an explicit phase (GROOVY-12204). Values outside the range of the Phases constants are clamped into range. Setting Phases.INSTRUCTION_SELECTION gives a check-only compilation, as used by the `groovyc --check` option: parse, resolution, and static type-checking errors are reported but no class files are generated. Callers that pass an explicit phase to CompilationUnit.compile, such as the AST browser, are unaffected by this setting.

      Parameters:
        `targetPhase` - the target phase number, one of the Phases constants
      See Also:
        getTargetPhase()
      Since:
        6.0.0

    - #### public void setTargetPhase(CompilePhase targetPhase)

      Convenience overload of setTargetPhase(int) taking the CompilePhase enum, e.g. for configuration scripts: `configuration.targetPhase = CompilePhase.INSTRUCTION_SELECTION`.

      Parameters:
        `targetPhase` - the target phase
      Since:
        6.0.0

    - #### 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.

    - #### public void setVerbose(boolean verbose)

      Turns verbose operation on or off.

    - #### public void setWarningLevel(int level)

      Sets the warning level. See WarningMessage for level details.