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#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...