public class AnalyzerAdapter
extends org.objectweb.asm.MethodVisitor
MethodVisitor
that keeps track of stack map frame changes between visitFrame
calls. This adapter must be used with
the ClassReader.EXPAND_FRAMES
option. Each visitX instruction
delegates to the next visitor in the chain, if any, and then simulates the effect of this
instruction on the stack map frame, represented by locals
and stack
. The next
visitor in the chain can get the state of the stack map frame before each instruction by
reading the value of these fields in its visitX methods (this requires a reference to the
AnalyzerAdapter that is before it in the chain). If this adapter is used with a class that does
not contain stack map table attributes (i.e., pre Java 6 classes) then this adapter may not be
able to compute the stack map frame for each instruction. In this case no exception is thrown but
the locals
and stack
fields will be null for these instructions.Modifier and Type | Field and Description |
---|---|
java.util.List<java.lang.Object> |
locals
List of the local variable slots for current execution frame. |
java.util.List<java.lang.Object> |
stack
List of the operand stack slots for current execution frame. |
java.util.Map<java.lang.Object,java.lang.Object> |
uninitializedTypes
Information about uninitialized types in the current execution frame.
|
Modifier | Constructor and Description |
---|---|
protected |
AnalyzerAdapter(int api,
java.lang.String owner,
int access,
java.lang.String name,
java.lang.String desc,
org.objectweb.asm.MethodVisitor mv)
Constructs a new
AnalyzerAdapter . |
|
AnalyzerAdapter(java.lang.String owner,
int access,
java.lang.String name,
java.lang.String desc,
org.objectweb.asm.MethodVisitor mv)
Constructs a new
AnalyzerAdapter . |
Modifier and Type | Method and Description |
---|---|
void |
visitFieldInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc) |
void |
visitFrame(int type,
int nLocal,
java.lang.Object[] local,
int nStack,
java.lang.Object[] stack) |
void |
visitIincInsn(int var,
int increment) |
void |
visitInsn(int opcode) |
void |
visitIntInsn(int opcode,
int operand) |
void |
visitInvokeDynamicInsn(java.lang.String name,
java.lang.String desc,
org.objectweb.asm.Handle bsm,
java.lang.Object... bsmArgs) |
void |
visitJumpInsn(int opcode,
org.objectweb.asm.Label label) |
void |
visitLabel(org.objectweb.asm.Label label) |
void |
visitLdcInsn(java.lang.Object cst) |
void |
visitLookupSwitchInsn(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels) |
void |
visitMaxs(int maxStack,
int maxLocals) |
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc)
Deprecated.
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc,
boolean itf) |
void |
visitMultiANewArrayInsn(java.lang.String desc,
int dims) |
void |
visitTableSwitchInsn(int min,
int max,
org.objectweb.asm.Label dflt,
org.objectweb.asm.Label... labels) |
void |
visitTypeInsn(int opcode,
java.lang.String type) |
void |
visitVarInsn(int opcode,
int var) |
visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitInsnAnnotation, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitParameter, visitParameterAnnotation, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation
public java.util.List<java.lang.Object> locals
List
of the local variable slots for current execution frame. Primitive types are
represented by Opcodes.TOP
, Opcodes.INTEGER
, Opcodes.FLOAT
, Opcodes.LONG
, Opcodes.DOUBLE
,Opcodes.NULL
or Opcodes.UNINITIALIZED_THIS
(long and double are represented by two elements, the second one
being TOP). Reference types are represented by String objects (representing internal names),
and uninitialized types by Label objects (this label designates the NEW instruction that
created this uninitialized value). This field is null for unreachable instructions.public java.util.List<java.lang.Object> stack
List
of the operand stack slots for current execution frame. Primitive types are
represented by Opcodes.TOP
, Opcodes.INTEGER
, Opcodes.FLOAT
, Opcodes.LONG
, Opcodes.DOUBLE
,Opcodes.NULL
or Opcodes.UNINITIALIZED_THIS
(long and double are represented by two elements, the second one
being TOP). Reference types are represented by String objects (representing internal names),
and uninitialized types by Label objects (this label designates the NEW instruction that
created this uninitialized value). This field is null for unreachable instructions.public java.util.Map<java.lang.Object,java.lang.Object> uninitializedTypes
public AnalyzerAdapter(java.lang.String owner, int access, java.lang.String name, java.lang.String desc, org.objectweb.asm.MethodVisitor mv)
AnalyzerAdapter
. Subclasses must not use this constructor.
Instead, they must use the AnalyzerAdapter(int, String, int, String, String,
MethodVisitor)
version.owner
- the owner's class name.access
- the method's access flags (see Opcodes
).name
- the method's name.desc
- the method's descriptor (see Type
).mv
- the method visitor to which this adapter delegates calls. May be null.java.lang.IllegalStateException
- If a subclass calls this constructor.protected AnalyzerAdapter(int api, java.lang.String owner, int access, java.lang.String name, java.lang.String desc, org.objectweb.asm.MethodVisitor mv)
AnalyzerAdapter
.api
- the ASM API version implemented by this visitor. Must be one of Opcodes.ASM4
, Opcodes.ASM5
or Opcodes.ASM6
.owner
- the owner's class name.access
- the method's access flags (see Opcodes
).name
- the method's name.desc
- the method's descriptor (see Type
).mv
- the method visitor to which this adapter delegates calls. May be null.public void visitFrame(int type, int nLocal, java.lang.Object[] local, int nStack, java.lang.Object[] stack)
visitFrame
in class org.objectweb.asm.MethodVisitor
public void visitInsn(int opcode)
visitInsn
in class org.objectweb.asm.MethodVisitor
public void visitIntInsn(int opcode, int operand)
visitIntInsn
in class org.objectweb.asm.MethodVisitor
public void visitVarInsn(int opcode, int var)
visitVarInsn
in class org.objectweb.asm.MethodVisitor
public void visitTypeInsn(int opcode, java.lang.String type)
visitTypeInsn
in class org.objectweb.asm.MethodVisitor
public void visitFieldInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
visitFieldInsn
in class org.objectweb.asm.MethodVisitor
@Deprecated public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc)
visitMethodInsn
in class org.objectweb.asm.MethodVisitor
public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String desc, boolean itf)
visitMethodInsn
in class org.objectweb.asm.MethodVisitor
public void visitInvokeDynamicInsn(java.lang.String name, java.lang.String desc, org.objectweb.asm.Handle bsm, java.lang.Object... bsmArgs)
visitInvokeDynamicInsn
in class org.objectweb.asm.MethodVisitor
public void visitJumpInsn(int opcode, org.objectweb.asm.Label label)
visitJumpInsn
in class org.objectweb.asm.MethodVisitor
public void visitLabel(org.objectweb.asm.Label label)
visitLabel
in class org.objectweb.asm.MethodVisitor
public void visitLdcInsn(java.lang.Object cst)
visitLdcInsn
in class org.objectweb.asm.MethodVisitor
public void visitIincInsn(int var, int increment)
visitIincInsn
in class org.objectweb.asm.MethodVisitor
public void visitTableSwitchInsn(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
visitTableSwitchInsn
in class org.objectweb.asm.MethodVisitor
public void visitLookupSwitchInsn(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
visitLookupSwitchInsn
in class org.objectweb.asm.MethodVisitor
public void visitMultiANewArrayInsn(java.lang.String desc, int dims)
visitMultiANewArrayInsn
in class org.objectweb.asm.MethodVisitor
public void visitMaxs(int maxStack, int maxLocals)
visitMaxs
in class org.objectweb.asm.MethodVisitor