Proposal: Collection Literals

Neal Gafter neal at
Tue Mar 31 09:22:57 PDT 2009

On Tue, Mar 31, 2009 at 8:33 AM, Joshua Bloch <jjb at> wrote:
> 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>[].

Your comments about arrays interactions with reified types applies to
arrays today with ordinary, non-generic types.  I understand your
desire to provide arrays with less than first-class treatment even
with reification and recommend List instead, but I don't think we
should be constraining the design space at this time.

More information about the coin-dev mailing list