feat: hook readOption for fast api
This commit is contained in:
parent
fac5feab85
commit
9823d58d00
|
@ -23,11 +23,22 @@ public class VMOptionsTransformer implements MyTransformer {
|
|||
InsnList list = new InsnList();
|
||||
list.add(new MethodInsnNode(INVOKESTATIC, "com/novitechie/StackTraceRule", "check", "()Z", false));
|
||||
LabelNode labelNode = new LabelNode();
|
||||
list.add(new JumpInsnNode(IFEQ,labelNode));
|
||||
list.add(new JumpInsnNode(IFEQ, labelNode));
|
||||
list.add(new InsnNode(ACONST_NULL));
|
||||
list.add(new InsnNode(ARETURN));
|
||||
list.add(labelNode);
|
||||
m.instructions.insert(list);
|
||||
} else if ("readOption".equals(m.name) && "(Ljava/lang/String;Z)Ljava/lang/String;".equals(m.desc)) {
|
||||
InsnList list = new InsnList();
|
||||
LabelNode continueLabel = new LabelNode();
|
||||
list.add(new VarInsnNode(ALOAD, 0));
|
||||
list.add(new LdcInsnNode("javaagent"));
|
||||
list.add(new MethodInsnNode(INVOKEVIRTUAL, "java/lang/String", "contains", "(Ljava/lang/CharSequence;)Z", false));
|
||||
list.add(new JumpInsnNode(IFEQ, continueLabel));
|
||||
list.add(new InsnNode(ACONST_NULL));
|
||||
list.add(new InsnNode(ARETURN));
|
||||
list.add(continueLabel);
|
||||
m.instructions.insert(list);
|
||||
}
|
||||
}
|
||||
ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
|
|
Loading…
Reference in New Issue