8219138: Miscellaneous changes imported from jsr166 CVS 2019-05
authordl
Thu, 02 May 2019 06:33:28 -0700
changeset 54686 09f09b4e7808
parent 54685 e1bec7613945
child 54687 df2b3565f343
8219138: Miscellaneous changes imported from jsr166 CVS 2019-05 Reviewed-by: martin
test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java
test/jdk/java/util/concurrent/tck/Atomic8Test.java
test/jdk/java/util/concurrent/tck/AtomicIntegerArray9Test.java
test/jdk/java/util/concurrent/tck/AtomicLongArray9Test.java
test/jdk/java/util/concurrent/tck/AtomicReferenceArray9Test.java
test/jdk/java/util/concurrent/tck/Collection8Test.java
test/jdk/java/util/concurrent/tck/CompletableFutureTest.java
test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java
test/jdk/java/util/concurrent/tck/HashtableTest.java
test/jdk/java/util/concurrent/tck/JSR166TestCase.java
test/jdk/java/util/concurrent/tck/SplittableRandomTest.java
test/jdk/java/util/concurrent/tck/StampedLockTest.java
test/jdk/java/util/concurrent/tck/ThreadLocalRandom8Test.java
test/jdk/java/util/concurrent/tck/VectorTest.java
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java	Thu May 02 06:33:28 2019 -0700
@@ -167,14 +167,17 @@
         ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
         System.err.println("------ stacktrace dump start ------");
         for (ThreadInfo info : threadMXBean.dumpAllThreads(true, true)) {
-            String name = info.getThreadName();
+            final String name = info.getThreadName();
+            String lockName;
             if ("Signal Dispatcher".equals(name))
                 continue;
             if ("Reference Handler".equals(name)
-                && info.getLockName().startsWith("java.lang.ref.Reference$Lock"))
+                && (lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref.Reference$Lock"))
                 continue;
             if ("Finalizer".equals(name)
-                && info.getLockName().startsWith("java.lang.ref.ReferenceQueue$Lock"))
+                && (lockName = info.getLockName()) != null
+                && lockName.startsWith("java.lang.ref.ReferenceQueue$Lock"))
                 continue;
             System.err.print(info);
         }
