Package org.apache.bcel.generic
Class LocalVariableInstruction
java.lang.Object
org.apache.bcel.generic.Instruction
org.apache.bcel.generic.LocalVariableInstruction
- All Implemented Interfaces:
Serializable
,Cloneable
,IndexedInstruction
,TypedInstruction
- Direct Known Subclasses:
IINC
,LoadInstruction
,StoreInstruction
public abstract class LocalVariableInstruction
extends Instruction
implements TypedInstruction, IndexedInstruction
Abstract super class for instructions dealing with local variables.
- See Also:
-
Field Summary
FieldsFields inherited from class org.apache.bcel.generic.Instruction
length, opcode
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
LocalVariableInstruction
(short opcode, short c_tag, int n) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dump
(DataOutputStream out) Dump instruction as byte code to stream out.short
final int
getIndex()
Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned.protected void
initFromFile
(ByteSequence bytes, boolean wide) Read needed data (e.g.void
setIndex
(int n) Set the local variable indextoString
(boolean verbose) Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< local variable index>">"Methods inherited from class org.apache.bcel.generic.Instruction
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, hashCode, produceStack, readInstruction, setComparator, toString, toString
-
Field Details
-
n
protected int n
-
-
Constructor Details
-
LocalVariableInstruction
protected LocalVariableInstruction(short opcode, short c_tag, int n) - Parameters:
opcode
- Instruction opcodec_tag
- Instruction number for compact version, ALOAD_0, e.g.n
- local variable index (unsigned short)
-
-
Method Details
-
dump
Dump instruction as byte code to stream out.- Overrides:
dump
in classInstruction
- Parameters:
out
- Output stream- Throws:
IOException
-
toString
Long output format: <name of opcode> "["<opcode number>"]" "("<length of instruction>")" "<"< local variable index>">"- Overrides:
toString
in classInstruction
- Parameters:
verbose
- long/short format switch- Returns:
- mnemonic for instruction
-
initFromFile
Read needed data (e.g. index) from file. PRE: (ILOAD invalid input: '<'= tag invalid input: '<'= ALOAD_3) || (ISTORE invalid input: '<'= tag invalid input: '<'= ASTORE_3)- Overrides:
initFromFile
in classInstruction
- Parameters:
bytes
- byte sequence to read fromwide
- "wide" instruction flag- Throws:
IOException
- may be thrown if the implementation needs to read data from the file
-
getIndex
public final int getIndex()- Specified by:
getIndex
in interfaceIndexedInstruction
- Returns:
- local variable index referred by this instruction.
-
setIndex
public void setIndex(int n) Set the local variable index- Specified by:
setIndex
in interfaceIndexedInstruction
-
getCanonicalTag
public short getCanonicalTag()- Returns:
- canonical tag for instruction, e.g., ALOAD for ALOAD_0
-
getType
Returns the type associated with the instruction - in case of ALOAD or ASTORE Type.OBJECT is returned. This is just a bit incorrect, because ALOAD and ASTORE may work on every ReferenceType (including Type.NULL) and ASTORE may even work on a ReturnaddressType .- Specified by:
getType
in interfaceTypedInstruction
- Returns:
- type associated with the instruction
-