Hi
I think this is a bug of javassist.
| ClassPool pool = new ClassPool(true);
| CtClass ctc = pool.makeClass("my.Clazz");
| StringBuilder sb = new StringBuilder("public void test() {");
| for (int i = 0; i < 1000; i++) {
|
| sb.append("for(int i=0; i<10; i++) {}"); // line
1
| // sb.append("for(int i=0; i<10; i++) {int j=i;}"); // line
2
|
| }
|
| sb.append("}");
| ctc.addMethod(CtNewMethod.make(sb.toString(), ctc));
| ctc.toClass().newInstance();
|
the code above will throw an exception:
Exception in thread "main" java.lang.VerifyError: (class: my/Clazz, method: test
signature: ()V) Register 0 contains wrong type
But if you comment the line 1 and uncomment the line 2, there will no exception at all.
It realy confuses me. Anyone who know the reason or workaround please tell me, this
problem block the project I'm working onãÂÂ
Thanks
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185953#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...