public class InvokeReplacerMethodAdapter extends MethodAdapter
| Modifier and Type | Field and Description |
|---|---|
protected InvokeAspect[] |
aspects |
protected boolean |
firstSuperCtorInitCalled
Detects super ctor invocation.
|
protected boolean |
isPrevious |
protected MethodInfo |
methodInfo |
protected InvokeReplacer |
newInvokeReplacer
New object creation matched.
|
protected int |
opcode |
protected int |
operand |
protected boolean |
proxyInfoRequested |
protected java.lang.String[] |
strArgs |
protected boolean |
traceNext |
protected WorkData |
wd |
api, mv| Constructor and Description |
|---|
InvokeReplacerMethodAdapter(MethodVisitor mv,
MethodInfo methodInfo,
WorkData wd,
InvokeAspect[] aspects) |
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
appendArgument(java.lang.String desc,
java.lang.String type)
Appends argument to the existing description.
|
protected static java.lang.String |
changeReturnType(java.lang.String desc,
java.lang.String type)
Changes return type.
|
protected int |
getArgumentIndex()
Returns argument index from the history.
|
java.lang.String[] |
getLastTwoStringArguments()
Returns last two string arguments.
|
protected static java.lang.String |
prependArgument(java.lang.String desc,
java.lang.String type)
Prepends argument to the existing description.
|
void |
visitFieldInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc)
Visits a field instruction.
|
void |
visitIincInsn(int var,
int increment)
Visits an IINC instruction.
|
void |
visitInsn(int opcode)
Visits a zero operand instruction.
|
void |
visitIntInsn(int opcode,
int operand)
Visits an instruction with a single int operand.
|
void |
visitJumpInsn(int opcode,
Label label)
Visits a jump instruction.
|
void |
visitLdcInsn(java.lang.Object cst)
Visits a LDC instruction.
|
void |
visitLineNumber(int line,
Label start)
Visits a line number declaration.
|
void |
visitLocalVariable(java.lang.String name,
java.lang.String desc,
java.lang.String signature,
Label start,
Label end,
int index)
Visits a local variable declaration.
|
void |
visitLookupSwitchInsn(Label dflt,
int[] keys,
Label[] labels)
Visits a LOOKUPSWITCH instruction.
|
void |
visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc,
boolean isInterface)
Invoked on INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC, INVOKEINTERFACE or INVOKEDYNAMIC.
|
void |
visitMultiANewArrayInsn(java.lang.String desc,
int dims)
Visits a MULTIANEWARRAY instruction.
|
void |
visitTableSwitchInsn(int min,
int max,
Label dflt,
Label[] labels)
Visits a TABLESWITCH instruction.
|
void |
visitTypeInsn(int opcode,
java.lang.String type)
Visits a type instruction.
|
void |
visitVarInsn(int opcode,
int var)
Visits a local variable instruction.
|
visitAnnotableParameterCount, visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFrame, visitInsnAnnotation, visitInvokeDynamicInsn, visitLabel, visitLocalVariableAnnotation, visitMaxs, visitMethodInsn, visitParameter, visitParameterAnnotation, visitTryCatchAnnotation, visitTryCatchBlock, visitTypeAnnotationprotected final WorkData wd
protected final MethodInfo methodInfo
protected final InvokeAspect[] aspects
protected boolean firstSuperCtorInitCalled
protected boolean proxyInfoRequested
protected InvokeReplacer newInvokeReplacer
protected int opcode
protected int operand
protected boolean isPrevious
protected boolean traceNext
protected java.lang.String[] strArgs
public InvokeReplacerMethodAdapter(MethodVisitor mv, MethodInfo methodInfo, WorkData wd, InvokeAspect[] aspects)
public void visitMethodInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc,
boolean isInterface)
opcode - the opcode of the type instruction to be visited. This opcode is either
INVOKEVIRTUAL, INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE.owner - the internal name of the method's owner class (see Type.getInternalName()).name - the method's name.desc - the method's descriptor (see Type).isInterface - if the method's owner class is an interface.public void visitFieldInsn(int opcode,
java.lang.String owner,
java.lang.String name,
java.lang.String desc)
MethodVisitoropcode - the opcode of the type instruction to be visited. This opcode is either
GETSTATIC, PUTSTATIC, GETFIELD or PUTFIELD.owner - the internal name of the field's owner class (see Type.getInternalName()).name - the field's name.desc - the field's descriptor (see Type).public void visitTypeInsn(int opcode,
java.lang.String type)
MethodVisitoropcode - the opcode of the type instruction to be visited. This opcode is either NEW,
ANEWARRAY, CHECKCAST or INSTANCEOF.type - the operand of the instruction to be visited. This operand must be the internal
name of an object or array class (see Type.getInternalName()).public void visitVarInsn(int opcode,
int var)
MethodVisitoropcode - the opcode of the local variable instruction to be visited. This opcode is either
ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET.var - the operand of the instruction to be visited. This operand is the index of a local
variable.public void visitInsn(int opcode)
MethodVisitoropcode - the opcode of the instruction to be visited. This opcode is either NOP,
ACONST_NULL, ICONST_M1, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5,
LCONST_0, LCONST_1, FCONST_0, FCONST_1, FCONST_2, DCONST_0, DCONST_1, IALOAD, LALOAD,
FALOAD, DALOAD, AALOAD, BALOAD, CALOAD, SALOAD, IASTORE, LASTORE, FASTORE, DASTORE,
AASTORE, BASTORE, CASTORE, SASTORE, POP, POP2, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2,
SWAP, IADD, LADD, FADD, DADD, ISUB, LSUB, FSUB, DSUB, IMUL, LMUL, FMUL, DMUL, IDIV, LDIV,
FDIV, DDIV, IREM, LREM, FREM, DREM, INEG, LNEG, FNEG, DNEG, ISHL, LSHL, ISHR, LSHR, IUSHR,
LUSHR, IAND, LAND, IOR, LOR, IXOR, LXOR, I2L, I2F, I2D, L2I, L2F, L2D, F2I, F2L, F2D, D2I,
D2L, D2F, I2B, I2C, I2S, LCMP, FCMPL, FCMPG, DCMPL, DCMPG, IRETURN, LRETURN, FRETURN,
DRETURN, ARETURN, RETURN, ARRAYLENGTH, ATHROW, MONITORENTER, or MONITOREXIT.public void visitLocalVariable(java.lang.String name,
java.lang.String desc,
java.lang.String signature,
Label start,
Label end,
int index)
MethodVisitorname - the name of a local variable.desc - the type descriptor of this local variable.signature - the type signature of this local variable. May be null if the local
variable type does not use generic types.start - the first instruction corresponding to the scope of this local variable
(inclusive).end - the last instruction corresponding to the scope of this local variable (exclusive).index - the local variable's index.public void visitLineNumber(int line,
Label start)
MethodVisitorline - a line number. This number refers to the source file from which the class was
compiled.start - the first instruction corresponding to this line number.protected static java.lang.String appendArgument(java.lang.String desc,
java.lang.String type)
protected static java.lang.String prependArgument(java.lang.String desc,
java.lang.String type)
protected static java.lang.String changeReturnType(java.lang.String desc,
java.lang.String type)
protected int getArgumentIndex()
public java.lang.String[] getLastTwoStringArguments()
public void visitIntInsn(int opcode,
int operand)
MethodVisitorvisitIntInsn in class MethodVisitoropcode - the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH
or NEWARRAY.operand - the operand of the instruction to be visited.Opcodes.T_BOOLEAN, Opcodes.T_CHAR, Opcodes.T_FLOAT, Opcodes.T_DOUBLE, Opcodes.T_BYTE,
Opcodes.T_SHORT, Opcodes.T_INT or Opcodes.T_LONG.public void visitJumpInsn(int opcode,
Label label)
MethodVisitorvisitJumpInsn in class MethodVisitoropcode - the opcode of the type instruction to be visited. This opcode is either IFEQ,
IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT,
IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL.label - the operand of the instruction to be visited. This operand is a label that
designates the instruction to which the jump instruction may jump.public void visitLdcInsn(java.lang.Object cst)
MethodVisitor
if (cst instanceof Integer) {
// ...
} else if (cst instanceof Float) {
// ...
} else if (cst instanceof Long) {
// ...
} else if (cst instanceof Double) {
// ...
} else if (cst instanceof String) {
// ...
} else if (cst instanceof Type) {
int sort = ((Type) cst).getSort();
if (sort == Type.OBJECT) {
// ...
} else if (sort == Type.ARRAY) {
// ...
} else if (sort == Type.METHOD) {
// ...
} else {
// throw an exception
}
} else if (cst instanceof Handle) {
// ...
} else if (cst instanceof ConstantDynamic) {
// ...
} else {
// throw an exception
}
visitLdcInsn in class MethodVisitorcst - the constant to be loaded on the stack. This parameter must be a non null 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 visitIincInsn(int var,
int increment)
MethodVisitorvisitIincInsn in class MethodVisitorvar - index of the local variable to be incremented.increment - amount to increment the local variable by.public void visitTableSwitchInsn(int min,
int max,
Label dflt,
Label[] labels)
MethodVisitorvisitTableSwitchInsn in class MethodVisitormin - the minimum key value.max - the maximum key value.dflt - beginning of the default handler block.labels - beginnings of the handler blocks. labels[i] is the beginning of the
handler block for the min + i key.public void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels)
MethodVisitorvisitLookupSwitchInsn in class MethodVisitordflt - beginning of the default handler block.keys - the values of the keys.labels - beginnings of the handler blocks. labels[i] is the beginning of the
handler block for the keys[i] key.public void visitMultiANewArrayInsn(java.lang.String desc,
int dims)
MethodVisitorvisitMultiANewArrayInsn in class MethodVisitordesc - an array type descriptor (see Type).dims - the number of dimensions of the array to allocate.Copyright © 2003-present Jodd Team