--- a/test/jdk/java/util/concurrent/tck/Atomic8Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/Atomic8Test.java	Thu May 02 06:33:28 2019 -0700
@@ -518,7 +518,8 @@
      * null function argument
      */
     public void testGetAndUpdateNPE() {
-        Runnable[] throwingActions = {
+        assertThrows(
+            NullPointerException.class,
             () -> new AtomicLong().getAndUpdate(null),
             () -> new AtomicInteger().getAndUpdate(null),
             () -> new AtomicReference().getAndUpdate(null),
@@ -527,16 +528,15 @@
             () -> new AtomicReferenceArray(1).getAndUpdate(0, null),
             () -> aLongFieldUpdater().getAndUpdate(this, null),
             () -> anIntFieldUpdater().getAndUpdate(this, null),
-            () -> anIntegerFieldUpdater().getAndUpdate(this, null),
-        };
-        assertThrows(NullPointerException.class, throwingActions);
+            () -> anIntegerFieldUpdater().getAndUpdate(this, null));
     }
 
     /**
      * All Atomic updateAndGet methods throw NullPointerException on null function argument
      */
     public void testUpdateAndGetNPE() {
-        Runnable[] throwingActions = {
+        assertThrows(
+            NullPointerException.class,
             () -> new AtomicLong().updateAndGet(null),
             () -> new AtomicInteger().updateAndGet(null),
             () -> new AtomicReference().updateAndGet(null),
@@ -545,9 +545,7 @@
             () -> new AtomicReferenceArray(1).updateAndGet(0, null),
             () -> aLongFieldUpdater().updateAndGet(this, null),
             () -> anIntFieldUpdater().updateAndGet(this, null),
-            () -> anIntegerFieldUpdater().updateAndGet(this, null),
-        };
-        assertThrows(NullPointerException.class, throwingActions);
+            () -> anIntegerFieldUpdater().updateAndGet(this, null));
     }
 
     /**
@@ -555,7 +553,8 @@
      * on null function argument
      */
     public void testGetAndAccumulateNPE() {
-        Runnable[] throwingActions = {
+        assertThrows(
+            NullPointerException.class,
             () -> new AtomicLong().getAndAccumulate(1L, null),
             () -> new AtomicInteger().getAndAccumulate(1, null),
             () -> new AtomicReference().getAndAccumulate(one, null),
@@ -564,9 +563,7 @@
             () -> new AtomicReferenceArray(1).getAndAccumulate(0, one, null),
             () -> aLongFieldUpdater().getAndAccumulate(this, 1L, null),
             () -> anIntFieldUpdater().getAndAccumulate(this, 1, null),
-            () -> anIntegerFieldUpdater().getAndAccumulate(this, one, null),
-        };
-        assertThrows(NullPointerException.class, throwingActions);
+            () -> anIntegerFieldUpdater().getAndAccumulate(this, one, null));
     }
 
     /**
@@ -574,7 +571,8 @@
      * on null function argument
      */
     public void testAccumulateAndGetNPE() {
-        Runnable[] throwingActions = {
+        assertThrows(
+            NullPointerException.class,
             () -> new AtomicLong().accumulateAndGet(1L, null),
             () -> new AtomicInteger().accumulateAndGet(1, null),
             () -> new AtomicReference().accumulateAndGet(one, null),
@@ -583,9 +581,7 @@
             () -> new AtomicReferenceArray(1).accumulateAndGet(0, one, null),
             () -> aLongFieldUpdater().accumulateAndGet(this, 1L, null),
             () -> anIntFieldUpdater().accumulateAndGet(this, 1, null),
-            () -> anIntegerFieldUpdater().accumulateAndGet(this, one, null),
-        };
-        assertThrows(NullPointerException.class, throwingActions);
+            () -> anIntegerFieldUpdater().accumulateAndGet(this, one, null));
     }
 
     /**
@@ -598,9 +594,9 @@
         final AtomicLongFieldUpdater longUpdater = aLongFieldUpdater();
         final AtomicIntegerFieldUpdater intUpdater = anIntFieldUpdater();
         final AtomicReferenceFieldUpdater refUpdater = anIntegerFieldUpdater();
-        final Object obj = new Object();
         for (Object x : new Object[]{ new Object(), null }) {
-            Runnable[] throwingActions = {
+            assertThrows(
+                ClassCastException.class,
                 () -> longUpdater.get(x),
                 () -> intUpdater.get(x),
                 () -> refUpdater.get(x),
@@ -618,9 +614,7 @@
 
                 () -> longUpdater.compareAndSet(x, 17L, 42L),
                 () -> intUpdater.compareAndSet(x, 17, 42),
-                () -> refUpdater.compareAndSet(x, (Integer) 17, (Integer) 42),
-            };
-            assertThrows(ClassCastException.class, throwingActions);
+                () -> refUpdater.compareAndSet(x, (Integer) 17, (Integer) 42));
         }
     }
 
--- a/test/jdk/java/util/concurrent/tck/AtomicIntegerArray9Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/AtomicIntegerArray9Test.java	Thu May 02 06:33:28 2019 -0700
@@ -52,7 +52,9 @@
         AtomicIntegerArray aa = new AtomicIntegerArray(SIZE);
         for (int index : new int[] { -1, SIZE }) {
             final int j = index;
-            final Runnable[] tasks = {
+
+            assertThrows(
+                IndexOutOfBoundsException.class,
                 () -> aa.getPlain(j),
                 () -> aa.getOpaque(j),
                 () -> aa.getAcquire(j),
@@ -65,10 +67,7 @@
                 () -> aa.weakCompareAndSetPlain(j, 1, 2),
                 () -> aa.weakCompareAndSetVolatile(j, 1, 2),
                 () -> aa.weakCompareAndSetAcquire(j, 1, 2),
-                () -> aa.weakCompareAndSetRelease(j, 1, 2),
-            };
-
-            assertThrows(IndexOutOfBoundsException.class, tasks);
+                () -> aa.weakCompareAndSetRelease(j, 1, 2));
         }
     }
 
--- a/test/jdk/java/util/concurrent/tck/AtomicLongArray9Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/AtomicLongArray9Test.java	Thu May 02 06:33:28 2019 -0700
@@ -51,7 +51,8 @@
         AtomicLongArray aa = new AtomicLongArray(SIZE);
         for (int index : new int[] { -1, SIZE }) {
             final int j = index;
-            final Runnable[] tasks = {
+              assertThrows(
+                IndexOutOfBoundsException.class,
                 () -> aa.getPlain(j),
                 () -> aa.getOpaque(j),
                 () -> aa.getAcquire(j),
@@ -64,10 +65,7 @@
                 () -> aa.weakCompareAndSetPlain(j, 1, 2),
                 () -> aa.weakCompareAndSetVolatile(j, 1, 2),
                 () -> aa.weakCompareAndSetAcquire(j, 1, 2),
-                () -> aa.weakCompareAndSetRelease(j, 1, 2),
-            };
-
-            assertThrows(IndexOutOfBoundsException.class, tasks);
+                () -> aa.weakCompareAndSetRelease(j, 1, 2));
         }
     }
 
--- a/test/jdk/java/util/concurrent/tck/AtomicReferenceArray9Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/AtomicReferenceArray9Test.java	Thu May 02 06:33:28 2019 -0700
@@ -51,7 +51,8 @@
         AtomicReferenceArray<Integer> aa = new AtomicReferenceArray<>(SIZE);
         for (int index : new int[] { -1, SIZE }) {
             final int j = index;
-            final Runnable[] tasks = {
+            assertThrows(
+                IndexOutOfBoundsException.class,
                 () -> aa.getPlain(j),
                 () -> aa.getOpaque(j),
                 () -> aa.getAcquire(j),
@@ -64,10 +65,7 @@
                 () -> aa.weakCompareAndSetPlain(j, null, null),
                 () -> aa.weakCompareAndSetVolatile(j, null, null),
                 () -> aa.weakCompareAndSetAcquire(j, null, null),
-                () -> aa.weakCompareAndSetRelease(j, null, null),
-            };
-
-            assertThrows(IndexOutOfBoundsException.class, tasks);
+                () -> aa.weakCompareAndSetRelease(j, null, null));
         }
     }
 
--- a/test/jdk/java/util/concurrent/tck/Collection8Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/Collection8Test.java	Thu May 02 06:33:28 2019 -0700
@@ -237,41 +237,17 @@
             BlockingQueue q = (BlockingQueue) c;
             assertThrows(
                 NullPointerException.class,
-                () -> {
-                    try { q.offer(null, 1L, HOURS); }
-                    catch (InterruptedException ex) {
-                        throw new AssertionError(ex);
-                    }},
-                () -> {
-                    try { q.put(null); }
-                    catch (InterruptedException ex) {
-                        throw new AssertionError(ex);
-                    }});
+                () -> q.offer(null, 1L, HOURS),
+                () -> q.put(null));
         }
         if (c instanceof BlockingDeque) {
             BlockingDeque q = (BlockingDeque) c;
             assertThrows(
                 NullPointerException.class,
-                () -> {
-                    try { q.offerFirst(null, 1L, HOURS); }
-                    catch (InterruptedException ex) {
-                        throw new AssertionError(ex);
-                    }},
-                () -> {
-                    try { q.offerLast(null, 1L, HOURS); }
-                    catch (InterruptedException ex) {
-                        throw new AssertionError(ex);
-                    }},
-                () -> {
-                    try { q.putFirst(null); }
-                    catch (InterruptedException ex) {
-                        throw new AssertionError(ex);
-                    }},
-                () -> {
-                    try { q.putLast(null); }
-                    catch (InterruptedException ex) {
-                        throw new AssertionError(ex);
-                    }});
+                () -> q.offerFirst(null, 1L, HOURS),
+                () -> q.offerLast(null, 1L, HOURS),
+                () -> q.putFirst(null),
+                () -> q.putLast(null));
         }
     }
 
@@ -979,6 +955,10 @@
         } catch (java.io.NotSerializableException acceptable) {}
     }
 
+    /**
+     * TODO: move out of limbo
+     * 8203662: remove increment of modCount from ArrayList and Vector replaceAll()
+     */
     public void DISABLED_testReplaceAllIsNotStructuralModification() {
         Collection c = impl.emptyCollection();
         if (!(c instanceof List))
--- a/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/CompletableFutureTest.java	Thu May 02 06:33:28 2019 -0700
@@ -3465,7 +3465,9 @@
         CompletableFuture<Integer> nullFuture = (CompletableFuture<Integer>)null;
         ThreadExecutor exec = new ThreadExecutor();
 
-        Runnable[] throwingActions = {
+        assertThrows(
+            NullPointerException.class,
+
             () -> CompletableFuture.supplyAsync(null),
             () -> CompletableFuture.supplyAsync(null, exec),
             () -> CompletableFuture.supplyAsync(new IntegerSupplier(ExecutionMode.SYNC, 42), null),
@@ -3568,10 +3570,8 @@
             () -> f.completeOnTimeout(42, 1L, null),
 
             () -> CompletableFuture.failedFuture(null),
-            () -> CompletableFuture.failedStage(null),
-        };
-
-        assertThrows(NullPointerException.class, throwingActions);
+            () -> CompletableFuture.failedStage(null));
+
         assertEquals(0, exec.count.get());
     }
 
