[jboss-user] [Javassist Users] - what happened to $r?

Herkules000 do-not-reply at jboss.com
Mon Sep 28 06:25:43 EDT 2009


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


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4257305#4257305

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4257305



More information about the jboss-user mailing list