@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)
public class SealedASTTransformation
extends AbstractASTTransformation
Handles generation of code for the
| Modifiers | Name | Description |
|---|---|---|
static String |
SEALED_ALWAYS_ANNOTATE |
| Fields inherited from class | Fields |
|---|---|
class AbstractASTTransformation |
RETENTION_CLASSNODE, sourceUnit |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static List<ClassNode> |
getDeclaredPermittedSubclasses(ClassNode cNode)Returns the explicitly-declared permitted-subclass list for cNode,
either from the populated permittedSubclasses field (after the
transform has run) or from the @Sealed annotation's
permittedSubclasses member. |
|
public static List<ClassNode> |
getEffectivePermittedSubclasses(ClassNode cNode)Returns the effective permitted-subclass list for cNode: the
explicitly-declared list when present, otherwise the inferred list
obtained by scanning the enclosing compilation unit for direct
subtypes (mirroring SealedCompletionASTTransformation). |
|
public static boolean |
sealedNative(AnnotatedNode node)Reports true if native sealed class information should be written into the bytecode. |
|
public static boolean |
sealedSkipAnnotation(AnnotatedNode node)Reports true if the Sealed annotation should not be
included in the bytecode for a sealed or emulated-sealed class.
|
|
public static boolean |
sealedSkipAnnotationFromSource(ClassNode cNode)Reports whether the source for cNode uses
@SealedOptions(alwaysAnnotate=false) — independent of compile-phase
ordering, so callers earlier than SEMANTIC_ANALYSIS can use it. |
|
public void |
visit(ASTNode[] nodes, SourceUnit source) |
|
public static boolean |
wouldBeNativeSealed(ClassNode cNode, String targetBytecode)Reports whether cNode would receive native sealed bytecode for the
given targetBytecode level. |
Returns the explicitly-declared permitted-subclass list for cNode,
either from the populated permittedSubclasses field (after the
transform has run) or from the @Sealed annotation's
permittedSubclasses member. An empty list means no explicit list
is declared in source — inference happens later via
SealedCompletionASTTransformation. Independent of compile-phase
ordering, so callers earlier than SEMANTIC_ANALYSIS can use it.
Returns the effective permitted-subclass list for cNode: the
explicitly-declared list when present, otherwise the inferred list
obtained by scanning the enclosing compilation unit for direct
subtypes (mirroring SealedCompletionASTTransformation). Phase
independent, so callers earlier than CANONICALIZATION can use it.
Reports true if native sealed class information should be written into the bytecode. Will only ever return true after the SealedASTTransformation visit method has completed.
Reports true if the Sealed annotation should not be
included in the bytecode for a sealed or emulated-sealed class.
Will only ever return true after the SealedASTTransformation transform has been invoked.
Sealed annotation is not required for this node Reports whether the source for cNode uses
@SealedOptions(alwaysAnnotate=false) — independent of compile-phase
ordering, so callers earlier than SEMANTIC_ANALYSIS can use it.
Reports whether cNode would receive native sealed bytecode for the
given targetBytecode level. Independent of compile-phase ordering,
so callers earlier than SEMANTIC_ANALYSIS (e.g. the joint-compile
stub generator) can use it.
cNode - the class being checkedtargetBytecode - the target bytecode level
(see CompilerConfiguration.getTargetBytecode)