--- a/test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/ForkJoinTask8Test.java	Thu May 02 06:33:28 2019 -0700
@@ -900,14 +900,13 @@
         RecursiveAction a = new CheckedRecursiveAction() {
             protected void realCompute() {
                 AsyncFib nul = null;
-                Runnable[] throwingActions = {
+                assertThrows(
+                    NullPointerException.class,
                     () -> invokeAll(nul),
                     () -> invokeAll(nul, nul),
                     () -> invokeAll(new AsyncFib(8), new AsyncFib(9), nul),
                     () -> invokeAll(new AsyncFib(8), nul, new AsyncFib(9)),
-                    () -> invokeAll(nul, new AsyncFib(8), new AsyncFib(9)),
-                };
-                assertThrows(NullPointerException.class, throwingActions);
+                    () -> invokeAll(nul, new AsyncFib(8), new AsyncFib(9)));
             }};
         testInvokeOnPool(pool, a);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/concurrent/tck/HashtableTest.java	Thu May 02 06:33:28 2019 -0700
@@ -0,0 +1,56 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * Written by Doug Lea and Martin Buchholz with assistance from members
+ * of JCP JSR-166 Expert Group and released to the public domain, as
+ * explained at http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+import java.util.Map;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+
+public class HashtableTest extends JSR166TestCase {
+    public static void main(String[] args) {
+        main(suite(), args);
+    }
+    public static Test suite() {
+        class Implementation implements MapImplementation {
+            public Class<?> klazz() { return Hashtable.class; }
+            public Map emptyMap() { return new Hashtable(); }
+            public Object makeKey(int i) { return i; }
+            public Object makeValue(int i) { return i; }
+            public boolean isConcurrent() { return true; }
+            public boolean permitsNullKeys() { return false; }
+            public boolean permitsNullValues() { return false; }
+            public boolean supportsSetValue() { return true; }
+        }
+        return newTestSuite(MapTest.testSuite(new Implementation()));
+    }
+}
--- a/test/jdk/java/util/concurrent/tck/JSR166TestCase.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/JSR166TestCase.java	Thu May 02 06:33:28 2019 -0700
@@ -544,6 +544,7 @@
             ExecutorsTest.suite(),
             ExecutorCompletionServiceTest.suite(),
             FutureTaskTest.suite(),
