RFR: 8023681: Fix raw type warning caused by Sink

Ali Ebrahimi ali.ebrahimi1781 at gmail.com
Fri Aug 23 15:03:45 PDT 2013


nice. So we have currently this optimization?


On Sat, Aug 24, 2013 at 2:14 AM, Brian Goetz <brian.goetz at oracle.com> wrote:

> Because non-capturing lambdas are *already* constants!  The commonly used
> trick, that was needed with inner classes to avoid instantiating multiple
> instances of essentially identical objects:
>
>   static final Comparator<String> c = new Comparator() { ... }
>
> is effectively implemented automatically (and lazily, instantiated only on
> first use) by the language runtime for non-capturing lambdas.  So the
> "extract into a static" trick can be relegated to the scrap heap of
> "optimizations that don't optimize but still crap up your code".
>
> And, since the method castingIdentity() returns a constant, it will be
> routinely inlined into a constant load.
>
>
> On 8/23/2013 5:18 PM, 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/<http://cr.openjdk.java.net/~henryjen/tl/8023681.0/webrev/>
>>>
>>> Cheers,
>>> Henry
>>>
>>>
>>>


More information about the lambda-dev mailing list