RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview) [v2]

Per Minborg pminborg at openjdk.org
Thu Nov 9 12:47:12 UTC 2023


On Thu, 9 Nov 2023 09:39:16 GMT, Viktor Klang <vklang at openjdk.org> 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


More information about the core-libs-dev mailing list