mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8318420: AbstractPipeline invokes overridden method in constructor
Reviewed-by: psandoz
This commit is contained in:
parent
52814994ef
commit
200b5a27d4
1 changed files with 16 additions and 9 deletions
|
@ -134,12 +134,6 @@ abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
|
||||||
*/
|
*/
|
||||||
private boolean linkedOrConsumed;
|
private boolean linkedOrConsumed;
|
||||||
|
|
||||||
/**
|
|
||||||
* True if there are any stateful ops in the pipeline; only valid for the
|
|
||||||
* source stage.
|
|
||||||
*/
|
|
||||||
private boolean sourceAnyStateful;
|
|
||||||
|
|
||||||
private Runnable sourceCloseAction;
|
private Runnable sourceCloseAction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,8 +202,6 @@ abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
|
||||||
this.sourceOrOpFlags = opFlags & StreamOpFlag.OP_MASK;
|
this.sourceOrOpFlags = opFlags & StreamOpFlag.OP_MASK;
|
||||||
this.combinedFlags = StreamOpFlag.combineOpFlags(opFlags, previousStage.combinedFlags);
|
this.combinedFlags = StreamOpFlag.combineOpFlags(opFlags, previousStage.combinedFlags);
|
||||||
this.sourceStage = previousStage.sourceStage;
|
this.sourceStage = previousStage.sourceStage;
|
||||||
if (opIsStateful())
|
|
||||||
sourceStage.sourceAnyStateful = true;
|
|
||||||
this.depth = previousStage.depth + 1;
|
this.depth = previousStage.depth + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,6 +378,21 @@ abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
|
||||||
return StreamOpFlag.toStreamFlags(combinedFlags);
|
return StreamOpFlag.toStreamFlags(combinedFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether any of the stages of the current segment is stateful
|
||||||
|
* or not.
|
||||||
|
* @return {@code true} if any stage in this segment is stateful,
|
||||||
|
* {@code false} if not.
|
||||||
|
*/
|
||||||
|
protected final boolean hasAnyStateful() {
|
||||||
|
var result = false;
|
||||||
|
for (var u = sourceStage.nextStage;
|
||||||
|
u != null && !(result = u.opIsStateful()) && u != this;
|
||||||
|
u = u.nextStage) {
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the source spliterator for this pipeline stage. For a sequential or
|
* Get the source spliterator for this pipeline stage. For a sequential or
|
||||||
* stateless parallel pipeline, this is the source spliterator. For a
|
* stateless parallel pipeline, this is the source spliterator. For a
|
||||||
|
@ -409,7 +416,7 @@ abstract class AbstractPipeline<E_IN, E_OUT, S extends BaseStream<E_OUT, S>>
|
||||||
throw new IllegalStateException(MSG_CONSUMED);
|
throw new IllegalStateException(MSG_CONSUMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isParallel() && sourceStage.sourceAnyStateful) {
|
if (isParallel() && hasAnyStateful()) {
|
||||||
// Adapt the source spliterator, evaluating each stateful op
|
// Adapt the source spliterator, evaluating each stateful op
|
||||||
// in the pipeline up to and including this pipeline stage.
|
// in the pipeline up to and including this pipeline stage.
|
||||||
// The depth and flags of each pipeline stage are adjusted accordingly.
|
// The depth and flags of each pipeline stage are adjusted accordingly.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue