3 Replies Latest reply on Feb 15, 2010 11:53 PM by Arvind K

    what happened to $r?

    Joerg Plewe Newbie

      Shouldn't that work?

      class Foo {
       Object foo() {
       return new Object();
       }
      }
      
      public class Main {
       public static void main(String[] args) throws NotFoundException, CannotCompileException {
       ClassPool cp = ClassPool.getDefault();
       CtClass foocls = cp.get("jatest.Foo");
       CtMethod m = foocls.getMethod("foo", "()Ljava/lang/Object;");
       m.insertBefore("$r x = new Object();");
       }
      }


      I get: compile error: no such class: $r