Question

Is there a way to know if the method in an invoke instruction in bytecode is a native method or not? I am looking for an ASM specific solution.

The visitMethodInsn(int opcode, String owner, String name, String desc)) does not seem to provide this information. If it does, what am i missing? OR is there a different way to confirm if the method to be executed is native or not?

I know that you can do this when you visit a method with the visitMethod(int access, String name, String desc, String signature, String[] exceptions) in the ClassVisitor class using the int access parameter. But i am interested in getting this information at the call sites of the method.

I am using the ASM Core API.

This is for an instrumenter for Java programs that i am writing using ASM.

Was it helpful?

Solution

You can't get the information at the call sites, because it isn't known at the call sites. The call sites don't know which override of the method will actually be called. It's resolved at runtime.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top