Community
Participate
Working Groups
The following class compiles and runs under eclipse(Version: 3.1.2 Build id: M20060118-1600), but will not even compile under the sun jdk(1.5.0_05-b05). import java.util.ArrayList; import java.util.Arrays; class X { } class Z { } class Y<T> { public T t; public Y(T t) { this.t = t; } public String toString() { StringBuffer tmp = new StringBuffer("Y("); tmp.append(System.identityHashCode(this)); tmp.append("),t="); tmp.append(System.identityHashCode(t)); return tmp.toString(); } } public class TestAddAll { private static ArrayList<Y<X>> y = new ArrayList<Y<X>>(); public static void setY(Y[] array) { y.addAll(Arrays.asList(array)); System.out.println("setY: "+y); Y<X> ay = y.get(0); System.out.println("Y.t instanceof X: "+(ay.t instanceof X)); } public static void main(String[] args) { ArrayList<Y<Z>> yz = new ArrayList<Y<Z>>(); yz.add(new Y<Z>(new Z())); Y[] array = {}; array = yz.toArray(array); setY(array); } } The result when run under eclipse is: setY: [Y(25358555),t=26399554] Y.t instanceof X: false The result when trying to compile under the sun jdk is: [starksm@banshee9100 tests]$ javac TestAddAll.java TestAddAll.java:28: cannot find symbol symbol : method addAll(java.util.List<Y>) location: class java.util.ArrayList<Y<X>> y.addAll(Arrays.asList(array)); ^ 1 error This error seems correct as I should not be able to add an array of Y<Z> to a List<Y<X>> as I am able to do under eclipse.
This is fixed in 3.2RC7.
closing. maxime pls add a regression test
Released MethodVerifyTest#94 in HEAD.