Class InvokeSpecialInstruction

  • All Implemented Interfaces:
    InvokeInsn

    public class InvokeSpecialInstruction
    extends Instruction
    implements InvokeInsn
    Represents the INVOKESPECIAL instruction (0xB7).
    • Constructor Detail

      • InvokeSpecialInstruction

        public InvokeSpecialInstruction​(ConstPool constPool,
                                        int opcode,
                                        int offset,
                                        int methodIndex)
        Constructs an InvokeSpecialInstruction.
        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 INVOKESPECIAL 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.
      • getMethodName

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

        public String getOwnerName()
        Returns the class name that owns the method (with dots).
        Returns:
        The owner class 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 internal name.
        Specified by:
        getOwnerClass in interface InvokeInsn
        Returns:
        The owner class internal name.
      • toString

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