public class InstructionAdapter
extends org.objectweb.asm.MethodVisitor
MethodVisitor
providing a more detailed API to generate and transform instructions.Modifier and Type | Field and Description |
---|---|
static org.objectweb.asm.Type |
OBJECT_TYPE
The type of the java.lang.Object class.
|
Modifier | Constructor and Description |
---|---|
protected |
InstructionAdapter(int api,
org.objectweb.asm.MethodVisitor methodVisitor)
Constructs a new
InstructionAdapter . |
|
InstructionAdapter(org.objectweb.asm.MethodVisitor methodVisitor)
Constructs a new
InstructionAdapter . |
Modifier and Type | Method and Description |
---|---|
void |
aconst(java.lang.Object value)
Generates the instruction to push the given value on the stack.
|
void |
add(org.objectweb.asm.Type type) |
void |
aload(org.objectweb.asm.Type type) |
void |
and(org.objectweb.asm.Type type) |
void |
anew(org.objectweb.asm.Type type) |
void |
areturn(org.objectweb.asm.Type type) |
void |
arraylength() |
void |
astore(org.objectweb.asm.Type type) |
void |
athrow() |
void |
cast(org.objectweb.asm.Type from,
org.objectweb.asm.Type to)
Generates the instruction to cast from the first given type to the other.
|
void |
cconst(org.objectweb.asm.ConstantDynamic constantDynamic)
Generates the instruction to push the given constant dynamic on the stack.
|
void |
checkcast(org.objectweb.asm.Type type) |
void |
cmpg(org.objectweb.asm.Type type) |
void |
cmpl(org.objectweb.asm.Type type) |
void |
dconst(double doubleValue)
Generates the instruction to push the given value on the stack.
|
void |
div(org.objectweb.asm.Type type) |
void |
dup() |
void |
dup2() |
void |
dup2X1() |
void |
dup2X2() |
void |
dupX1() |
void |
dupX2() |
void |
fconst(float floatValue)
Generates the instruction to push the given value on the stack.
|
void |
getfield(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
void |
getstatic(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
void |
goTo(org.objectweb.asm.Label label) |
void |
hconst(org.objectweb.asm.Handle handle)
Generates the instruction to push the given handle on the stack.
|
void |
iconst(int intValue)
Generates the instruction to push the given value on the stack.
|
void |
ifacmpeq(org.objectweb.asm.Label label) |
void |
ifacmpne(org.objectweb.asm.Label label) |
void |
ifeq(org.objectweb.asm.Label label) |
void |
ifge(org.objectweb.asm.Label label) |
void |
ifgt(org.objectweb.asm.Label label) |
void |
ificmpeq(org.objectweb.asm.Label label) |
void |
ificmpge(org.objectweb.asm.Label label) |
void |
ificmpgt(org.objectweb.asm.Label label) |
void |
ificmple(org.objectweb.asm.Label label) |
void |
ificmplt(org.objectweb.asm.Label label) |
void |
ificmpne(org.objectweb.asm.Label label) |
void |
ifle(org.objectweb.asm.Label label) |
void |
iflt(org.objectweb.asm.Label label) |
void |
ifne(org.objectweb.asm.Label label) |
void |
ifnonnull(org.objectweb.asm.Label label) |
void |
ifnull(org.objectweb.asm.Label label) |
void |
iinc(int var,
int increment) |
void |
instanceOf(org.objectweb.asm.Type type) |
void |
invokedynamic(java.lang.String name,
java.lang.String descriptor,
org.objectweb.asm.Handle bootstrapMethodHandle,
java.lang.Object[] bootstrapMethodArguments)
Generates the instruction to call the given dynamic method.
|
void |
invokeinterface(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Generates the instruction to call the given interface method.
|
void |
invokespecial(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Deprecated.
use
invokespecial(String, String, String, boolean) instead. |
void |
invokespecial(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
boolean isInterface)
Generates the instruction to call the given special method.
|
void |
invokestatic(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Deprecated.
use
invokestatic(String, String, String, boolean) instead. |
void |
invokestatic(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
boolean isInterface)
Generates the instruction to call the given static method.
|
void |
invokevirtual(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Deprecated.
use
invokevirtual(String, String, String, boolean) instead. |
void |
invokevirtual(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
boolean isInterface)
Generates the instruction to call the given virtual method.
|
void |
jsr(org.objectweb.asm.Label label) |
void |
lcmp() |
void |
lconst(long longValue)
Generates the instruction to push the given value on the stack.
|
void |
load(int var,
org.objectweb.asm.Type type) |
void |
lookupswitch(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels) |
void |
mark(org.objectweb.asm.Label label) |
void |
monitorenter() |
void |
monitorexit() |
void |
mul(org.objectweb.asm.Type type) |
void |
multianewarray(java.lang.String descriptor,
int numDimensions) |
void |
neg(org.objectweb.asm.Type type) |
void |
newarray(org.objectweb.asm.Type type)
Generates the instruction to create and push on the stack an array of the given type.
|
void |
nop()
Generates a nop instruction.
|
void |
or(org.objectweb.asm.Type type) |
void |
pop() |
void |
pop2() |
void |
putfield(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
void |
putstatic(java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
void |
rem(org.objectweb.asm.Type type) |
void |
ret(int var) |
void |
shl(org.objectweb.asm.Type type) |
void |
shr(org.objectweb.asm.Type type) |
void |
store(int var,
org.objectweb.asm.Type type) |
void |
sub(org.objectweb.asm.Type type) |
void |
swap() |
void |
tableswitch(int min,
int max,
org.objectweb.asm.Label dflt,
org.objectweb.asm.Label... labels) |
void |
tconst(org.objectweb.asm.Type type)
Generates the instruction to push the given type on the stack.
|
void |
ushr(org.objectweb.asm.Type type) |
void |
visitFieldInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String descriptor) |
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 descriptor,
org.objectweb.asm.Handle bootstrapMethodHandle,
java.lang.Object... bootstrapMethodArguments) |
void |
visitJumpInsn(int opcode,
org.objectweb.asm.Label label) |
void |
visitLabel(org.objectweb.asm.Label label) |
void |
visitLdcInsn(java.lang.Object value) |
void |
visitLookupSwitchInsn(org.objectweb.asm.Label dflt,
int[] keys,
org.objectweb.asm.Label[] labels) |
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String descriptor)
Deprecated.
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String descriptor,
boolean isInterface) |
void |
visitMultiANewArrayInsn(java.lang.String descriptor,
int numDimensions) |
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) |
void |
xor(org.objectweb.asm.Type type) |
visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFrame, visitInsnAnnotation, visitLineNumber, visitLocalVariable, visitLocalVariableAnnotation, visitMaxs, visitParameter, visitParameterAnnotation, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotation
public static final org.objectweb.asm.Type OBJECT_TYPE
public InstructionAdapter(org.objectweb.asm.MethodVisitor methodVisitor)
InstructionAdapter
. Subclasses must not use this constructor.
Instead, they must use the InstructionAdapter(int, MethodVisitor)
version.methodVisitor
- the method visitor to which this adapter delegates calls.java.lang.IllegalStateException
- If a subclass calls this constructor.protected InstructionAdapter(int api, org.objectweb.asm.MethodVisitor methodVisitor)
InstructionAdapter
.api
- the ASM API version implemented by this visitor. Must be one of Opcodes.ASM4
, Opcodes.ASM5
, Opcodes.ASM6
or Opcodes.ASM7
.methodVisitor
- the method visitor to which this adapter delegates calls.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 descriptor)
visitFieldInsn
in class org.objectweb.asm.MethodVisitor
@Deprecated public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String descriptor)
visitMethodInsn(int, String, String, String, boolean)
instead.visitMethodInsn
in class org.objectweb.asm.MethodVisitor
public void visitMethodInsn(int opcode, java.lang.String owner, java.lang.String name, java.lang.String descriptor, boolean isInterface)
visitMethodInsn
in class org.objectweb.asm.MethodVisitor
public void visitInvokeDynamicInsn(java.lang.String name, java.lang.String descriptor, org.objectweb.asm.Handle bootstrapMethodHandle, java.lang.Object... bootstrapMethodArguments)
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 value)
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 descriptor, int numDimensions)
visitMultiANewArrayInsn
in class org.objectweb.asm.MethodVisitor
public void nop()
public void aconst(java.lang.Object value)
value
- the constant to be pushed on the stack. This parameter must be an Integer
,
a Float
, a Long
, a Double
, a String
, a Type
of
OBJECT or ARRAY sort for .class
constants, for classes whose version is 49, a
Type
of METHOD sort for MethodType, a Handle
for MethodHandle constants,
for classes whose version is 51 or a ConstantDynamic
for a constant dynamic for
classes whose version is 55.public void iconst(int intValue)
intValue
- the constant to be pushed on the stack.public void lconst(long longValue)
longValue
- the constant to be pushed on the stack.public void fconst(float floatValue)
floatValue
- the constant to be pushed on the stack.public void dconst(double doubleValue)
doubleValue
- the constant to be pushed on the stack.public void tconst(org.objectweb.asm.Type type)
type
- the type to be pushed on the stack.public void hconst(org.objectweb.asm.Handle handle)
handle
- the handle to be pushed on the stack.public void cconst(org.objectweb.asm.ConstantDynamic constantDynamic)
constantDynamic
- the constant dynamic to be pushed on the stack.public void load(int var, org.objectweb.asm.Type type)
public void aload(org.objectweb.asm.Type type)
public void store(int var, org.objectweb.asm.Type type)
public void astore(org.objectweb.asm.Type type)
public void pop()
public void pop2()
public void dup()
public void dup2()
public void dupX1()
public void dupX2()
public void dup2X1()
public void dup2X2()
public void swap()
public void add(org.objectweb.asm.Type type)
public void sub(org.objectweb.asm.Type type)
public void mul(org.objectweb.asm.Type type)
public void div(org.objectweb.asm.Type type)
public void rem(org.objectweb.asm.Type type)
public void neg(org.objectweb.asm.Type type)
public void shl(org.objectweb.asm.Type type)
public void shr(org.objectweb.asm.Type type)
public void ushr(org.objectweb.asm.Type type)
public void and(org.objectweb.asm.Type type)
public void or(org.objectweb.asm.Type type)
public void xor(org.objectweb.asm.Type type)
public void iinc(int var, int increment)
public void cast(org.objectweb.asm.Type from, org.objectweb.asm.Type to)
from
- a Type.to
- a Type.public void lcmp()
public void cmpl(org.objectweb.asm.Type type)
public void cmpg(org.objectweb.asm.Type type)
public void ifeq(org.objectweb.asm.Label label)
public void ifne(org.objectweb.asm.Label label)
public void iflt(org.objectweb.asm.Label label)
public void ifge(org.objectweb.asm.Label label)
public void ifgt(org.objectweb.asm.Label label)
public void ifle(org.objectweb.asm.Label label)
public void ificmpeq(org.objectweb.asm.Label label)
public void ificmpne(org.objectweb.asm.Label label)
public void ificmplt(org.objectweb.asm.Label label)
public void ificmpge(org.objectweb.asm.Label label)
public void ificmpgt(org.objectweb.asm.Label label)
public void ificmple(org.objectweb.asm.Label label)
public void ifacmpeq(org.objectweb.asm.Label label)
public void ifacmpne(org.objectweb.asm.Label label)
public void goTo(org.objectweb.asm.Label label)
public void jsr(org.objectweb.asm.Label label)
public void ret(int var)
public void tableswitch(int min, int max, org.objectweb.asm.Label dflt, org.objectweb.asm.Label... labels)
public void lookupswitch(org.objectweb.asm.Label dflt, int[] keys, org.objectweb.asm.Label[] labels)
public void areturn(org.objectweb.asm.Type type)
public void getstatic(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
public void putstatic(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
public void getfield(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
public void putfield(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
@Deprecated public void invokevirtual(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
invokevirtual(String, String, String, boolean)
instead.owner
- the internal name of the method's owner class.name
- the method's name.descriptor
- the method's descriptor (see Type
).public void invokevirtual(java.lang.String owner, java.lang.String name, java.lang.String descriptor, boolean isInterface)
owner
- the internal name of the method's owner class (see Type.getInternalName()
).name
- the method's name.descriptor
- the method's descriptor (see Type
).isInterface
- if the method's owner class is an interface.@Deprecated public void invokespecial(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
invokespecial(String, String, String, boolean)
instead.owner
- the internal name of the method's owner class.name
- the method's name.descriptor
- the method's descriptor (see Type
).public void invokespecial(java.lang.String owner, java.lang.String name, java.lang.String descriptor, boolean isInterface)
owner
- the internal name of the method's owner class (see Type.getInternalName()
).name
- the method's name.descriptor
- the method's descriptor (see Type
).isInterface
- if the method's owner class is an interface.@Deprecated public void invokestatic(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
invokestatic(String, String, String, boolean)
instead.owner
- the internal name of the method's owner class.name
- the method's name.descriptor
- the method's descriptor (see Type
).public void invokestatic(java.lang.String owner, java.lang.String name, java.lang.String descriptor, boolean isInterface)
owner
- the internal name of the method's owner class (see Type.getInternalName()
).name
- the method's name.descriptor
- the method's descriptor (see Type
).isInterface
- if the method's owner class is an interface.public void invokeinterface(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
owner
- the internal name of the method's owner class (see Type.getInternalName()
).name
- the method's name.descriptor
- the method's descriptor (see Type
).public void invokedynamic(java.lang.String name, java.lang.String descriptor, org.objectweb.asm.Handle bootstrapMethodHandle, java.lang.Object[] bootstrapMethodArguments)
name
- the method's name.descriptor
- the method's descriptor (see Type
).bootstrapMethodHandle
- the bootstrap method.bootstrapMethodArguments
- the bootstrap method constant arguments. Each argument must be
an Integer
, Float
, Long
, Double
, String
, Type
, Handle
or ConstantDynamic
value. This method is allowed to modify
the content of the array so a caller should expect that this array may change.public void anew(org.objectweb.asm.Type type)
public void newarray(org.objectweb.asm.Type type)
type
- an array Type.public void arraylength()
public void athrow()
public void checkcast(org.objectweb.asm.Type type)
public void instanceOf(org.objectweb.asm.Type type)
public void monitorenter()
public void monitorexit()
public void multianewarray(java.lang.String descriptor, int numDimensions)
public void ifnull(org.objectweb.asm.Label label)
public void ifnonnull(org.objectweb.asm.Label label)
public void mark(org.objectweb.asm.Label label)