Jess Holle <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]