@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)
public class RecordTypeASTTransformation
extends AbstractASTTransformation
implements CompilationUnitAware
Handles generation of code for the
| Modifiers | Name | Description |
|---|---|---|
static ClassNode |
MY_TYPE |
Redirect node for RecordBase. |
| Fields inherited from class | Fields |
|---|---|
class AbstractASTTransformation |
RETENTION_CLASSNODE, sourceUnit |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public String |
getAnnotationName() |
|
protected GroovyClassLoader |
getTransformLoader()Returns the compilation unit's transform loader when compilationUnit
has been set, and otherwise the source unit's class loader. |
|
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.
|
Redirect node for RecordBase. makeWithoutCaching with generics
omitted builds a fresh node that redirects to the cached class, so this is not
the shared ClassNode.
Returns the compilation unit's transform loader when compilationUnit
has been set, and otherwise the source unit's class loader.
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.
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.
cNode - the candidate class nodetargetBytecode - the target bytecode level
(see CompilerConfiguration.getTargetBytecode)