Class DelegateASTStubber

java.lang.Object
org.codehaus.groovy.transform.AbstractASTTransformation
org.codehaus.groovy.transform.DelegateASTStubber
All Implemented Interfaces:
ASTTransformation, ErrorCollecting

public class DelegateASTStubber extends AbstractASTTransformation
Joint-compilation stubber for Delegate. Walks the delegate type with the same enumeration and filtering rules as the full transform — sharing helpers from DelegateASTTransformation — and emits placeholder methods on the owner so Java consumers can call the delegated surface against the joint-compilation stub.

The stub surface is a strict subset of the runtime: the stubber honours interfaces, deprecated, includes/excludes, includeTypes/excludeTypes, and allNames the same way the runtime does, so no method appears on the stub that the full transform won't add at runtime.

Member-body content is a default-value placeholder; the full transform at CANONICALIZATION discards stubber-tagged methods first, then installs its real this.delegate.method(args) bodies.

Boundary. When the delegate type is in the same compilation unit and gains methods from another transform that runs after CONVERSION (or another CONVERSION-phase stubber that hasn't run yet — e.g. the delegate type is declared after the owner in source), those methods are not visible to the stubber and not delegated in the stub. The runtime still produces the full surface; the stub remains a subset.

Since:
6.0.0
  • Constructor Details

    • DelegateASTStubber

      public DelegateASTStubber()
  • Method Details

    • visit

      public void visit(ASTNode[] nodes, SourceUnit source)
      Description copied from interface: ASTTransformation
      The 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.