Bug 73530

Summary: [1.5] VerifyError using generics and direct array access
Product: [Eclipse Project] JDT Reporter: Christoph Lembeck <christoph.lembeck>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Christoph Lembeck CLA 2004-09-09 07:00:31 EDT
Accessing arrays directly after reading them out of a collection like a Vector 
leads to a VerifyError using Integration Build I20040907. The problem can be 
reproduced using the following code:

import java.util.Vector;
public class VMTest{
  public static void main(String[] args){
    Vector<Integer[]> v = new Vector<Integer[]>();
    Integer[] array1 = new Integer[5];
    array1[0] = new Integer(17);
    array1[1] = new Integer(42);
    v.add(array1);
    Integer twentyfour = v.get(0)[1];  // responsible for the crash
    System.out.println(twentyfour);
  }
}

Replacing the line
  Integer twentyfour = v.get(0)[1];
by the two lines
  Integer[] array2 = v.get(0);
  Integer twentyfour = array2[1];
will fix the problem, but i think the original code should work as well...

The error message is:
java.lang.VerifyError: (class: VMTest, method: main signature: 
([Ljava/lang/String;)V) Expecting to find array of objects or arrays on stack
Exception in thread "main"
Comment 1 Christoph Lembeck CLA 2004-09-09 07:02:45 EDT
*** Bug 73531 has been marked as a duplicate of this bug. ***
Comment 2 Olivier Thomann CLA 2004-09-09 14:38:43 EDT
I will investigate.
Comment 3 Olivier Thomann CLA 2004-09-09 14:49:51 EDT
There is a missing checkcast in the code generated by Eclipse. This is leading
to this VerifyError.
Comment 4 Olivier Thomann CLA 2004-09-09 15:00:30 EDT
ArrayReference was missing a call to computeConversion for the receiver.
Fixed and released in HEAD.
Regression test added.
Comment 5 Philipe Mulet CLA 2004-09-10 05:25:55 EDT
Olivier - where is the fix?
Comment 6 Philipe Mulet CLA 2004-09-10 05:44:06 EDT
Found fix on ArrayReference, looks good.
Comment 7 David Audel CLA 2004-09-23 12:55:45 EDT
Verified in I200409230100.