Package: org.codehaus.groovy.transform

## [Java] Class StubberSupport

- org.codehaus.groovy.transform.StubberSupport

-     public final class StubberSupport
      extends Object

  Utilities for GEP-21 Shape C joint-compilation stubbers.

  A stubber emits placeholder members at `Phases.CONVERSION` so the joint-compilation stub reflects what the full transform will produce at its declared phase. The placeholder is tagged with STUB_METADATA_KEY; the full transform recognises the tag and either replaces the placeholder body or discards the placeholder before adding its own member.

  All stubbers share a single metadata key — the runtime mapping between a placeholder and the full transform that should complete it is given by the member's signature, not by per-stubber namespacing.

  Since:
    6.0.0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `STUB_METADATA_KEY` | Metadata key tagging a member that was added by a CONVERSION-phase stubber as a placeholder.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static ConstructorNode` | `addStubConstructor(ClassNode classNode, int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement body)` Add a placeholder constructor via ClassNodeUtils.addGeneratedConstructor and tag it with STUB_METADATA_KEY.
    `` | `public static MethodNode` | `addStubMethod(ClassNode classNode, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement body)` Add a placeholder method via ClassNodeUtils.addGeneratedMethod and tag it with STUB_METADATA_KEY.
    `` | `public static void` | `clearStub(AnnotatedNode node)` Removes the stubber-placeholder tag from `node`, if present.
    `` | `public static boolean` | `isStub(AnnotatedNode node)` Returns true when `node` carries the stubber-placeholder tag.
    `<T extends AnnotatedNode>` | `public static T` | `tagAsStub(T node)` Tag an existing node as a stubber placeholder.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### public static final String STUB_METADATA_KEY

      Metadata key tagging a member that was added by a CONVERSION-phase stubber as a placeholder. The paired full transform consults this key to decide whether to replace the body or discard the placeholder.

  - ### Method Detail

    - #### public static ConstructorNode addStubConstructor(ClassNode classNode, int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement body)

      Add a placeholder constructor via ClassNodeUtils.addGeneratedConstructor and tag it with STUB_METADATA_KEY.

    - #### public static MethodNode addStubMethod(ClassNode classNode, String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement body)

      Add a placeholder method via ClassNodeUtils.addGeneratedMethod and tag it with STUB_METADATA_KEY.

    - #### public static void clearStub(AnnotatedNode node)

      Removes the stubber-placeholder tag from `node`, if present.

    - #### public static boolean isStub(AnnotatedNode node)

      Returns true when `node` carries the stubber-placeholder tag.

    - #### <T extends AnnotatedNode> public static T tagAsStub(T node)

      Tag an existing node as a stubber placeholder. Useful when the addition itself goes through a shared helper (e.g. `addComparableSurface`) so the stubber receives the resulting node and only needs to tag it.