Class MethodInvokeUtils


  • public final class MethodInvokeUtils
    extends java.lang.Object
    Utility class to help with handling invocation instructions.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MethodInvokeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getArgumentCountRequiredForInvocation​(org.objectweb.asm.tree.AbstractInsnNode invokeNode)
      Get the number of arguments required for an invocation of some method.
      static org.objectweb.asm.Type getReturnTypeOfInvocation​(org.objectweb.asm.tree.AbstractInsnNode invokeNode)
      Get the return type of the method being invoked.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MethodInvokeUtils

        private MethodInvokeUtils()
    • Method Detail

      • getArgumentCountRequiredForInvocation

        public static int getArgumentCountRequiredForInvocation​(org.objectweb.asm.tree.AbstractInsnNode invokeNode)
        Get the number of arguments required for an invocation of some method. This includes the 'this' argument for non-static methods.

        NOTE THAT THIS IS NOT THE NUMBER OF ITEMS ON THE STACK. If the method takes in doubles or longs, each double or long encountered would be 2 items on the stack. This method returns the number of arguments required for the method to be invoked, not the number of items required to be on the stack for the method to be invoked.

        Parameters:
        invokeNode - the invocation instruction (either normal invocation or invokedynamic)
        Returns:
        number of arguments required by this method
        Throws:
        java.lang.NullPointerException - if any argument is null
        java.lang.IllegalArgumentException - if invokeNode is neither of type MethodInsnNode nor InvokeDynamicInsnNode, or if type of invocation (MethodInsnNode) cannot be determined
      • getReturnTypeOfInvocation

        public static org.objectweb.asm.Type getReturnTypeOfInvocation​(org.objectweb.asm.tree.AbstractInsnNode invokeNode)
        Get the return type of the method being invoked.
        Parameters:
        invokeNode - the invocation instruction (either normal invocation or invokedynamic)
        Returns:
        number of items required on the stack for this method
        Throws:
        java.lang.NullPointerException - if any argument is null
        java.lang.IllegalArgumentException - if invokeNode is neither of type MethodInsnNode nor InvokeDynamicInsnNode, or if type of invocation (MethodInsnNode) cannot be determined