# Package groovy.transform

## Package groovy.transform Description

Compile-time AST transformations for code generation and type checking.

Key annotations: @CompileStatic (static compilation), groovy.transform.TypeChecked (type checking), groovy.transform.ToString, @EqualsAndHashCode, groovy.transform.Immutable, groovy.transform.TupleConstructor, @Lazy, groovy.transform.Synchronized, and many others for traits, records, sealing, and property handling.

Related subpackages: `groovy.transform.builder` (builder patterns), `groovy.transform.options` (property customization), `groovy.transform.stc` (type checking hints).

- Interface Summary
  Interface | Description
  --- | ---
  CompilationUnitAware | This interface is for AST transformations which must be aware of the compilation unit where they are applied.

- Class Summary
  Class | Description
  --- | ---
  Undefined | Java doesn't allow you to have null as an attribute value.
  Undefined.CLASS | Sentinel type used when an annotation member has no explicit class value.

- Enum Summary
  Enum | Description
  --- | ---
  AnnotationCollectorMode | Conflict resolution modes for AnnotationCollector.
  AutoCloneStyle | Intended style to use for cloning when using the `@`AutoClone annotation.
  DefaultsMode | Intended mode to use when generating constructors to emulate default parameter values when using the TupleConstructor annotation.
  PackageScopeTarget | Intended target when `@`PackageScope is placed at the class level.
  RecordTypeMode | Intended mode to use for records when using the `@RecordType` annotation (or `record` keyword).
  SealedMode | Intended mode to use for sealed classes when using the `@Sealed` annotation (or `sealed` keyword).
  TypeCheckingMode | This enumeration can be used whenever it is preferred to annotate a class as TypeChecked in general, but where only one or more methods are "dynamic".

- Exception Summary
  Exception | Description
  --- | ---
  Undefined.EXCEPTION | Sentinel exception type used when an annotation member has no explicit exception value.

