Class InvokeVirtualInstruction

  • All Implemented Interfaces:
    InvokeInsn

    public class InvokeVirtualInstruction
    extends Instruction
    implements InvokeInsn
    Represents the INVOKEVIRTUAL instruction (0xB6).
    • Constructor Detail

      • InvokeVirtualInstruction

        public InvokeVirtualInstruction​(ConstPool constPool,
                                        int opcode,
                                        int offset,
                                        int methodIndex)
        Constructs an InvokeVirtualInstruction.
        Parameters:
        constPool - The constant pool associated with the class.
        opcode - The opcode of the instruction.
        offset - The bytecode offset of the instruction.
        methodIndex - The constant pool index for the method reference.
    • Method Detail

      • getMethodIndex

        public int getMethodIndex()
        Returns:
        the method index
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the INVOKEVIRTUAL opcode and its operand to the DataOutputStream.
        Specified by:
        write in class Instruction
        Parameters:
        dos - The DataOutputStream to write to.
        Throws:
        IOException - If an I/O error occurs.
      • getStackChange

        public int getStackChange()
        Returns the change in stack size caused by this instruction.
        Specified by:
        getStackChange in class Instruction
        Returns:
        The stack size change (depends on method signature).
      • getLocalChange

        public int getLocalChange()
        Returns the change in local variables caused by this instruction.
        Specified by:
        getLocalChange in class Instruction
        Returns:
        The local variables size change (none).
      • resolveMethod

        public String resolveMethod()
        Resolves and returns a string representation of the method.
        Returns:
        The method as a string.
      • toString

        public String toString()
        Returns a string representation of the instruction.
        Overrides:
        toString in class Instruction
        Returns:
        The mnemonic, method index, and resolved method.
      • getMethodName

        public String getMethodName()
        Returns the method name.
        Specified by:
        getMethodName in interface InvokeInsn
        Returns:
        The method name.
      • getMethodDescriptor

        public String getMethodDescriptor()
        Returns the method descriptor.
        Specified by:
        getMethodDescriptor in interface InvokeInsn
        Returns:
        The method descriptor.
      • getOwnerClass

        public String getOwnerClass()
        Returns the owner class name.
        Specified by:
        getOwnerClass in interface InvokeInsn
        Returns:
        The owner class internal name.