On Wed, 18 Oct 2023 09:45:53 GMT, Viktor Klang <[email protected]> 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. This pull request has now been integrated. Changeset: 200b5a27 Author: Viktor Klang <[email protected]> Committer: Paul Sandoz <[email protected]> URL: https://git.openjdk.org/jdk/commit/200b5a27d4bc77e2628a80d8166ee5d6057ab0c5 Stats: 24 lines in 1 file changed: 15 ins; 8 del; 1 mod 8318420: AbstractPipeline invokes overridden method in constructor Reviewed-by: psandoz ------------- PR: https://git.openjdk.org/jdk/pull/16239
