[ 
https://issues.apache.org/jira/browse/BCEL-193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Thomas resolved BCEL-193.
------------------------------
       Resolution: Fixed
    Fix Version/s: 6.0

Patch applied with only trivial whitespace changes.

Many thanks.

My comment re source information for the class files still stands but I'm happy 
to resolve this issue without it. (Worst case if we ever need to we can reverse 
engineer the class files).

> aastore instruction should not raise a verify error if an assignment 
> compatiblity error is detected
> ---------------------------------------------------------------------------------------------------
>
>                 Key: BCEL-193
>                 URL: https://issues.apache.org/jira/browse/BCEL-193
>             Project: Commons BCEL
>          Issue Type: Bug
>          Components: Verifier
>    Affects Versions: 6.0
>            Reporter: Jérôme Leroux
>             Fix For: 6.0
>
>         Attachments: BCEL-193.patch, BCEL-193.zip
>
>
> The following valid code raises a verify error:
> {code:java}
> public class TestArrayAccess01 extends XTestArray01{
>     public static void test(){
>         XTestArray01[] array = new TestArrayAccess01[1];
>         array[0] = new XTestArray01();
>     }   
> }
> class XTestArray01 {}
> {code}
> The code above will throw an {{ArrayStoreException}} at runtime but the 
> generated bytecode is valid.
> _The Java Virtual Machine Specification Second Edition_ is ambigous about 
> this kind of issue. It states in §4.8.2 _Structural Constraints_ 
> (http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#9308):
> {quote}
> The type of every value stored into an array of type reference by an aastore 
> instruction must be assignment compatible (§2.6.7) with the component type of 
> the array.
> {quote}
> But in the {{aastore}} opcode description, there is no reference to any kind 
> of linking or verification error. The assignment compatiblity error is a 
> runtime exception.
> In the _Java SE 7 Edition_ of __The Java Virtual Machine Specification_, the 
> §4 has been modified 
> (http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.9.2):
> {quote}
> The type of every value stored into an array by an aastore instruction must 
> be a reference type.
> The component type of the array being stored into by the aastore instruction 
> must also be a reference type. 
> {quote}
> The assignment compatibility check must not be done during the verification 
> of the bytecode but during its execution.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to