public class MethodInliner
extends java.lang.Object
| Constructor and Description |
|---|
MethodInliner() |
| Modifier and Type | Method and Description |
|---|---|
static void |
wrappedInline(org.objectweb.asm.tree.ClassNode classNode,
org.objectweb.asm.tree.MethodNode inlinedMethod,
java.lang.String inlinedMethodOwner)
Inline a method into all methods of a class.
The inlined method does not need to be in the class in which it is inlined, but it will be removed from the class if it is. All return instructions in the method are replaced with a jump to the end of the inlined method. The ASM analyzer is used to store the stack in local variables to avoid any stack issues. All parameters of the inlined method are stored in local variables and then used in the inlined method. The return type will be loaded onto the stack once the old stack (minus the parameters and owner) is restored. Because of this, direct modifications of the parameters are not supported (the behavior of the inlined method will not change). The try-catch blocks, local variables and exceptions of the inlined method are merged with the method in which it is inlined. It is required to recalculate all stack map frames after inlining a method. |
public static void wrappedInline(org.objectweb.asm.tree.ClassNode classNode,
org.objectweb.asm.tree.MethodNode inlinedMethod,
java.lang.String inlinedMethodOwner)
classNode - The class with the methods to inline intoinlinedMethod - The method to inlineinlinedMethodOwner - The owner of the method to inline