You can declare a reference variable of an array type whose component type is a concrete parameterized type. Arrays of such a type must not be created. Hence, this reference variable cannot refer to an array of its type. All that it can refer to is null , an array whose component type is a non-parameterized subtype of the concrete parameterized type, or an array whose component type is the corresponding raw type. Neither of these cases is overly useful, yet they are permitted.
So these are allowed:
[ November 25, 2007: Message edited by: Jan Nowak ]
Originally posted by Jesper Young: This might be solved when generics are implemented differently (without type erasure). People are thinking about how to do this in Java 7.
Hallelujah! Is there a JSR for this? If not, do you have a link to where I can read more about this ongoing design work?
Personally, I think Java's generics are one of its few truly botched language features. I mean, it's amazing that they managed to accomplish so much with the type erasure mechanism, but in my experience this seems to confuse so many developers that I really wonder whether the added type safety was worth it.