On Thu, 9 Nov 2023 09:39:16 GMT, Viktor Klang <[email protected]> wrote:
>> src/java.base/share/classes/java/util/stream/Gatherer.java line 535:
>>
>>> 533: */
>>> 534: @ForceInline
>>> 535: static <A, T, R> Integrator<A, T, R> of(Integrator<A, T, R>
>>> integrator) {
>>
>> While this idiom is very convenient, there are some trap doors in
>> combinations with method references and compatibility which is why we backed
>> out of https://github.com/openjdk/jdk/pull/16213
>>
>> It is good that the text mentions "lambda" but maybe we should explicitly
>> mention that method references might introduce said problems?
>
> This idiom is safer than casts since the casts are blind and need
> unchecked-annotations. I'm willing to take this approach for an evaluation
> during the Preview phase.
I like the concept but we could document how to safely use it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1387949245