Class MethodInsnNode

java.lang.Object
org.objectweb.asm.tree.AbstractInsnNode
org.objectweb.asm.tree.MethodInsnNode

public class MethodInsnNode extends AbstractInsnNode
A node that represents a method instruction. A method instruction is an instruction that invokes a method.
  • Field Details

    • owner

      public String owner
      The internal name of the method's owner class (see Type.getInternalName()).

      For methods of arrays, e.g., clone(), the array type descriptor.

    • name

      public String name
      The method's name.
    • desc

      public String desc
      The method's descriptor (see Type).
    • itf

      public boolean itf
      Whether the method's owner class if an interface.
  • Constructor Details

    • MethodInsnNode

      public MethodInsnNode(int opcode, String owner, String name, String descriptor)
      Constructs a new MethodInsnNode.
      Parameters:
      opcode - the opcode of the type instruction to be constructed. This opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
      owner - the internal name of the method's owner class (see Type.getInternalName()).
      name - the method's name.
      descriptor - the method's descriptor (see Type).
    • MethodInsnNode

      public MethodInsnNode(int opcode, String owner, String name, String descriptor, boolean isInterface)
      Constructs a new MethodInsnNode.
      Parameters:
      opcode - the opcode of the type instruction to be constructed. This opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
      owner - the internal name of the method's owner class (see Type.getInternalName()).
      name - the method's name.
      descriptor - the method's descriptor (see Type).
      isInterface - if the method's owner class is an interface.
  • Method Details

    • setOpcode

      public void setOpcode(int opcode)
      Sets the opcode of this instruction.
      Parameters:
      opcode - the new instruction opcode. This opcode must be INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.
    • getType

      public int getType()
      Description copied from class: AbstractInsnNode
      Returns the type of this instruction.
      Specified by:
      getType in class AbstractInsnNode
      Returns:
      the type of this instruction, i.e. one the constants defined in this class.
    • accept

      public void accept(MethodVisitor methodVisitor)
      Description copied from class: AbstractInsnNode
      Makes the given method visitor visit this instruction.
      Specified by:
      accept in class AbstractInsnNode
      Parameters:
      methodVisitor - a method visitor.
    • clone

      public AbstractInsnNode clone(Map<LabelNode,LabelNode> clonedLabels)
      Description copied from class: AbstractInsnNode
      Returns a copy of this instruction.
      Specified by:
      clone in class AbstractInsnNode
      Parameters:
      clonedLabels - a map from LabelNodes to cloned LabelNodes.
      Returns:
      a copy of this instruction. The returned instruction does not belong to any InsnList.