Package org.apache.bcel.classfile
Class StackMapType
java.lang.Object
org.apache.bcel.classfile.StackMapType
This class represents the type of a local variable or item on stack used in the StackMap entries.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ConstantPoolstatic final StackMapType[]Empty array constant.private intprivate byte -
Constructor Summary
ConstructorsConstructorDescriptionStackMapType(byte type, int index, ConstantPool constantPool) Constructs a StackMapType.StackMapType(DataInput file, ConstantPool constantPool) Constructs object from file stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.private bytecheckType(byte type) copy()Creates a deep copy of this object.voiddump(DataOutputStream file) Dumps type entries to file.Gets the class name of this StackMapType from the constant pool at index position.Gets the constant pool.intgetIndex()Gets the index.bytegetType()Gets the type.booleanhasIndex()Checks if this type has an index.private StringvoidsetConstantPool(ConstantPool constantPool) Sets the constant pool.voidsetIndex(int index) Sets the index.voidsetType(byte type) Sets the type.toString()
-
Field Details
-
EMPTY_ARRAY
Empty array constant. -
type
private byte type -
index
private int index -
constantPool
-
-
Constructor Details
-
StackMapType
Constructs a StackMapType.- Parameters:
type- type tag as defined in the Constants interface.index- index to constant pool, or byte code offset.constantPool- The constant pool.
-
StackMapType
StackMapType(DataInput file, ConstantPool constantPool) throws IOException Constructs object from file stream.- Parameters:
file- Input stream.constantPool- The constant pool.- Throws:
IOException- Thrown if an I/O error occurs.
-
-
Method Details
-
accept
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects. -
checkType
private byte checkType(byte type) -
copy
Creates a deep copy of this object.- Returns:
- deep copy of this object.
-
dump
Dumps type entries to file.- Parameters:
file- Output file stream.- Throws:
IOException- Thrown if an I/O error occurs.
-
getClassName
Gets the class name of this StackMapType from the constant pool at index position.- Returns:
- The fully qualified name of the class for this StackMapType.
- Since:
- 6.8.0
-
getConstantPool
Gets the constant pool.- Returns:
- Constant pool used by this object.
-
getIndex
public int getIndex()Gets the index.- Returns:
- index to constant pool if type == ITEM_Object, or offset in byte code, if type == ITEM_NewObject, and -1 otherwise.
-
getType
public byte getType()Gets the type.- Returns:
- The type.
-
hasIndex
public boolean hasIndex()Checks if this type has an index.- Returns:
- true, if type is either ITEM_Object or ITEM_NewObject.
-
printIndex
-
setConstantPool
Sets the constant pool.- Parameters:
constantPool- Constant pool to be used for this object.
-
setIndex
public void setIndex(int index) Sets the index.- Parameters:
index- The index.
-
setType
public void setType(byte type) Sets the type.- Parameters:
type- The type.
-
toString
-