[jboss-jira] [JBoss JIRA] (JASSIST-254) javassist.bytecode.analysis.Analyzer causes errors for valid Java (byte) code

Maximilian Scherr (JIRA) issues at jboss.org
Wed Nov 4 04:33:00 EST 2015


Maximilian Scherr created JASSIST-254:
-----------------------------------------

             Summary: javassist.bytecode.analysis.Analyzer causes errors for valid Java (byte) code
                 Key: JASSIST-254
                 URL: https://issues.jboss.org/browse/JASSIST-254
             Project: Javassist
          Issue Type: Bug
    Affects Versions: 3.20.0-GA
            Reporter: Maximilian Scherr
            Assignee: Shigeru Chiba
            Priority: Optional


The data-flow analysis of javassist.bytecode.analysis.Analyzer reports errors for valid bytecode.

The issue can be traced back to the components desire to be accurate with interface assignability (whereas the JVM verifier seems to ignore this or is more lenient, cf. JVM specification 4.10.1.2. Verification Type System).

Assuming an Object typed variable is initialized with a class implementing two interfaces and we want to use this variable in methods for these two interfaces we can for both of them do an intersection cast (IntA & IntB) for its argument. This is valid Java, and in bytecode this will turn into a serious of casts to make sure the intersection holds.

It does not seem to matter to the JVM bytecode verifier in which order, but for Analyzer the last cast will determine the type of the operand/argument.  So sometimes this will lead to a wrong argument type. The example below should clarify what I mean.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list