public void testNewOp() throws Exception { CtClass cc = sloader.get("test2.NewOp"); CtMethod add = CtNewMethod.make( "public test2.NewOp2 " + " addMonitoringRemoteEventListener(" + " test2.NewOp2 listener)" + " throws java.rmi.RemoteException {" + " $0.listenerList.addElement(listener);" + " return new test2.NewOp2(0L, this, null, 0L);" + "}", cc); add.setModifiers(Modifier.PUBLIC); cc.addMethod(add); /* CtMethod type= CtNewMethod.make( "public test2.Where getNewType() { return new test2.Where(); }", cc); cc.addMethod(type); */ cc.writeFile(); }