Package org.codehaus.groovy.classgen.asm

## Class InvocationWriter

- java.lang.Object
- - org.codehaus.groovy.classgen.asm.InvocationWriter

- Direct Known Subclasses:
    `InvokeDynamicWriter`, `StaticInvocationWriter`

      public class InvocationWriter
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static MethodCaller` | `castToVargsArray` |
    `static MethodCaller` | `invokeClosureMethod` |
    `static MethodCallerMultiAdapter` | `invokeMethod` |
    `static MethodCallerMultiAdapter` | `invokeMethodOnCurrent` |
    `static MethodCallerMultiAdapter` | `invokeMethodOnSuper` |
    `static MethodCallerMultiAdapter` | `invokeStaticMethod` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `InvocationWriter​(WriterController wc)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `castNonPrimitiveToBool​(ClassNode last)` |
    `void` | `castToNonPrimitiveIfNecessary​(ClassNode sourceType, ClassNode targetType)` | This converts sourceType to a non primitive by using Groovy casting.
    `void` | `coerce​(ClassNode from, ClassNode target)` |
    `protected void` | `finnishConstructorCall​(ConstructorNode cn, String ownerDescriptor, int argsToRemove)` |
    `protected String` | `getMethodName​(Expression message)` |
    `protected void` | `loadArguments​(List<Expression> argumentList, Parameter[] para)` |
    `static ArgumentListExpression` | `makeArgumentList​(Expression arguments)` |
    `protected boolean` | `makeCachedCall​(Expression origin, ClassExpression sender, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis, boolean containsSpreadExpression)` |
    `protected void` | `makeCall​(Expression origin, ClassExpression sender, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis)` |
    `void` | `makeCall​(Expression origin, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis)` |
    `protected boolean` | `makeClassForNameCall​(Expression origin, Expression receiver, Expression message, Expression arguments)` | if Class.forName(x) is recognized, make a direct method call
    `protected boolean` | `makeDirectCall​(Expression origin, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean implicitThis, boolean containsSpreadExpression)` |
    `void` | `makeSingleArgumentCall​(Expression receiver, String message, Expression arguments)` |
    `protected void` | `makeUncachedCall​(Expression origin, ClassExpression sender, Expression receiver, Expression message, Expression arguments, MethodCallerMultiAdapter adapter, boolean safe, boolean spreadSafe, boolean implicitThis, boolean containsSpreadExpression)` |
    `protected String` | `prepareConstructorCall​(ConstructorNode cn)` |
    `protected boolean` | `writeAICCall​(ConstructorCallExpression call)` |
    `protected boolean` | `writeDirectMethodCall​(MethodNode target, boolean implicitThis, Expression receiver, TupleExpression args)` |
    `void` | `writeInvokeConstructor​(ConstructorCallExpression call)` |
    `void` | `writeInvokeMethod​(MethodCallExpression call)` |
    `void` | `writeInvokeStaticMethod​(StaticMethodCallExpression call)` |
    `protected void` | `writeNormalConstructorCall​(ConstructorCallExpression call)` |
    `void` | `writeSpecialConstructorCall​(ConstructorCallExpression call)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### invokeMethodOnCurrent

          public static final MethodCallerMultiAdapter invokeMethodOnCurrent

    - #### invokeMethodOnSuper

          public static final MethodCallerMultiAdapter invokeMethodOnSuper

    - #### invokeMethod

          public static final MethodCallerMultiAdapter invokeMethod

    - #### invokeStaticMethod

          public static final MethodCallerMultiAdapter invokeStaticMethod

    - #### invokeClosureMethod

          public static final MethodCaller invokeClosureMethod

    - #### castToVargsArray

          public static final MethodCaller castToVargsArray

  - ### Constructor Detail

    - #### InvocationWriter

          public InvocationWriter​(WriterController wc)

  - ### Method Detail

    - #### makeCall

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

    - #### writeDirectMethodCall

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

    - #### loadArguments

          protected void loadArguments​(List<Expression> argumentList,
                                       Parameter[] para)

    - #### makeDirectCall

          protected boolean makeDirectCall​(Expression origin,
                                           Expression receiver,
                                           Expression message,
                                           Expression arguments,
                                           MethodCallerMultiAdapter adapter,
                                           boolean implicitThis,
                                           boolean containsSpreadExpression)

    - #### makeCachedCall

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

    - #### makeUncachedCall

          protected void makeUncachedCall​(Expression origin,
                                          ClassExpression sender,
                                          Expression receiver,
                                          Expression message,
                                          Expression arguments,
                                          MethodCallerMultiAdapter adapter,
                                          boolean safe,
                                          boolean spreadSafe,
                                          boolean implicitThis,
                                          boolean containsSpreadExpression)

    - #### makeCall

          protected void makeCall​(Expression origin,
                                  ClassExpression sender,
                                  Expression receiver,
                                  Expression message,
                                  Expression arguments,
                                  MethodCallerMultiAdapter adapter,
                                  boolean safe,
                                  boolean spreadSafe,
                                  boolean implicitThis)

    - #### makeClassForNameCall

          protected boolean makeClassForNameCall​(Expression origin,
                                                 Expression receiver,
                                                 Expression message,
                                                 Expression arguments)

      if Class.forName(x) is recognized, make a direct method call

    - #### makeArgumentList

          public static ArgumentListExpression makeArgumentList​(Expression arguments)

    - #### getMethodName

          protected String getMethodName​(Expression message)

    - #### writeInvokeMethod

          public void writeInvokeMethod​(MethodCallExpression call)

    - #### writeInvokeStaticMethod

          public void writeInvokeStaticMethod​(StaticMethodCallExpression call)

    - #### prepareConstructorCall

          protected String prepareConstructorCall​(ConstructorNode cn)

    - #### finnishConstructorCall

          protected void finnishConstructorCall​(ConstructorNode cn,
                                                String ownerDescriptor,
                                                int argsToRemove)

    - #### writeNormalConstructorCall

          protected void writeNormalConstructorCall​(ConstructorCallExpression call)

    - #### writeInvokeConstructor

          public void writeInvokeConstructor​(ConstructorCallExpression call)

    - #### writeAICCall

          protected boolean writeAICCall​(ConstructorCallExpression call)

    - #### makeSingleArgumentCall

          public void makeSingleArgumentCall​(Expression receiver,
                                             String message,
                                             Expression arguments)

    - #### writeSpecialConstructorCall

          public void writeSpecialConstructorCall​(ConstructorCallExpression call)

    - #### castToNonPrimitiveIfNecessary

          public void castToNonPrimitiveIfNecessary​(ClassNode sourceType,
                                                    ClassNode targetType)

      This converts sourceType to a non primitive by using Groovy casting. sourceType might be a primitive This might be done using SBA#castToType

    - #### castNonPrimitiveToBool

          public void castNonPrimitiveToBool​(ClassNode last)

    - #### coerce

          public void coerce​(ClassNode from,
                             ClassNode target)