RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview) [v4]
Andrey Turbanov
aturbanov at openjdk.org
Mon Nov 13 09:03:19 UTC 2023
On Mon, 13 Nov 2023 07:24:24 GMT, Viktor Klang <vklang at openjdk.org> wrote:
>> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461)
>
> Viktor Klang has updated the pull request incrementally with one additional commit since the last revision:
>
> Addressing further review feedback
src/java.base/share/classes/java/util/stream/GathererOp.java line 86:
> 84: final static class NodeBuilder<X> implements Consumer<X> {
> 85: private final static int LINEAR_APPEND_MAX = 8; // TODO revisit
> 86: final static class Builder<X> extends SpinedBuffer<X> implements Node<X> {
Let's use blessed modifiers order:
Suggestion:
static final class NodeBuilder<X> implements Consumer<X> {
private static final int LINEAR_APPEND_MAX = 8; // TODO revisit
static final class Builder<X> extends SpinedBuffer<X> implements Node<X> {
src/java.base/share/classes/java/util/stream/GathererOp.java line 139:
> 137: }
> 138:
> 139: final static class GatherSink<T, A, R> implements Sink<T>, Gatherer.Downstream<R> {
Let's use blessed modifiers order:
Suggestion:
static final class GatherSink<T, A, R> implements Sink<T>, Gatherer.Downstream<R> {
src/java.base/share/classes/java/util/stream/GathererOp.java line 221:
> 219: DEFAULT_FLAGS | StreamOpFlag.IS_SHORT_CIRCUIT;
> 220:
> 221: private final static int GREEDY_FLAGS =
Let's use blessed modifiers order:
Suggestion:
private static final int DEFAULT_FLAGS =
StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT |
StreamOpFlag.NOT_SIZED;
private static final int SHORT_CIRCUIT_FLAGS =
DEFAULT_FLAGS | StreamOpFlag.IS_SHORT_CIRCUIT;
private static final int GREEDY_FLAGS =
test/jdk/java/util/stream/GatherersTest.java line 248:
> 246:
> 247: // Test cancellation after exception during processing
> 248: if(config.streamSize > 2) { // We need streams of a minimum size to test this
Suggestion:
if (config.streamSize > 2) { // We need streams of a minimum size to test this
test/jdk/java/util/stream/GatherersTest.java line 257:
> 255: .gather(
> 256: Gatherers.mapConcurrent(config.streamSize(), i -> {
> 257: switch(i) {
Suggestion:
switch (i) {
test/jdk/java/util/stream/GatherersTest.java line 285:
> 283: .toList();
> 284: fail("This should not be reached");
> 285: } catch(Throwable e) {
Suggestion:
} catch (Throwable e) {
test/jdk/java/util/stream/GatherersTest.java line 286:
> 284: fail("This should not be reached");
> 285: } catch(Throwable e) {
> 286: while(e.getCause() != null)
Suggestion:
while (e.getCause() != null)
test/jdk/java/util/stream/GatherersTest.java line 298:
> 296:
> 297: // Test cancellation during short-circuiting
> 298: if(config.streamSize > 2) {
Suggestion:
if (config.streamSize > 2) {
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390783396
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390783885
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390784768
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390785381
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390786469
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390785634
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390785784
PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1390785930
More information about the core-libs-dev
mailing list