Class MethodInvokeUtils
- java.lang.Object
-
- com.offbynull.coroutines.instrumenter.asm.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.
-
-
-
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 isnull
java.lang.IllegalArgumentException
- ifinvokeNode
is neither of typeMethodInsnNode
norInvokeDynamicInsnNode
, 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 isnull
java.lang.IllegalArgumentException
- ifinvokeNode
is neither of typeMethodInsnNode
norInvokeDynamicInsnNode
, or if type of invocation (MethodInsnNode
) cannot be determined
-
-