What is the reason why classes with a recursive definition cannot be generated?
For example, the call to 'toClass()' in the following test case produces the
exception stacktrace below :
| import javassist.CannotCompileException;
| import javassist.ClassPool;
| import javassist.CtField;
| import javassist.CtNewClass;
| import javassist.NotFoundException;
| import junit.framework.TestCase;
|
| public class TestRecursiveClass extends TestCase {
| public void test() throws NotFoundException, CannotCompileException {
| ClassPool pool=ClassPool.getDefault();
|
| CtNewClass recursiveClass = new CtNewClass("RecursiveClass", pool ,
false, pool.get("java.lang.Object"));
| CtField f=new CtField(recursiveClass, "instance", recursiveClass);
| recursiveClass.addField(f, "null");
|
| recursiveClass.toClass();
| }
| }
|
Exception stacktrace :
| javassist.CannotCompileException: by javassist.CannotCompileException:
cannot find RecursiveClass
| at javassist.ClassPool.toClass(ClassPool.java:816)
| at javassist.ClassPool.toClass(ClassPool.java:765)
| at javassist.CtClass.toClass(CtClass.java:985)
| at TestRecursiveClass.test(TestRecursiveClass.java:16)
|
(rest of stack trace omitted)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3943857#3943857
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3943857
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user