Bug 73530 - [1.5] VerifyError using generics and direct array access
Summary: [1.5] VerifyError using generics and direct array access
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 73531 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-09-09 07:00 EDT by Christoph Lembeck CLA
Modified: 2004-09-23 12:55 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.