1 Reply Latest reply on Mar 24, 2005 10:08 AM by Shigeru Chiba

    javassist.expr.MethodCall.getClassName() question (bug?)

    Jwahar Bammi Newbie

      javassist.expr.MethodCall.getClassName() is supposed to return the className of the target object that the method call is on. If the target object implements an interface, and this methodCall represents a call to one of the methods of the interface that the taregt object implements, then javassist.expr.MethodCall.getClassName() returns the classname of the interface rather than the classname of the target object that implements the interface method. Am i misunderstanding the intent of getClassName() or is this a bug? If this is not a bug, how do i navigate to get the className of the Object that implements the interface?

      Example:

      public interface Greeting {
      public void speak();
      }

      public class HelloWorld implements Greeting {
      public void speak() {
      System.out.println("Hello, world!");
      }
      }

      in main:

      Greeting h = new HelloWorld();
      h.speak();

      in the MethodCall().getClassName() for this method call, i get "Greeting", i was expecting to get "HelloWorld" as that is the Class of the target object "h" in this methodCall.

      Thanks
      bammi@memento-inc.com