Change a method call to another one

<[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi, having the following structure compiled into class files:

public class A {
  public void A_method() { ... };
}

public class B extends A {
  public static void static_B_method() { ... };
}

public class C {
  static A static_A_instance;
  ...

  public void method() {
    static_A_instance.Amethod();
  }

  ...
}

I need to replace at class C the static_A_instance.Amethod() to
B.static_B_method()

I wrote some code that at visitMethodInsn will generate the call to
B.static_B_method() but the stack operand gets corrupted because there still a
GETSTATIC of static_A_instance just before the code injected by my
visitMethodInsn.

The resulting .class file looks like this:
....
getstatic C.static_A_instance : A
invokestatic B.static_B_method() : void
....

How can i solve this problem?
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.