http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf
This bug is being created based on feedback received via the website...
one typo in first paragraph below ("IIn"), plus the technical error reported below:
============
IIn the next variation, we refrain from creating an array object whose element type
is parameterized, but still use an array type with a parameterized element type. This is
legal, but generates an unchecked warning. Indeed, the code is unsafe, and eventually
an error occurs.
************************
Fixed in my version. Once I've corrected all known problems, we'll push out a new version on the web.
List<String>[] lsa = new List<?>[10]; // unchecked warning - this is unsafe!
Object o = lsa;
Object[] oa = (Object[]) o;
List<Integer> li = new ArrayList<Integer>();
li.add(new Integer(3));
oa[1] = li; // correct
String s = lsa[1].get(0); // run time error, but we were warned
However, this line
List<String>[] lsa = new List<?>[10]; // unchecked warning - this is unsafe!
generates a compiler error, not a warning.
###@###.### 2005-03-02 22:41:15 GMT
###@###.### 2005-03-21 22:52:09 GMT