]
Shigeru Chiba resolved JASSIST-230.
-----------------------------------
Fix Version/s: 3.19.0-GA
Resolution: Done
Javassist throws java.lang.VerifyError with dead code
-----------------------------------------------------
Key: JASSIST-230
URL:
https://issues.jboss.org/browse/JASSIST-230
Project: Javassist
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Affects Versions: 3.18.2-GA
Reporter: Kelvin Law
Assignee: Shigeru Chiba
Fix For: 3.19.0-GA
I found the root cause of the Javassist throws java.lang.VerifyError with JRE 7, but the
exact same binary works on JRE6
It is because of dead code like the following:
if (false) {
do something;
}
These code is generated by the template:
if (${transitory}) {
do something;
}
The reason why we have such dead code in our generated java classes is, it is far more
easier to code and maintain condition checking in runtime logic(in Java) instead of
template logic (template expression). And we think that the if (false) statement does not
make significant performance degradation in runtime.
Although these code could be avoided, this is comply with Java 1.4/5/6/7 syntax standard
thus it works with Javassist on JRE 6. Obviously It is a bug in Javassist.
I have the following: tentative solution:
Rewrite the if (${transitory}) with if (${transitory == true})
I tested the above solution and found that Javassist works with that. No more
java.lang.VerifyError. And I believe it does not make significant performance degradation
in runtime.