Proposal: Collection Literals

Joshua Bloch jjb at
Tue Mar 31 08:33:16 PDT 2009

Even if we were to reify generics in a future release, arrays of sets would
remain a bad idea. Arrays are covariant and sets are non-variant.  The
combination of the two is problematic.  Currently it isn't even typesafe
(hence the ban on generic array creation).  With reification of generics,
arrays of sets could be made typesafe, but would still admit the possibility
of runtime errors that would be caught at compile time if you used
List<Set<T>> in place of Set<T>[].


On Tue, Mar 31, 2009 at 7:37 AM, Neal Gafter <neal at> wrote:

> On Tue, Mar 31, 2009 at 1:34 AM, Joshua Bloch <jjb at> wrote:
> > Arrays
> > of sets are an awful idea anyway, so it's no great loss.
> It might not remain such an awful idea if we have reified generics in
> the future.  I don't think forbidding this combination is a great
> idea.

More information about the coin-dev mailing list