Type inference problem with JDK 8 Build 82
Gernot Neppert
mcnepp02 at googlemail.com
Wed Apr 3 08:01:32 PDT 2013
Hi Remi,
like all 'Never use pattern X' rules, the one you cite seems generally
warranted, but may be overruled for good reason occasionally!
You may have noticed the analogy of the above 'cast' method with
'java.lang.Class.asSubclass()', which also returns a wildcard type (also
for good reason)
Gernot
2013/4/3 Remi Forax <forax at univ-mlv.fr>
> On 04/03/2013 04:39 PM, Gernot Neppert wrote:
> > Hi,
> [ ... ]
>
> > Here's a condensed version of the source that causes the problem:
> >
> > interface Expression<S,T> {
> > <U> Expression<S,? extends U> cast(Class<U> target);
> > }
>
> It's not related to lambda but please,
> never use a ? extends/? super in a return type,
> or you will bother you user to death because they also will
> have to write wildcards.
>
> Rémi
>
>
>
More information about the lambda-dev
mailing list