+            HashtableTest.suite(),
             LinkedBlockingDequeTest.suite(),
             LinkedBlockingQueueTest.suite(),
             LinkedListTest.suite(),
@@ -1777,12 +1778,11 @@
         }
     }
 
-    void assertImmutable(final Object o) {
+    void assertImmutable(Object o) {
         if (o instanceof Collection) {
             assertThrows(
                 UnsupportedOperationException.class,
-                new Runnable() { public void run() {
-                        ((Collection) o).add(null);}});
+                () -> ((Collection) o).add(null));
         }
     }
 
@@ -1842,8 +1842,8 @@
     }
 
     public void assertThrows(Class<? extends Throwable> expectedExceptionClass,
-                             Runnable... throwingActions) {
-        for (Runnable throwingAction : throwingActions) {
+                             Action... throwingActions) {
+        for (Action throwingAction : throwingActions) {
             boolean threw = false;
             try { throwingAction.run(); }
             catch (Throwable t) {
--- a/test/jdk/java/util/concurrent/tck/SplittableRandomTest.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/SplittableRandomTest.java	Thu May 02 06:33:28 2019 -0700
@@ -165,12 +165,11 @@
      */
     public void testNextIntBoundNonPositive() {
         SplittableRandom sr = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> sr.nextInt(-17),
             () -> sr.nextInt(0),
-            () -> sr.nextInt(Integer.MIN_VALUE),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> sr.nextInt(Integer.MIN_VALUE));
     }
 
     /**
@@ -178,12 +177,11 @@
      */
     public void testNextIntBadBounds() {
         SplittableRandom sr = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> sr.nextInt(17, 2),
             () -> sr.nextInt(-42, -42),
-            () -> sr.nextInt(Integer.MAX_VALUE, Integer.MIN_VALUE),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> sr.nextInt(Integer.MAX_VALUE, Integer.MIN_VALUE));
     }
 
     /**
@@ -235,12 +233,11 @@
      */
     public void testNextLongBoundNonPositive() {
         SplittableRandom sr = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> sr.nextLong(-17L),
             () -> sr.nextLong(0L),
-            () -> sr.nextLong(Long.MIN_VALUE),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> sr.nextLong(Long.MIN_VALUE));
     }
 
     /**
@@ -248,12 +245,11 @@
      */
     public void testNextLongBadBounds() {
         SplittableRandom sr = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> sr.nextLong(17L, 2L),
             () -> sr.nextLong(-42L, -42L),
-            () -> sr.nextLong(Long.MAX_VALUE, Long.MIN_VALUE),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> sr.nextLong(Long.MAX_VALUE, Long.MIN_VALUE));
     }
 
     /**
@@ -304,14 +300,13 @@
      */
     public void testNextDoubleBoundNonPositive() {
         SplittableRandom sr = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> sr.nextDouble(-17.0d),
             () -> sr.nextDouble(0.0d),
             () -> sr.nextDouble(-Double.MIN_VALUE),
             () -> sr.nextDouble(Double.NEGATIVE_INFINITY),
-            () -> sr.nextDouble(Double.NaN),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> sr.nextDouble(Double.NaN));
     }
 
     /**
@@ -319,14 +314,13 @@
      */
     public void testNextDoubleBadBounds() {
         SplittableRandom sr = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> sr.nextDouble(17.0d, 2.0d),
             () -> sr.nextDouble(-42.0d, -42.0d),
             () -> sr.nextDouble(Double.MAX_VALUE, Double.MIN_VALUE),
             () -> sr.nextDouble(Double.NaN, 0.0d),
-            () -> sr.nextDouble(0.0d, Double.NaN),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> sr.nextDouble(0.0d, Double.NaN));
     }
 
     // TODO: Test infinite bounds!
