commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryce L Nordgren <bnordg...@fs.fed.us>
Subject Re: [collections] VOTE: Collections-java5 direction
Date Mon, 12 Mar 2007 21:29:25 GMT


Jess Holle <jessh@ptc.com> wrote on 03/12/2007 03:09:49 PM:

> Bryce L Nordgren wrote:
> > Thing 2: (snipped)
> > ========
> > Generics do not even
> > contain a way to express "this collection is potentially composed of a
> > mixture of elements, but every element is guaranteed to be between
{Parent}
> > and {Child} in the class hierarchy".  In order to implement this type
of
> > checked behavior, Java Generics requires that we use the "unchecked"
> > syntax.
> >
> You can express the bounds of <? extends A super B>, right?  There's
> even a more obscure syntax for expressing something that extends
> multiple classes in cases.

My fears have just been amplified by about an order of magnitude.  Your
expression does not repeat _NOT_ mean: "this collection is potentially
composed of a mixture of elements, but every element is guaranteed to be
between {Parent} and {Child} in the class hierarchy".  It means "this
collection contains elements all of the same type, and this type is
guaranteed to be between {Parent} and {Child}."

Use Java generics to express concepts that Java generics actually contains
a vocabulary for.  However, please do not exclude current functionality
merely because Java generics cannot articulate the concept.

Generics is a minefield.  Please be extremely cautious.

Bryce


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message