RFR: 8023681: Fix raw type warning caused by Sink
Ali Ebrahimi
ali.ebrahimi1781 at gmail.com
Fri Aug 23 14:55:53 PDT 2013
you can try this.
private static Function<?,?> CASTING_IDENTITY = i -> i;
@SuppressWarnings("unchecked")
private static <I, R> Function<I, R> castingIdentity() {
return (Function<I, R>) CASTING_IDENTITY;
}
On Sat, Aug 24, 2013 at 2:10 AM, Mike Duigou <mike.duigou at oracle.com> wrote:
> I considered that as well but since the types are generics you'd have to
> cast anyway.
>
> The only viable declaration is:
>
> private static Function<?,?> CASTING_IDENTITY = i -> i;
>
> On usage you'd have to add (Function<I,R>) CASTING_IDENTITY
>
> (Which assumes the compiler would even accept this heinous cast, I haven't
> tried it)
>
> Mike
>
> On Aug 23 2013, at 14:18 , Ali Ebrahimi wrote:
>
> > Why not to make castingIdentity method a constant?
> >
> >
> > On Fri, Aug 23, 2013 at 11:47 PM, Henry Jen <henry.jen at oracle.com>
> wrote:
> >
> >> Hi,
> >>
> >> Please kindly review the fix for eliminate some warnings in
> >> java.util.stream package.
> >>
> >> Chained Sink is an internal implementation detail, add the type for
> >> downstream is more precise but verbose.
> >>
> >> Included is also a couple other warnings cleanup.
> >>
> >> http://cr.openjdk.java.net/~henryjen/tl/8023681.0/webrev/
> >>
> >> Cheers,
> >> Henry
> >>
> >>
>
>
More information about the lambda-dev
mailing list