@@ -361,15 +355,14 @@
      */
     public void testBadStreamSize() {
         SplittableRandom r = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> { java.util.stream.IntStream x = r.ints(-1L); },
             () -> { java.util.stream.IntStream x = r.ints(-1L, 2, 3); },
             () -> { java.util.stream.LongStream x = r.longs(-1L); },
             () -> { java.util.stream.LongStream x = r.longs(-1L, -1L, 1L); },
             () -> { java.util.stream.DoubleStream x = r.doubles(-1L); },
-            () -> { java.util.stream.DoubleStream x = r.doubles(-1L, .5, .6); },
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> { java.util.stream.DoubleStream x = r.doubles(-1L, .5, .6); });
     }
 
     /**
@@ -378,15 +371,14 @@
      */
     public void testBadStreamBounds() {
         SplittableRandom r = new SplittableRandom();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> { java.util.stream.IntStream x = r.ints(2, 1); },
             () -> { java.util.stream.IntStream x = r.ints(10, 42, 42); },
             () -> { java.util.stream.LongStream x = r.longs(-1L, -1L); },
             () -> { java.util.stream.LongStream x = r.longs(10, 1L, -2L); },
             () -> { java.util.stream.DoubleStream x = r.doubles(0.0, 0.0); },
-            () -> { java.util.stream.DoubleStream x = r.doubles(10, .5, .4); },
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> { java.util.stream.DoubleStream x = r.doubles(10, .5, .4); });
     }
 
     /**
--- a/test/jdk/java/util/concurrent/tck/StampedLockTest.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/StampedLockTest.java	Thu May 02 06:33:28 2019 -0700
@@ -1009,106 +1009,117 @@
      * IllegalMonitorStateException
      */
     public void testCannotUnlockOptimisticReadStamps() {
-        Runnable[] actions = {
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = assertValid(sl, sl.tryOptimisticRead());
-                sl.unlockRead(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryOptimisticRead();
-                sl.unlock(stamp);
-            },
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = assertValid(sl, sl.tryOptimisticRead());
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockRead(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryOptimisticRead();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
 
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryOptimisticRead();
-                sl.writeLock();
-                sl.unlock(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                sl.readLock();
-                long stamp = assertValid(sl, sl.tryOptimisticRead());
-                sl.unlockRead(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                sl.readLock();
-                long stamp = assertValid(sl, sl.tryOptimisticRead());
-                sl.unlock(stamp);
-            },
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryOptimisticRead();
+            sl.writeLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            sl.readLock();
+            long stamp = assertValid(sl, sl.tryOptimisticRead());
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockRead(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            sl.readLock();
+            long stamp = assertValid(sl, sl.tryOptimisticRead());
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
 
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
-                assertValid(sl, stamp);
-                sl.writeLock();
-                sl.unlockWrite(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
-                sl.writeLock();
-                sl.unlock(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
-                sl.readLock();
-                sl.unlockRead(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
-                sl.readLock();
-                sl.unlock(stamp);
-            },
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
+            assertValid(sl, stamp);
+            sl.writeLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockWrite(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
+            sl.writeLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
+            sl.readLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockRead(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.writeLock());
+            sl.readLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
 
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
-                assertValid(sl, stamp);
-                sl.writeLock();
-                sl.unlockWrite(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
-                sl.writeLock();
-                sl.unlock(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
-                sl.readLock();
-                sl.unlockRead(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                sl.readLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
-                assertValid(sl, stamp);
-                sl.readLock();
-                sl.unlockRead(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
-                sl.readLock();
-                sl.unlock(stamp);
-            },
-            () -> {
-                StampedLock sl = new StampedLock();
-                sl.readLock();
-                long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
-                sl.readLock();
-                sl.unlock(stamp);
-            },
-        };
-
-        assertThrows(IllegalMonitorStateException.class, actions);
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
+            assertValid(sl, stamp);
+            sl.writeLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockWrite(stamp));
+            }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
+            sl.writeLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
+            sl.readLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockRead(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            sl.readLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
+            assertValid(sl, stamp);
+            sl.readLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlockRead(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
+            sl.readLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
+        {
+            StampedLock sl = new StampedLock();
+            sl.readLock();
+            long stamp = sl.tryConvertToOptimisticRead(sl.readLock());
+            sl.readLock();
+            assertThrows(IllegalMonitorStateException.class,
+                () -> sl.unlock(stamp));
+        }
     }
 
     static long writeLockInterruptiblyUninterrupted(StampedLock sl) {
--- a/test/jdk/java/util/concurrent/tck/ThreadLocalRandom8Test.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/ThreadLocalRandom8Test.java	Thu May 02 06:33:28 2019 -0700
@@ -63,15 +63,14 @@
      */
     public void testBadStreamSize() {
         ThreadLocalRandom r = ThreadLocalRandom.current();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> r.ints(-1L),
             () -> r.ints(-1L, 2, 3),
             () -> r.longs(-1L),
             () -> r.longs(-1L, -1L, 1L),
             () -> r.doubles(-1L),
-            () -> r.doubles(-1L, .5, .6),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> r.doubles(-1L, .5, .6));
     }
 
     /**
@@ -80,15 +79,14 @@
      */
     public void testBadStreamBounds() {
         ThreadLocalRandom r = ThreadLocalRandom.current();
-        Runnable[] throwingActions = {
+        assertThrows(
+            IllegalArgumentException.class,
             () -> r.ints(2, 1),
             () -> r.ints(10, 42, 42),
             () -> r.longs(-1L, -1L),
             () -> r.longs(10, 1L, -2L),
             () -> r.doubles(0.0, 0.0),
-            () -> r.doubles(10, .5, .4),
-        };
-        assertThrows(IllegalArgumentException.class, throwingActions);
+            () -> r.doubles(10, .5, .4));
     }
 
     /**
--- a/test/jdk/java/util/concurrent/tck/VectorTest.java	Thu May 02 06:33:28 2019 -0700
+++ b/test/jdk/java/util/concurrent/tck/VectorTest.java	Thu May 02 06:33:28 2019 -0700
@@ -467,9 +467,8 @@
             assertEquals(n, v.size());
             assertNull(v.get(0));
             assertNull(v.get(n - 1));
-            assertThrows(
-                    ArrayIndexOutOfBoundsException.class,
-                    new Runnable() { public void run() { v.setSize(-1); }});
+            assertThrows(ArrayIndexOutOfBoundsException.class,
+                () -> v.setSize(-1));
             assertEquals(n, v.size());
             assertNull(v.get(0));
             assertNull(v.get(n - 1));