- Annotation Type Summary
  Annotation Type | Description
  --- | ---
  ASTTest | This AST transformation aims at helping in debugging other AST transformations.
  ActiveMethod | Marks a method within an ActiveObject class for actor-backed execution.
  ActiveObject | Marks a class as an active object whose ActiveMethod-annotated methods are automatically routed through an internal actor for thread-safe, serialized execution.
  AnnotationCollector | The AnnotationCollector can be used to define aliases for annotations and attributes.
  Associative | Declares that a two-argument combining method is associative: `combine(a, combine(b, c))` produces the same result as `combine(combine(a, b), c)` for all inputs.
  AutoClone | Class annotation used to assist in the creation of `Cloneable` classes.
  AutoExternalize | Annotation used to assist in the creation of `Externalizable` classes.
  AutoFinal | Annotation to automatically add the final qualifier to method, constructor, and closure parameters.
  AutoImplement | Class annotation used to provide default dummy methods for a class extending an abstract super class or implementing one or more interfaces.
  BaseScript | Variable annotation used for changing the base script class of the current script.
  Canonical | The `@Canonical` meta-annotation combines the `@EqualsAndHashCode`, `@ToString` and `@TupleConstructor` annotations.
  CompileDynamic | An annotation which is just a shortcut for @CompileStatic(TypeCheckingMode.SKIP).
  CompileStatic | This will let the Groovy compiler use compile time checks in the style of Java then perform static compilation, thus bypassing the Groovy meta object protocol.
  ConditionalInterrupt | Allows "interrupt-safe" executions of scripts by adding a custom check for interruption into loops (for, while, ...) and at the start of closures and methods.
  EqualsAndHashCode | Class annotation used to assist in creating appropriate `equals()` and `hashCode()` methods.
  ExternalizeMethods | Class annotation used to assist in the creation of `Externalizable` classes.
  ExternalizeVerifier | Class annotation used to assist in the creation of `Externalizable` classes.
  Field | Variable annotation used for changing the scope of a variable within a script from being within the run method of the script to being at the class level for the script.
  Final | Annotation to add the final modifier to classes, methods, constructors, and fields.
  Generated | Marks class members that have been generated by the compiler.
  Immutable | Meta annotation used when defining immutable classes.
  ImmutableBase | Class annotation used to assist in the creation of immutable classes.
  ImmutableOptions | Class annotation used to assist in the creation of immutable classes.
  ImmutableProperties | Meta annotation used when just the immutable properties part of `@Immutable` is desired.
  IndexedProperty | Field annotation used with properties to provide an indexed getter and setter for the property.
  InheritConstructors | Class annotation to make constructors from a super class available in a subclass.
  Internal | Marks class members that are intended for internal use.
  KnownImmutable | Class annotation used as a marker for immutable classes.
  MapConstructor | Class annotation used to assist in the creation of map constructors in classes.
  Memoized | Method annotation that creates a cache for the results of the execution of the annotated method.
  Monadic | Marks a type as participating in monadic comprehensions (the `DO` macro).
  NamedDelegate | Marker interface used to indicate that the property names of the annotated parameter represent valid key names when using named arguments and that the property types are applicable for type checking purposes.
  NamedParam | Marker interface used to indicate that the name of the annotated parameter (or specified optional name) is a valid key name when using named arguments and that the parameter type is applicable for type checking purposes.
  NamedParams | Collector annotation for NamedParam.
  NamedVariant | Allows construction of a named-arg equivalent method or constructor.
  NonSealed | Class annotation used to demarcate non-sealed classes.
  NullCheck | Class, method or constructor annotation which indicates that each parameter should be checked to ensure it isn't null.
  OperatorRename | Allows renaming of Groovy's operator methods.
  PackageScope | Annotation used for turning off Groovy's auto visibility conventions.
  Parallel | Runs each iteration of an annotated `for` loop in parallel using the current pool or default executor, with structured completion.
  PropertyOptions | Marker annotation used to indicate that special property handling code will be generated for this class.
  Pure | Marks the return value of "pure" method only comes from expressions involving constants or other pure methods.
  RecordBase | Class annotation used to assist in the creation of record-like classes.
  RecordOptions | Class annotation used to assist in the creation of record-like classes.
  RecordType | Meta annotation used when defining record-like classes.
  Reducer | Declares that a two-argument combining method is associative and has an identity element — together, the algebraic contract a seeded parallel reduction relies on.
  Sealed | Class annotation used to assist in the creation of sealed classes.
  SealedOptions | Class annotation used to assist in the creation of sealed classes.
  SelfType | This annotation can be added on a trait to declare the list of types that a class implementing that trait is supposed to extend.
  Sortable | A class annotation used to make a class Comparable by (potentially) multiple Comparators.
  SourceURI | Variable annotation used for getting the URI of the current script.
  Synchronized | Method annotation to make a method call synchronized for concurrency handling with some useful baked-in conventions.
  TailRecursive | Method annotation used to transform methods with tail recursive calls into iterative methods automagically since the JVM cannot do this itself.
  ThreadInterrupt | Allows "interrupt-safe" executions of scripts by adding Thread.currentThread().isInterrupted() checks into loops (for, while) and at the start of closures and methods.
  TimedInterrupt | Allows safe timed executions of scripts by adding elapsed time checks into loops (for, while) and at the start of closures and methods and throwing an exception if a timeout occurs.
  ToString | Class annotation used to assist in the creation of `toString()` methods in classes.
  Trait | Used to mark a class as being a trait.
  TupleConstructor | Class annotation used to assist in the creation of tuple constructors in classes.
  TypeChecked | This will let the Groovy compiler use compile time checks in the style of Java.
  TypeChecked.TypeCheckingInfo | This annotation is added by TypeChecked: on methods which have type checking turned on.
  Virtual | Marks a public trait `static` method as virtual: trait-body calls to this method dispatch through the implementing class at runtime, so a same-signature static method declared on the implementing class overrides the trait's default.
  VisibilityOptions | Marker annotation used in the context of AST transformations to provide a custom visibility.
  WithReadLock | This annotation is used in conjunction with WithWriteLock to support read and write synchronization on a method.
  WithWriteLock | This annotation is used in conjunction with WithReadLock to support read and write synchronization on a method.