Package org.apache.bcel.classfile
Class StackMapEntry
- java.lang.Object
-
- org.apache.bcel.classfile.StackMapEntry
-
- All Implemented Interfaces:
java.lang.Cloneable
,Node
public final class StackMapEntry extends java.lang.Object implements Node, java.lang.Cloneable
This class represents a stack map entry recording the types of local variables and the of stack items at a given byte code offset. See CLDC specification 5.3.1.2. See also https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.4union stack_map_frame { same_frame; same_locals_1_stack_item_frame; same_locals_1_stack_item_frame_extended; chop_frame; same_frame_extended; append_frame; full_frame; }
- See Also:
StackMap
,StackMapType
-
-
Field Summary
Fields Modifier and Type Field Description private int
byteCodeOffset
private ConstantPool
constantPool
(package private) static StackMapEntry[]
EMPTY_ARRAY
private int
frameType
private StackMapType[]
typesOfLocals
private StackMapType[]
typesOfStackItems
-
Constructor Summary
Constructors Constructor Description StackMapEntry(int byteCodeOffset, int numberOfLocals, StackMapType[] typesOfLocals, int numberOfStackItems, StackMapType[] typesOfStackItems, ConstantPool constantPool)
Deprecated.Since 6.0, useStackMapEntry(int, int, StackMapType[], StackMapType[], ConstantPool)
insteadStackMapEntry(int tag, int byteCodeOffset, StackMapType[] typesOfLocals, StackMapType[] typesOfStackItems, ConstantPool constantPool)
Create an instanceStackMapEntry(java.io.DataInput dataInput, ConstantPool constantPool)
Construct object from input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.StackMapEntry
copy()
void
dump(java.io.DataOutputStream file)
Dump stack map entryint
getByteCodeOffset()
ConstantPool
getConstantPool()
int
getFrameType()
(package private) int
getMapEntrySize()
Calculate stack map entry sizeint
getNumberOfLocals()
int
getNumberOfStackItems()
StackMapType[]
getTypesOfLocals()
StackMapType[]
getTypesOfStackItems()
private boolean
invalidFrameType(int f)
void
setByteCodeOffset(int newOffset)
void
setConstantPool(ConstantPool constantPool)
void
setFrameType(int ft)
void
setNumberOfLocals(int n)
Deprecated.since 6.0void
setNumberOfStackItems(int n)
Deprecated.since 6.0void
setTypesOfLocals(StackMapType[] types)
void
setTypesOfStackItems(StackMapType[] types)
java.lang.String
toString()
void
updateByteCodeOffset(int delta)
Update the distance (as an offset delta) from this StackMap entry to the next.
-
-
-
Field Detail
-
EMPTY_ARRAY
static final StackMapEntry[] EMPTY_ARRAY
-
frameType
private int frameType
-
byteCodeOffset
private int byteCodeOffset
-
typesOfLocals
private StackMapType[] typesOfLocals
-
typesOfStackItems
private StackMapType[] typesOfStackItems
-
constantPool
private ConstantPool constantPool
-
-
Constructor Detail
-
StackMapEntry
StackMapEntry(java.io.DataInput dataInput, ConstantPool constantPool) throws java.io.IOException
Construct object from input stream.- Parameters:
dataInput
- Input stream- Throws:
java.io.IOException
- if an I/O error occurs.
-
StackMapEntry
@Deprecated public StackMapEntry(int byteCodeOffset, int numberOfLocals, StackMapType[] typesOfLocals, int numberOfStackItems, StackMapType[] typesOfStackItems, ConstantPool constantPool)
Deprecated.Since 6.0, useStackMapEntry(int, int, StackMapType[], StackMapType[], ConstantPool)
insteadDO NOT USE- Parameters:
byteCodeOffset
-numberOfLocals
- NOT USEDtypesOfLocals
- array ofStackMapType
s of localsnumberOfStackItems
- NOT USEDtypesOfStackItems
- array otStackMapType
s of stack itemsconstantPool
- the constant pool
-
StackMapEntry
public StackMapEntry(int tag, int byteCodeOffset, StackMapType[] typesOfLocals, StackMapType[] typesOfStackItems, ConstantPool constantPool)
Create an instance- Parameters:
tag
- the frameType to usebyteCodeOffset
-typesOfLocals
- array ofStackMapType
s of localstypesOfStackItems
- array otStackMapType
s of stack itemsconstantPool
- the constant pool
-
-
Method Detail
-
accept
public void accept(Visitor v)
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.
-
copy
public StackMapEntry copy()
- Returns:
- deep copy of this object
-
dump
public void dump(java.io.DataOutputStream file) throws java.io.IOException
Dump stack map entry- Parameters:
file
- Output file stream- Throws:
java.io.IOException
- if an I/O error occurs.
-
getByteCodeOffset
public int getByteCodeOffset()
-
getConstantPool
public ConstantPool getConstantPool()
- Returns:
- Constant pool used by this object.
-
getFrameType
public int getFrameType()
-
getMapEntrySize
int getMapEntrySize()
Calculate stack map entry size
-
getNumberOfLocals
public int getNumberOfLocals()
-
getNumberOfStackItems
public int getNumberOfStackItems()
-
getTypesOfLocals
public StackMapType[] getTypesOfLocals()
-
getTypesOfStackItems
public StackMapType[] getTypesOfStackItems()
-
invalidFrameType
private boolean invalidFrameType(int f)
-
setByteCodeOffset
public void setByteCodeOffset(int newOffset)
-
setConstantPool
public void setConstantPool(ConstantPool constantPool)
- Parameters:
constantPool
- Constant pool to be used for this object.
-
setFrameType
public void setFrameType(int ft)
-
setNumberOfLocals
@Deprecated public void setNumberOfLocals(int n)
Deprecated.since 6.0
-
setNumberOfStackItems
@Deprecated public void setNumberOfStackItems(int n)
Deprecated.since 6.0
-
setTypesOfLocals
public void setTypesOfLocals(StackMapType[] types)
-
setTypesOfStackItems
public void setTypesOfStackItems(StackMapType[] types)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- String representation.
-
updateByteCodeOffset
public void updateByteCodeOffset(int delta)
Update the distance (as an offset delta) from this StackMap entry to the next. Note that this might cause the frame type to change. Note also that delta may be negative.- Parameters:
delta
- offset delta
-
-