Package: org.codehaus.groovy.transform

## [Java] Class RecordTypeASTTransformation

- org.codehaus.groovy.transform.RecordTypeASTTransformation

- All Implemented Interfaces and Traits:
    CompilationUnitAware

      @GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)
      public class RecordTypeASTTransformation
      extends AbstractASTTransformation
      implements CompilationUnitAware

  Handles generation of code for the

  RecordType:
    annotation.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static ClassNode` | `MY_TYPE` |

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class AbstractASTTransformation` | `RETENTION_CLASSNODE, sourceUnit`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public String` | `getAnnotationName()`
    `` | `protected GroovyClassLoader` | `getTransformLoader()`
    `` | `public static boolean` | `recordNative(ClassNode node)` Indicates that the given classnode is a native JVM record class.
    `` | `public void` | `setCompilationUnit(CompilationUnit unit)`
    `` | `public void` | `visit(ASTNode[] nodes, SourceUnit source)`
    `` | `public static boolean` | `wouldBeNativeRecord(ClassNode cNode, String targetBytecode)` Predicts whether `cNode` will be compiled as a native JVM record.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractASTTransformation` | `addError, checkIncludeExcludeUndefinedAware, checkIncludeExcludeUndefinedAware, checkNotInterface, checkPropertyList, checkPropertyList, checkPropertyList, copyAnnotatedNodeAnnotations, copyAnnotatedNodeAnnotations, deemedInternal, deemedInternalName, getAnnotationName, getMemberClassList, getMemberClassValue, getMemberClassValue, getMemberIntValue, getMemberStringList, getMemberStringValue, getMemberStringValue, getMemberValue, hasAnnotation, init, markAsInternal, memberHasValue, shouldSkip, shouldSkip, shouldSkip, shouldSkipOnDescriptorUndefinedAware, shouldSkipUndefinedAware, shouldSkipUndefinedAware, shouldSkipUndefinedAware, tokenize`

- - ### Field Detail

    - #### public static final ClassNode MY_TYPE

  - ### Method Detail

    - #### public String getAnnotationName()

    - #### protected GroovyClassLoader getTransformLoader()

    - #### @Incubating
      public static boolean recordNative(ClassNode node)

      Indicates that the given classnode is a native JVM record class. For classes being compiled, this will only be valid after the `RecordTypeASTTransformation` transform has been invoked.

    - #### public void setCompilationUnit(CompilationUnit unit)

    - #### public void visit(ASTNode[] nodes, SourceUnit source)

    - #### @Incubating
      public static boolean wouldBeNativeRecord(ClassNode cNode, String targetBytecode)

      Predicts whether `cNode` will be compiled as a native JVM record. Mirrors the decision logic in doProcessRecordType (presence of `@RecordBase`, target bytecode `>= 17`, and `@RecordOptions(mode != EMULATE)`) so callers running before the transform itself fires can act on the same outcome.

      The joint-compilation stub generator uses this at `Phases.CONVERSION` to decide whether to emit `record Foo(...)` syntax. Unlike recordNative(ClassNode), which inspects the post-transform super class, this predicate inspects only the source-level annotations.

      Parameters:
        `cNode` - the candidate class node
        `targetBytecode` - the target bytecode level (see CompilerConfiguration.getTargetBytecode)
      Since:
        6.0.0