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
-
-
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)instead.StackMapEntry(int tag, int byteCodeOffset, StackMapType[] typesOfLocals, StackMapType[] typesOfStackItems, ConstantPool constantPool)Create an instance
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaccept(Visitor v)Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.StackMapEntrycopy()Creates a deep copy of this object.voiddump(java.io.DataOutputStream file)Dumps stack map entryintgetByteCodeOffset()Gets the byte code offset.ConstantPoolgetConstantPool()Gets the constant pool.intgetFrameType()Gets the frame type.intgetNumberOfLocals()Gets the number of locals.intgetNumberOfStackItems()Gets the number of stack items.StackMapType[]getTypesOfLocals()Gets the types of locals.StackMapType[]getTypesOfStackItems()Gets the types of stack items.voidsetByteCodeOffset(int newOffset)Sets the byte code offset.voidsetConstantPool(ConstantPool constantPool)Sets the constant pool.voidsetFrameType(int ft)Sets the frame type.voidsetNumberOfLocals(int n)Deprecated.Since 6.0voidsetNumberOfStackItems(int n)Deprecated.Since 6.0voidsetTypesOfLocals(StackMapType[] types)Sets the types of locals.voidsetTypesOfStackItems(StackMapType[] types)Sets the types of stack items.java.lang.StringtoString()voidupdateByteCodeOffset(int delta)Updates the distance (as an offset delta) from this StackMap entry to the next.
-
-
-
Constructor Detail
-
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)instead.DO NOT USE- Parameters:
byteCodeOffset- byte code offset.numberOfLocals- NOT USED.typesOfLocals- array ofStackMapTypes of locals.numberOfStackItems- NOT USED.typesOfStackItems- array otStackMapTypes of stack items.constantPool- The constant pool.
-
StackMapEntry
public StackMapEntry(int tag, int byteCodeOffset, StackMapType[] typesOfLocals, StackMapType[] typesOfStackItems, ConstantPool constantPool)
Create an instance- Parameters:
tag- The frameType to use.byteCodeOffset- byte code offset.typesOfLocals- array ofStackMapTypes of locals.typesOfStackItems- array otStackMapTypes of stack items.constantPool- 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()
Creates a deep copy of this object.- Returns:
- deep copy of this object.
-
dump
public void dump(java.io.DataOutputStream file) throws java.io.IOException
Dumps stack map entry- Parameters:
file- Output file stream.- Throws:
java.io.IOException- Thrown if an I/O error occurs.
-
getByteCodeOffset
public int getByteCodeOffset()
Gets the byte code offset.- Returns:
- The byte code offset.
-
getConstantPool
public ConstantPool getConstantPool()
Gets the constant pool.- Returns:
- Constant pool used by this object.
-
getFrameType
public int getFrameType()
Gets the frame type.- Returns:
- The frame type.
-
getNumberOfLocals
public int getNumberOfLocals()
Gets the number of locals.- Returns:
- The number of locals.
-
getNumberOfStackItems
public int getNumberOfStackItems()
Gets the number of stack items.- Returns:
- The number of stack items.
-
getTypesOfLocals
public StackMapType[] getTypesOfLocals()
Gets the types of locals.- Returns:
- The types of locals.
-
getTypesOfStackItems
public StackMapType[] getTypesOfStackItems()
Gets the types of stack items.- Returns:
- The types of stack items.
-
setByteCodeOffset
public void setByteCodeOffset(int newOffset)
Sets the byte code offset.- Parameters:
newOffset- The new offset.
-
setConstantPool
public void setConstantPool(ConstantPool constantPool)
Sets the constant pool.- Parameters:
constantPool- Constant pool to be used for this object.
-
setFrameType
public void setFrameType(int ft)
Sets the frame type.- Parameters:
ft- The frame type.
-
setNumberOfLocals
@Deprecated public void setNumberOfLocals(int n)
Deprecated.Since 6.0Sets the number of locals (deprecated).- Parameters:
n- The number of locals.
-
setNumberOfStackItems
@Deprecated public void setNumberOfStackItems(int n)
Deprecated.Since 6.0Sets the number of stack items (deprecated).- Parameters:
n- The number of stack items.
-
setTypesOfLocals
public void setTypesOfLocals(StackMapType[] types)
Sets the types of locals.- Parameters:
types- The types of locals.
-
setTypesOfStackItems
public void setTypesOfStackItems(StackMapType[] types)
Sets the types of stack items.- Parameters:
types- The types of stack items.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation.
-
updateByteCodeOffset
public void updateByteCodeOffset(int delta)
Updates 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.
-
-