|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
GenericsTypeHi!
Does anybody know why do we have public ClassNode getLowerBound() { return lowerBound; } but public ClassNode[] getUpperBounds() { return upperBounds; } One type in 1st case instead of array at the second Best regards Alex --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: GenericsTypeAlex Tkachman schrieb:
> Hi! > > Does anybody know why do we have > > > public ClassNode getLowerBound() { > return lowerBound; > } > > but > > public ClassNode[] getUpperBounds() { > return upperBounds; > } > > One type in 1st case instead of array at the second From http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeArguments.html#FAQ203 """ A wildcard can have only one bound, either a lower or an upper bound. A list of wildcard bounds is not permitted. A type parameter, in contrast, can have several bounds, but there is no such thing as a lower bound for a type parameter. """ According to the second one there is no such thing as a lower bound for a type parameter so I assumed upper bounds, and an array of them <T extends GroovyObject & Runnable & Clonable> would be an example. I think we don't check, that you can have at most one class in there. bye blackdrag -- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: GenericsTypeWow, thanks a lot.
I totally forgot that if ever knew. On Wed, Oct 21, 2009 at 1:14 PM, Jochen Theodorou <blackdrag@...> wrote: > Alex Tkachman schrieb: >> >> Hi! >> >> Does anybody know why do we have >> >> >> public ClassNode getLowerBound() { >> return lowerBound; >> } >> >> but >> >> public ClassNode[] getUpperBounds() { >> return upperBounds; >> } >> >> One type in 1st case instead of array at the second > > From > http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeArguments.html#FAQ203 > """ > A wildcard can have only one bound, either a lower or an upper bound. A > list of wildcard bounds is not permitted. > > A type parameter, in contrast, can have several bounds, but there is no such > thing as a lower bound for a type parameter. > """ > > According to the second one there is no such thing as a lower bound for a > type parameter so I assumed upper bounds, and an array of them > > <T extends GroovyObject & Runnable & Clonable> > > would be an example. I think we don't check, that you can have at most one > class in there. > > bye blackdrag > > -- > Jochen "blackdrag" Theodorou > The Groovy Project Tech Lead (http://groovy.codehaus.org) > http://blackdragsview.blogspot.com/ > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |