Skip to content

Commit 558eab2

Browse files
committed
8292877: java/util/concurrent/atomic/Serial.java uses {Double,Long}Accumulator incorrectly
Backport-of: 251bff6beeafcd98824dab60e9831c0175fe0689
1 parent 6ed8694 commit 558eab2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/jdk/java/util/concurrent/atomic/Serial.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ static void testDoubleAdder() {
6464
}
6565

6666
static void testDoubleAccumulator() {
67-
DoubleBinaryOperator plus = (DoubleBinaryOperator & Serializable) (x, y) -> x + y;
68-
DoubleAccumulator a = new DoubleAccumulator(plus, 13.9d);
67+
DoubleBinaryOperator op = (DoubleBinaryOperator & Serializable) (x, y) -> Math.max(x, y);
68+
DoubleAccumulator a = new DoubleAccumulator(op, Double.NEGATIVE_INFINITY);
6969
a.accumulate(17.5d);
7070
DoubleAccumulator result = echo(a);
7171
if (result.get() != a.get())
@@ -89,8 +89,8 @@ static void testLongAdder() {
8989
}
9090

9191
static void testLongAccumulator() {
92-
LongBinaryOperator plus = (LongBinaryOperator & Serializable) (x, y) -> x + y;
93-
LongAccumulator a = new LongAccumulator(plus, -2);
92+
LongBinaryOperator op = (LongBinaryOperator & Serializable) (x, y) -> Math.max(x, y);
93+
LongAccumulator a = new LongAccumulator(op, Long.MIN_VALUE);
9494
a.accumulate(34);
9595
LongAccumulator result = echo(a);
9696
if (result.get() != a.get())

0 commit comments

Comments
 (0)