diff --git a/src/java.base/share/classes/java/util/ArrayList.java b/src/java.base/share/classes/java/util/ArrayList.java --- a/src/java.base/share/classes/java/util/ArrayList.java +++ b/src/java.base/share/classes/java/util/ArrayList.java @@ -1696,6 +1696,7 @@ @Override public void replaceAll(UnaryOperator operator) { replaceAllRange(operator, 0, size); + // TODO(8203662): remove increment of modCount from ... modCount++; } diff --git a/src/java.base/share/classes/java/util/Vector.java b/src/java.base/share/classes/java/util/Vector.java --- a/src/java.base/share/classes/java/util/Vector.java +++ b/src/java.base/share/classes/java/util/Vector.java @@ -1369,6 +1369,7 @@ es[i] = operator.apply(elementAt(es, i)); if (modCount != expectedModCount) throw new ConcurrentModificationException(); + // TODO(8203662): remove increment of modCount from ... modCount++; } diff --git a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java --- a/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java +++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentSkipListMap.java @@ -1712,9 +1712,8 @@ Map m = (Map) o; try { Comparator cmp = comparator; - @SuppressWarnings("unchecked") - Iterator> it = - (Iterator>)m.entrySet().iterator(); + // See JDK-8223553 for Iterator type wildcard rationale + Iterator> it = m.entrySet().iterator(); if (m instanceof SortedMap && ((SortedMap)m).comparator() == cmp) { Node b, n; diff --git a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java @@ -867,8 +867,8 @@ growArray(true); else { phase = 0; // full volatile unlock - if (a[m & (s - 1)] == null) - signal = true; // was empty + if (((s - base) & ~1) == 0) // size 0 or 1 + signal = true; } } return signal; @@ -2667,13 +2667,13 @@ } /** - * Returns an estimate of the total number of tasks stolen from - * one thread's work queue by another. The reported value - * underestimates the actual total number of steals when the pool - * is not quiescent. This value may be useful for monitoring and - * tuning fork/join programs: in general, steal counts should be - * high enough to keep threads busy, but low enough to avoid - * overhead and contention across threads. + * Returns an estimate of the total number of completed tasks that + * were executed by a thread other than their submitter. The + * reported value underestimates the actual total number of steals + * when the pool is not quiescent. This value may be useful for + * monitoring and tuning fork/join programs: in general, steal + * counts should be high enough to keep threads busy, but low + * enough to avoid overhead and contention across threads. * * @return the number of steals */ diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java @@ -360,7 +360,7 @@ * Returns the current value of this {@code AtomicInteger} as a * {@code long} after a widening primitive conversion, * with memory effects as specified by {@link VarHandle#getVolatile}. - * @jls 5.1.2 Widening Primitive Conversions + * @jls 5.1.2 Widening Primitive Conversion */ public long longValue() { return (long)get(); @@ -370,7 +370,7 @@ * Returns the current value of this {@code AtomicInteger} as a * {@code float} after a widening primitive conversion, * with memory effects as specified by {@link VarHandle#getVolatile}. - * @jls 5.1.2 Widening Primitive Conversions + * @jls 5.1.2 Widening Primitive Conversion */ public float floatValue() { return (float)get(); @@ -380,7 +380,7 @@ * Returns the current value of this {@code AtomicInteger} as a * {@code double} after a widening primitive conversion, * with memory effects as specified by {@link VarHandle#getVolatile}. - * @jls 5.1.2 Widening Primitive Conversions + * @jls 5.1.2 Widening Primitive Conversion */ public double doubleValue() { return (double)get(); diff --git a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java --- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java +++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java @@ -364,7 +364,7 @@ * Returns the current value of this {@code AtomicLong} as an {@code int} * after a narrowing primitive conversion, * with memory effects as specified by {@link VarHandle#getVolatile}. - * @jls 5.1.3 Narrowing Primitive Conversions + * @jls 5.1.3 Narrowing Primitive Conversion */ public int intValue() { return (int)get(); @@ -383,7 +383,7 @@ * Returns the current value of this {@code AtomicLong} as a {@code float} * after a widening primitive conversion, * with memory effects as specified by {@link VarHandle#getVolatile}. - * @jls 5.1.2 Widening Primitive Conversions + * @jls 5.1.2 Widening Primitive Conversion */ public float floatValue() { return (float)get(); @@ -393,7 +393,7 @@ * Returns the current value of this {@code AtomicLong} as a {@code double} * after a widening primitive conversion, * with memory effects as specified by {@link VarHandle#getVolatile}. - * @jls 5.1.2 Widening Primitive Conversions + * @jls 5.1.2 Widening Primitive Conversion */ public double doubleValue() { return (double)get(); diff --git a/test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java b/test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java --- a/test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java +++ b/test/jdk/java/util/concurrent/BlockingQueue/DrainToFails.java @@ -35,6 +35,7 @@ /* * @test * @summary Test drainTo failing due to c.add throwing + * @library /test/lib */ import java.util.ArrayList; @@ -50,9 +51,11 @@ import java.util.concurrent.RunnableScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import jdk.test.lib.Utils; @SuppressWarnings({"unchecked", "rawtypes"}) public class DrainToFails { + static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000); final int CAPACITY = 10; final int SMALL = 2; @@ -169,7 +172,7 @@ fail("should throw"); } catch (IllegalStateException success) { for (Thread putter : putters) { - putter.join(2000L); + putter.join(LONG_DELAY_MS); check(! putter.isAlive()); } assertContentsInOrder(q2, 2, 3); @@ -183,11 +186,10 @@ } } - Runnable putter(final BlockingQueue q, final int elt) { - return new Runnable() { - public void run() { + Runnable putter(BlockingQueue q, int elt) { + return () -> { try { q.put(elt); } - catch (Throwable t) { unexpected(t); }}}; + catch (Throwable t) { unexpected(t); }}; } void assertContentsInOrder(Iterable it, Object... contents) {