On Wed, 18 Oct 2023 09:45:53 GMT, Viktor Klang <vkl...@openjdk.org> wrote:

> This PR corrects so that `opIsStateful()` is not invoked as a part of the 
> java.util.stream.AbstractPipeline constructor—as `opIsStateful()` is intended 
> to be overridden by subclasses, and as their own constructors have not run 
> when their superclass constructor runs, this means that `opIsStateful()` 
> cannot base its return value on any class members of the subclass.
> 
> Since `opIsStateful()` is only needed for parallel streams, we can therefor 
> defer the invocation of `opIsStateful()` until evaluation-time, and as such 
> we can remove the need for having an instance field to store the result of 
> the invocation—making Stream instances potentially a tiny bit smaller, 
> reducing Stream-construction overhead, while still preserving semantics.

Marked as reviewed by psandoz (Reviewer).

-------------

PR Review: https://git.openjdk.org/jdk/pull/16239#pullrequestreview-1685991329

Reply via email to