1 Reply Latest reply on Jul 14, 2003 11:00 PM by Shigeru Chiba

    reference java.lang.Object.class

    Alexey Loubyansky Master

      I found that I can't use a reference to a Class with "class".

      For example:
      CtClass clazz = pool.get("java.lang.Class");
      CtMethod m = new CtMethod(clazz, "getClazz", null, myClass);
      m.setBody("{return java.lang.String.class; }");

      will throw an exception:
      Caused by: javassist.CannotCompileException: [source error] missing member name
      at javassist.CtBehavior.setBody(CtBehavior.java:163)
      at javassist.CtMethod.setBody(CtMethod.java:311)

      Is it a known issue?

      Thanks,
      alex