Class InvokeDynamicInstruction


  • public class InvokeDynamicInstruction
    extends Instruction
    Represents the INVOKEDYNAMIC instruction (0xBA).
    • Constructor Detail

      • InvokeDynamicInstruction

        public InvokeDynamicInstruction​(ConstPool constPool,
                                        int opcode,
                                        int offset,
                                        int cpIndex)
        Constructs an InvokeDynamicInstruction.
        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 to CONSTANT_InvokeDynamic_info.
    • Method Detail

      • getCpIndex

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

        public int getBootstrapMethodAttrIndex()
        Gets the bootstrap method attribute index from the InvokeDynamicItem.
        Returns:
        The bootstrap method attribute index, or -1 if invalid.
      • getNameAndTypeIndex

        public int getNameAndTypeIndex()
        Gets the name and type index from the InvokeDynamicItem.
        Returns:
        The name and type index, or -1 if invalid.
      • write

        public void write​(DataOutputStream dos)
                   throws IOException
        Writes the INVOKEDYNAMIC opcode and its operands 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 invokedynamic method.
        Returns:
        The invokedynamic method as a string.
      • toString

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