0 Replies Latest reply on Jun 11, 2007 11:30 AM by Azeem

    Replacing the static method

    Azeem Newbie

      I am new to javassist API. I need to do some task using byte code replacement. I have 3 classes something like given below

      public class A {
       public void method()
       {
       System.out.println("Method in A");
       }
      }
      
      public class B{
       public static void method()
       {
       System.out.println("Method in B");
       }
      }
      
      public class C extends A{
       public static void call()
       {
       method();
       }
      }
      
      


      C.call() will print "Method in A". Now i need to replace A's method() with B's method() i.e C.call() should print "Method in B".

      Please give some code snippet to do this task.

      Thanks in advance