Skip to content

Commit

Permalink
fix jsr problem. alibaba#1304
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc committed Jul 14, 2020
1 parent 4a48a7b commit 94b95b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ public static MethodNode removeJSRInstructions(MethodNode subjectMethod) {
return result;
}

public static ClassNode removeJSRInstructions(ClassNode classNode) {
ClassNode result = new ClassNode(Opcodes.ASM8);
classNode.accept(new ClassVisitor(Opcodes.ASM8, result) {
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature,
String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
return new JSRInlinerAdapter(mv, access, name, desc, signature, exceptions);
}
});
return result;
}

public static MethodNode removeLineNumbers(MethodNode methodNode) {
MethodNode result = newMethodNode(methodNode);
methodNode.accept(new MethodVisitor(Opcodes.ASM8, result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public byte[] transform(final ClassLoader inClassLoader, String className, Class
}

ClassNode classNode = AsmUtils.toClassNode(classfileBuffer);
// remove JSR https://github.com/alibaba/arthas/issues/1304
classNode = AsmUtils.removeJSRInstructions(classNode);

// 生成增强字节码
DefaultInterceptorClassParser defaultInterceptorClassParser = new DefaultInterceptorClassParser();
Expand Down

0 comments on commit 94b95b2

Please sign in to comment.