Package com.tonic.analysis.instruction
Class ANewArrayInstruction
- java.lang.Object
-
- com.tonic.analysis.instruction.Instruction
-
- com.tonic.analysis.instruction.ANewArrayInstruction
-
public class ANewArrayInstruction extends Instruction
Represents the ANEWARRAY instruction (0xBD).
-
-
Constructor Summary
Constructors Constructor Description ANewArrayInstruction(ConstPool constPool, int opcode, int offset, int classIndex, int count)Constructs an ANewArrayInstruction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(AbstractBytecodeVisitor visitor)Accepts a visitor for bytecode analysis.intgetClassIndex()Returns the class index used by this instruction.intgetCount()Returns the count of array elements.intgetLocalChange()Returns the change in local variables caused by this instruction.intgetStackChange()Returns the change in stack size caused by this instruction.StringresolveClass()Resolves and returns a string representation of the class.StringtoString()Returns a string representation of the instruction.voidwrite(DataOutputStream dos)Writes the ANEWARRAY opcode and its operand to the DataOutputStream.-
Methods inherited from class com.tonic.analysis.instruction.Instruction
getLength, getOffset, getOpcode, setOffset
-
-
-
-
Constructor Detail
-
ANewArrayInstruction
public ANewArrayInstruction(ConstPool constPool, int opcode, int offset, int classIndex, int count)
Constructs an ANewArrayInstruction.- Parameters:
constPool- The constant pool associated with the class.opcode- The opcode of the instruction.offset- The bytecode offset of the instruction.classIndex- The constant pool index for the class reference.count- The array element count carried by this instruction.
-
-
Method Detail
-
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 ANEWARRAY opcode and its operand 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: pops the element count and pushes the array reference (net 0).
-
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).
-
getClassIndex
public int getClassIndex()
Returns the class index used by this instruction.- Returns:
- The constant pool index for the class reference.
-
getCount
public int getCount()
Returns the count of array elements.- Returns:
- The number of elements in the array.
-
resolveClass
public String resolveClass()
Resolves and returns a string representation of the class.- Returns:
- The class as a string.
-
toString
public String toString()
Returns a string representation of the instruction.- Overrides:
toStringin classInstruction- Returns:
- The mnemonic, class index, and resolved class.
-
-