AbstractPipeline invokes overridden method in constructor

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P5
    • 22
    • Affects Version/s: None
    • Component/s: core-libs
    • None

      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.

            Assignee:
            Viktor Klang
            Reporter:
            Viktor Klang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: