Class AutoImplementASTStubber
- All Implemented Interfaces:
ASTTransformation,ErrorCollecting
AutoImplement. Emits placeholder
implementations of abstract methods reachable through the supertype and
interface graph, so Java consumers can call those methods against the
joint-compilation stub.
The walk mirrors the full transform's
AutoImplementASTTransformation.getAllCorrectedMethodsMap(org.codehaus.groovy.ast.ClassNode): classpath
supertypes/interfaces are fully resolved at CONVERSION; same-unit Groovy
supertypes/interfaces have their source-declared abstracts visible too.
Boundary. Abstract methods contributed by another transform
to a same-unit Groovy supertype/interface (most notably trait
abstracts, since TraitASTTransformation runs at CANONICALIZATION
after this stubber) are not visible at CONVERSION and therefore not stubbed.
The runtime still implements them; only the Java-visible stub surface is
reduced. Java callers that reach for those members get a stub-time compile
error rather than a stub/runtime mismatch.
The placeholder body is a default-value return; the real body is
installed by the full transform at CANONICALIZATION, which first discards
stubber-tagged placeholders so the walk over isAbstract() candidates
sees the true abstract surface again.
- Since:
- 6.0.0
-
Field Summary
Fields inherited from class org.codehaus.groovy.transform.AbstractASTTransformation
RETENTION_CLASSNODE, sourceUnit -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvisit(ASTNode[] nodes, SourceUnit source) The method is invoked when an AST Transformation is active.Methods inherited from class org.codehaus.groovy.transform.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
-
Constructor Details
-
AutoImplementASTStubber
public AutoImplementASTStubber()
-
-
Method Details
-
visit
Description copied from interface:ASTTransformationThe method is invoked when an AST Transformation is active. For local transformations, it is invoked once each time the local annotation is encountered. For global transformations, it is invoked once for every source unit, which is typically a source file.- Parameters:
nodes- The ASTnodes when the call was triggered. Element 0 is the AnnotationNode that triggered this annotation to be activated. Element 1 is the AnnotatedNode decorated, such as a MethodNode or ClassNode. For global transformations it is usually safe to ignore this parameter.source- The source unit being compiled. The source unit may contain several classes. For global transformations, information about the AST can be retrieved from this object.
-