2 Replies Latest reply on Nov 3, 2004 5:45 PM by Bill Burke

    javassist tries to call a method with wrong return type

    bonsaijboss Newbie

      Hello,

      I get the following exception:

      Exception in thread "main" java.lang.NoSuchMethodError: mycompany.Type.getValue()Ljava/lang/String;

      mycompany.Type is only

      public interface Type
      {
      Object getValue();
      }

      The generated javassist method body is the following:

      {
      mycompany.Type type = getType();
      Object value = type.getValue();
      return ($r)value;
      }

      the return type of the method is String, so ($r) should do a cast to String.

      Where is the error?
      Why tries Javassist to call the getValue()Ljava/lang/String method instead of getValue()Ljava/lang/Object
      ?

      Thanks,
      Norbi