Class Ldc2WInstruction


  • public class Ldc2WInstruction
    extends Instruction
    Represents the LDC2_W instruction (0x14).
    • Constructor Detail

      • Ldc2WInstruction

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

      • getCpIndex

        public int getCpIndex()
        Returns:
        the cp index
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the LDC2_W 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 (pushes a double or long).
      • 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).
      • getConstantType

        public LdcInstruction.ConstantType getConstantType()
        Classifies the referenced constant-pool entry.
        Returns:
        LONG, DOUBLE, or DYNAMIC per the pool entry; UNKNOWN otherwise
      • getConstPool

        public ConstPool getConstPool()
        Returns:
        the const pool
      • resolveConstant

        public String resolveConstant()
        Renders the referenced constant as display text.
        Returns:
        the long (with L suffix), double, or dynamic-constant description; "UnknownConstant" otherwise
      • toString

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