-
Enhancement
-
Resolution: Fixed
-
P5
-
None
-
None
-
b21
Currently java.util.stream.AbstractPipeline's constructor calls the designed-to-be-overridden `opIsStateful()` which means that since the AbstractPipeline constructor runs before the subclass' initialization logic, that means that any implementations of `opIsStateful()` must only rely on global state and/or constants.
Furthermore, `opIsStateful()` is only used for parallel evaluation, and currently requires a boolean field per AbstractPipeline (`hasAnyStateful`) regardless of whether they ever need to evaluate in parallel or not.
It should be possible to avoid needing the `hasAnyStateful` field, as well as avoiding to call `opIsStateful()` in the AbstractPipeline constructor, so that implementations thereof can use instance state to produce their values, and only invoke it for parallel evaluations.
Furthermore, `opIsStateful()` is only used for parallel evaluation, and currently requires a boolean field per AbstractPipeline (`hasAnyStateful`) regardless of whether they ever need to evaluate in parallel or not.
It should be possible to avoid needing the `hasAnyStateful` field, as well as avoiding to call `opIsStateful()` in the AbstractPipeline constructor, so that implementations thereof can use instance state to produce their values, and only invoke it for parallel evaluations.