Package: org.codehaus.groovy.classgen.asm.sc

## [Java] Class StaticInvocationWriter

- org.codehaus.groovy.classgen.asm.sc.StaticInvocationWriter

-     public class StaticInvocationWriter
      extends InvocationWriter

  Invocation writer for statically compiled code paths.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class InvocationWriter` | `castToVargsArray, controller, currentCall, invokeClosureMethod, invokeMethod, invokeMethodOnCurrent, invokeMethodOnSuper, invokeStaticMethod`

  - ### Constructor Summary

    Constructors
    Constructor and description
    `StaticInvocationWriter(WriterController wc)` Creates an invocation writer that favors direct bytecode calls over dynamic dispatch.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected static boolean` | `isPrivateBridgeMethodsCallAllowed(ClassNode receiver, ClassNode caller)` deprecated: Use bridge metadata on the declaring class instead of probing outer-class nesting manually.
    `` | `protected void` | `loadArguments(List<Expression> argumentList, Parameter[] parameters)` * Evaluates and loads each argument expression, handling varargs packing. * * Parameters: `arguments` - the argument expressions to evaluate * `parameters` - the declared parameters of the target method
    `` | `protected boolean` | `makeCachedCall(Expression origin, ClassExpression sender, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis, boolean containsSpreadExpression)` * Attempts to emit a call-site-cached invocation (or invokedynamic). * Returns `false` if the call cannot be cached, causing the caller to * fall through to the uncached path. * * Parameters: `origin` - the original call expression * `sender` - the class from which the call is dispatched * `receiver` - the receiver expression * `message` - the method name expression * `arguments` - the arguments expression * `adapter` - the method caller adapter * `safe` - whether to use safe navigation * `spreadSafe` - whether to use spread-safe navigation * `implicitThis` - whether the receiver is implicit `this` * `containsSpreadExpression` - whether any argument uses spread * Returns: `true` if a cached call was emitted
    `` | `public void` | `makeCall(Expression origin, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis)` * Generates bytecode for a method call. * * Parameters: `origin` - the original expression * `receiver` - the receiver expression * `message` - the method name expression * `arguments` - the arguments expression * `adapter` - the method caller adapter * `safe` - whether to use safe navigation * `spreadSafe` - whether to use spread-safe navigation * `implicitThis` - whether the receiver is implicit 'this'
    `` | `protected boolean` | `tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis, TupleExpression args)` Attempts to make a direct method call on a bridge method, if it exists.
    `` | `protected boolean` | `tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis, TupleExpression args, ClassNode thisClass)` Attempts to make a direct method call on a bridge method, if it exists.
    `` | `protected boolean` | `writeDirectMethodCall(MethodNode target, boolean implicitThis, Expression receiver, TupleExpression args)` * Emits a direct (INVOKE*) bytecode call to `target` when static type * information is available. Returns `false` if a direct call cannot be made. * * Parameters: `target` - the resolved method node to call directly * `implicitThis` - whether the receiver is implicit `this` * `receiver` - the receiver expression (may be `null`) * `args` - the argument tuple * Returns: `true` if the call was emitted, `false` otherwise
    `` | `public void` | `writeInvokeConstructor(ConstructorCallExpression call)` * Generates bytecode for a constructor call expression, choosing the * appropriate strategy (direct, AIC, or normal call-site). * * Parameters: `call` - the constructor call expression to compile
    `` | `public void` | `writeSpecialConstructorCall(ConstructorCallExpression call)` * Generates bytecode for a `this()` or `super()` constructor * call at the start of a constructor body. * * Parameters: `call` - the constructor call expression representing `this()` or `super()`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class InvocationWriter` | `castNonPrimitiveToBool, castToNonPrimitiveIfNecessary, coerce, finnishConstructorCall, getMethodName, loadArguments, makeArgumentList, makeCachedCall, makeCall, makeCall, makeClassForNameCall, makeDirectCall, makeSingleArgumentCall, makeSingleArgumentCall, makeUncachedCall, prepareConstructorCall, writeAICCall, writeDirectMethodCall, writeInvokeConstructor, writeInvokeMethod, writeInvokeStaticMethod, writeNormalConstructorCall, writeSpecialConstructorCall`

- - ### Constructor Detail

    - #### public StaticInvocationWriter(WriterController wc)

      Creates an invocation writer that favors direct bytecode calls over dynamic dispatch.

  - ### Method Detail

    - #### @Deprecated(since = "6.0.0")
      protected static boolean isPrivateBridgeMethodsCallAllowed(ClassNode receiver, ClassNode caller)

      deprecated:
        Use bridge metadata on the declaring class instead of probing outer-class nesting manually.

    - #### protected void loadArguments(List<Expression> argumentList, Parameter[] parameters)

      * Evaluates and loads each argument expression, handling varargs packing. * *

      Parameters:
        `arguments` - the argument expressions to evaluate *
        `parameters` - the declared parameters of the target method

    - #### protected boolean makeCachedCall(Expression origin, ClassExpression sender, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis, boolean containsSpreadExpression)

      * Attempts to emit a call-site-cached invocation (or invokedynamic). * Returns `false` if the call cannot be cached, causing the caller to * fall through to the uncached path. * *

      Parameters:
        `origin` - the original call expression *
        `sender` - the class from which the call is dispatched *
        `receiver` - the receiver expression *
        `message` - the method name expression *
        `arguments` - the arguments expression *
        `adapter` - the method caller adapter *
        `safe` - whether to use safe navigation *
        `spreadSafe` - whether to use spread-safe navigation *
        `implicitThis` - whether the receiver is implicit `this` *
        `containsSpreadExpression` - whether any argument uses spread *
      Returns:
        `true` if a cached call was emitted

    - #### public void makeCall(Expression origin, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis)

      * Generates bytecode for a method call. * *

      Parameters:
        `origin` - the original expression *
        `receiver` - the receiver expression *
        `message` - the method name expression *
        `arguments` - the arguments expression *
        `adapter` - the method caller adapter *
        `safe` - whether to use safe navigation *
        `spreadSafe` - whether to use spread-safe navigation *
        `implicitThis` - whether the receiver is implicit 'this'

    - #### @Deprecated
      protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis, TupleExpression args)

      Attempts to make a direct method call on a bridge method, if it exists.

    - #### protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis, TupleExpression args, ClassNode thisClass)

      Attempts to make a direct method call on a bridge method, if it exists.

    - #### protected boolean writeDirectMethodCall(MethodNode target, boolean implicitThis, Expression receiver, TupleExpression args)

      * Emits a direct (INVOKE*) bytecode call to `target` when static type * information is available. Returns `false` if a direct call cannot be made. * *

      Parameters:
        `target` - the resolved method node to call directly *
        `implicitThis` - whether the receiver is implicit `this` *
        `receiver` - the receiver expression (may be `null`) *
        `args` - the argument tuple *
      Returns:
        `true` if the call was emitted, `false` otherwise

    - #### public void writeInvokeConstructor(ConstructorCallExpression call)

      * Generates bytecode for a constructor call expression, choosing the * appropriate strategy (direct, AIC, or normal call-site). * *

      Parameters:
        `call` - the constructor call expression to compile

    - #### public void writeSpecialConstructorCall(ConstructorCallExpression call)

      * Generates bytecode for a `this()` or `super()` constructor * call at the start of a constructor body. * *

      Parameters:
        `call` - the constructor call expression representing `this()` or `super()`