Package com.tonic.analysis.instruction
Class InvokeDynamicInstruction
- java.lang.Object
-
- com.tonic.analysis.instruction.Instruction
-
- com.tonic.analysis.instruction.InvokeDynamicInstruction
-
public class InvokeDynamicInstruction extends Instruction
Represents the INVOKEDYNAMIC instruction (0xBA).
-
-
Constructor Summary
Constructors Constructor Description InvokeDynamicInstruction(ConstPool constPool, int opcode, int offset, int cpIndex)Constructs an InvokeDynamicInstruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(AbstractBytecodeVisitor visitor)Accepts a visitor for bytecode analysis.intgetBootstrapMethodAttrIndex()Gets the bootstrap method attribute index from the InvokeDynamicItem.intgetCpIndex()intgetLocalChange()Returns the change in local variables caused by this instruction.intgetNameAndTypeIndex()Gets the name and type index from the InvokeDynamicItem.intgetStackChange()Returns the change in stack size caused by this instruction.StringresolveMethod()Resolves and returns a string representation of the invokedynamic method.StringtoString()Returns a string representation of the instruction.voidwrite(DataOutputStream dos)Writes the INVOKEDYNAMIC opcode and its operands to the DataOutputStream.-
Methods inherited from class com.tonic.analysis.instruction.Instruction
getLength, getOffset, getOpcode, setOffset
-
-
-
-
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.
-
accept
public void accept(AbstractBytecodeVisitor visitor)
Description copied from class:InstructionAccepts a visitor for bytecode analysis.- Specified by:
acceptin classInstruction- Parameters:
visitor- The visitor to accept.
-
write
public void write(DataOutputStream dos) throws IOException
Writes the INVOKEDYNAMIC opcode and its operands to the DataOutputStream.- Specified by:
writein classInstruction- 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:
getStackChangein classInstruction- 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:
getLocalChangein classInstruction- 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:
toStringin classInstruction- Returns:
- The mnemonic, CP index, and resolved method.
-
-