Given Java bytecode and ASM bytecode analysis framework,
how can I resolve a target method when polymorphic call occurs?
For instance:
class ClassA {
public void foo() {…}
}
class ClassB extends ClassA {
public void foo() {…}
}
…
ClassA inst = new ClassB();
inst.foo();
The following bytecode is generated for the latter line:
…
INVOKEVIRTUAL ClassA.foo()V
…
This instructure targets a parent method.
But the actual method is ClassB.foo()
.
How can I resolve the "real" method that will be called?