[jboss-user] [Javassist user questions] - Strange Exception: Register x contains wrong type
kobevaliant
do-not-reply at jboss.com
Fri Oct 31 05:51:38 EDT 2008
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#4185953
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185953
More information about the jboss-user
mailing list