Strange Exception: Register x contains wrong type
-------------------------------------------------
Key: JASSIST-67
URL:
https://jira.jboss.org/jira/browse/JASSIST-67
Project: Javassist
Issue Type: Bug
Affects Versions: 3.8.1.GA
Environment: windowsXP
Reporter: kobe valiant
Assignee: Shigeru Chiba
Priority: Blocker
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira