[jboss-jira] [JBoss JIRA] (JASSIST-230) Javassist throws java.lang.VerifyError with dead code

Kelvin Law (JIRA) issues at jboss.org
Mon Jul 28 07:49:30 EDT 2014


Kelvin Law created JASSIST-230:
----------------------------------

             Summary: 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


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.




--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list