changeset 15698:035006c599d0

8165919: Miscellaneous changes imported from jsr166 CVS 2016-09-21 Reviewed-by: martin, chegar, shade
author dl
date Fri, 23 Sep 2016 13:24:33 -0700
parents fded5722642e
children 2b6aebac0773
files src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java src/java.base/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java src/java.base/share/classes/java/util/concurrent/atomic/LongAccumulator.java test/java/util/Collections/EmptyNavigableMap.java test/java/util/Collections/EmptyNavigableSet.java test/java/util/Deque/ChorusLine.java test/java/util/PriorityQueue/ForgetMeNot.java test/java/util/PriorityQueue/PriorityQueueSort.java test/java/util/PriorityQueue/RemoveContains.java test/java/util/concurrent/Executors/AutoShutdown.java test/java/util/concurrent/tck/AtomicIntegerArrayTest.java test/java/util/concurrent/tck/AtomicLongArrayTest.java test/java/util/concurrent/tck/ConcurrentSkipListMapTest.java test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java test/java/util/concurrent/tck/CyclicBarrierTest.java test/java/util/concurrent/tck/DelayQueueTest.java test/java/util/concurrent/tck/ForkJoinPoolTest.java test/java/util/concurrent/tck/ScheduledExecutorTest.java test/java/util/concurrent/tck/TreeMapTest.java test/java/util/concurrent/tck/TreeSetTest.java
diffstat 20 files changed, 112 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java	Fri Sep 23 13:24:33 2016 -0700
@@ -1191,7 +1191,7 @@
      * Default idle timeout value (in milliseconds) for the thread
      * triggering quiescence to park waiting for new work
      */
-    private static final long DEFAULT_KEEPALIVE = 60000L;
+    private static final long DEFAULT_KEEPALIVE = 60_000L;
 
     /**
      * Undershoot tolerance for idle timeouts
@@ -2303,7 +2303,6 @@
             throw new NullPointerException();
         long ms = Math.max(unit.toMillis(keepAliveTime), TIMEOUT_SLOP);
 
-        String prefix = "ForkJoinPool-" + nextPoolId() + "-worker-";
         int corep = Math.min(Math.max(corePoolSize, parallelism), MAX_CAP);
         long c = ((((long)(-corep)       << TC_SHIFT) & TC_MASK) |
                   (((long)(-parallelism) << RC_SHIFT) & RC_MASK));
@@ -2315,8 +2314,8 @@
         n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16;
         n = (n + 1) << 1; // power of two, including space for submission queues
 
+        this.workerNamePrefix = "ForkJoinPool-" + nextPoolId() + "-worker-";
         this.workQueues = new WorkQueue[n];
-        this.workerNamePrefix = prefix;
         this.factory = factory;
         this.ueh = handler;
         this.saturate = saturate;
@@ -2327,11 +2326,19 @@
         checkPermission();
     }
 
+    private Object newInstanceFromSystemProperty(String property)
+        throws ReflectiveOperationException {
+        String className = System.getProperty(property);
+        return (className == null)
+            ? null
+            : ClassLoader.getSystemClassLoader().loadClass(className)
+            .getConstructor().newInstance();
+    }
+
     /**
      * Constructor for common pool using parameters possibly
      * overridden by system properties
      */
-    @SuppressWarnings("deprecation") // Class.newInstance
     private ForkJoinPool(byte forCommonPoolOnly) {
         int parallelism = -1;
         ForkJoinWorkerThreadFactory fac = null;
@@ -2339,18 +2346,12 @@
         try {  // ignore exceptions in accessing/parsing properties
             String pp = System.getProperty
                 ("java.util.concurrent.ForkJoinPool.common.parallelism");
-            String fp = System.getProperty
-                ("java.util.concurrent.ForkJoinPool.common.threadFactory");
-            String hp = System.getProperty
-                ("java.util.concurrent.ForkJoinPool.common.exceptionHandler");
             if (pp != null)
                 parallelism = Integer.parseInt(pp);
-            if (fp != null)
-                fac = ((ForkJoinWorkerThreadFactory)ClassLoader.
-                           getSystemClassLoader().loadClass(fp).newInstance());
-            if (hp != null)
-                handler = ((UncaughtExceptionHandler)ClassLoader.
-                           getSystemClassLoader().loadClass(hp).newInstance());
+            fac = (ForkJoinWorkerThreadFactory) newInstanceFromSystemProperty(
+                "java.util.concurrent.ForkJoinPool.common.threadFactory");
+            handler = (UncaughtExceptionHandler) newInstanceFromSystemProperty(
+                "java.util.concurrent.ForkJoinPool.common.exceptionHandler");
         } catch (Exception ignore) {
         }
 
@@ -2373,8 +2374,8 @@
         n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16;
         n = (n + 1) << 1;
 
+        this.workerNamePrefix = "ForkJoinPool.commonPool-worker-";
         this.workQueues = new WorkQueue[n];
-        this.workerNamePrefix = "ForkJoinPool.commonPool-worker-";
         this.factory = fac;
         this.ueh = handler;
         this.saturate = null;
--- a/src/java.base/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java	Fri Sep 23 13:24:33 2016 -0700
@@ -35,6 +35,9 @@
 
 package java.util.concurrent.atomic;
 
+import static java.lang.Double.doubleToRawLongBits;
+import static java.lang.Double.longBitsToDouble;
+
 import java.io.Serializable;
 import java.util.function.DoubleBinaryOperator;
 
@@ -91,7 +94,7 @@
     public DoubleAccumulator(DoubleBinaryOperator accumulatorFunction,
                              double identity) {
         this.function = accumulatorFunction;
-        base = this.identity = Double.doubleToRawLongBits(identity);
+        base = this.identity = doubleToRawLongBits(identity);
     }
 
     /**
@@ -101,18 +104,19 @@
      */
     public void accumulate(double x) {
         Cell[] as; long b, v, r; int m; Cell a;
-        if ((as = cells) != null ||
-            (r = Double.doubleToRawLongBits
-             (function.applyAsDouble
-              (Double.longBitsToDouble(b = base), x))) != b  && !casBase(b, r)) {
+        if ((as = cells) != null
+            || ((r = doubleToRawLongBits
+                (function.applyAsDouble(longBitsToDouble(b = base), x))) != b
+                && !casBase(b, r))) {
             boolean uncontended = true;
-            if (as == null || (m = as.length - 1) < 0 ||
-                (a = as[getProbe() & m]) == null ||
-                !(uncontended =
-                  (r = Double.doubleToRawLongBits
-                   (function.applyAsDouble
-                    (Double.longBitsToDouble(v = a.value), x))) == v ||
-                  a.cas(v, r)))
+            if (as == null
+                || (m = as.length - 1) < 0
+                || (a = as[getProbe() & m]) == null
+                || !(uncontended =
+                     ((r = doubleToRawLongBits
+                       (function.applyAsDouble
+                        (longBitsToDouble(v = a.value), x))) == v)
+                     || a.cas(v, r)))
                 doubleAccumulate(x, function, uncontended);
         }
     }
@@ -128,12 +132,12 @@
      */
     public double get() {
         Cell[] as = cells;
-        double result = Double.longBitsToDouble(base);
+        double result = longBitsToDouble(base);
         if (as != null) {
             for (Cell a : as)
                 if (a != null)
                     result = function.applyAsDouble
-                        (result, Double.longBitsToDouble(a.value));
+                        (result, longBitsToDouble(a.value));
         }
         return result;
     }
@@ -168,12 +172,12 @@
      */
     public double getThenReset() {
         Cell[] as = cells;
-        double result = Double.longBitsToDouble(base);
+        double result = longBitsToDouble(base);
         base = identity;
         if (as != null) {
             for (Cell a : as) {
                 if (a != null) {
-                    double v = Double.longBitsToDouble(a.value);
+                    double v = longBitsToDouble(a.value);
                     a.reset(identity);
                     result = function.applyAsDouble(result, v);
                 }
@@ -267,9 +271,9 @@
          * held by this proxy
          */
         private Object readResolve() {
-            double d = Double.longBitsToDouble(identity);
+            double d = longBitsToDouble(identity);
             DoubleAccumulator a = new DoubleAccumulator(function, d);
-            a.base = Double.doubleToRawLongBits(value);
+            a.base = doubleToRawLongBits(value);
             return a;
         }
     }
--- a/src/java.base/share/classes/java/util/concurrent/atomic/LongAccumulator.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/LongAccumulator.java	Fri Sep 23 13:24:33 2016 -0700
@@ -103,14 +103,16 @@
      */
     public void accumulate(long x) {
         Cell[] as; long b, v, r; int m; Cell a;
-        if ((as = cells) != null ||
-            (r = function.applyAsLong(b = base, x)) != b && !casBase(b, r)) {
+        if ((as = cells) != null
+            || ((r = function.applyAsLong(b = base, x)) != b
+                && !casBase(b, r))) {
             boolean uncontended = true;
-            if (as == null || (m = as.length - 1) < 0 ||
-                (a = as[getProbe() & m]) == null ||
-                !(uncontended =
-                  (r = function.applyAsLong(v = a.value, x)) == v ||
-                  a.cas(v, r)))
+            if (as == null
+                || (m = as.length - 1) < 0
+                || (a = as[getProbe() & m]) == null
+                || !(uncontended =
+                     (r = function.applyAsLong(v = a.value, x)) == v
+                     || a.cas(v, r)))
                 longAccumulate(x, function, uncontended);
         }
     }
--- a/test/java/util/Collections/EmptyNavigableMap.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/Collections/EmptyNavigableMap.java	Fri Sep 23 13:24:33 2016 -0700
@@ -33,7 +33,6 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
-import java.util.NoSuchElementException;
 import java.util.NavigableMap;
 import java.util.SortedMap;
 import java.util.TreeMap;
@@ -41,10 +40,8 @@
 import org.testng.annotations.DataProvider;
 
 import static org.testng.Assert.fail;
-import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertSame;
 
 public class EmptyNavigableMap {
 
--- a/test/java/util/Collections/EmptyNavigableSet.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/Collections/EmptyNavigableSet.java	Fri Sep 23 13:24:33 2016 -0700
@@ -41,10 +41,9 @@
 import org.testng.annotations.DataProvider;
 
 import static org.testng.Assert.fail;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
 
 public class EmptyNavigableSet {
 
--- a/test/java/util/Deque/ChorusLine.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/Deque/ChorusLine.java	Fri Sep 23 13:24:33 2016 -0700
@@ -28,8 +28,14 @@
  * @author Martin Buchholz
  */
 
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayDeque;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.LinkedBlockingDeque;
 
 public class ChorusLine {
     private interface Tweaker {
--- a/test/java/util/PriorityQueue/ForgetMeNot.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/PriorityQueue/ForgetMeNot.java	Fri Sep 23 13:24:33 2016 -0700
@@ -28,7 +28,11 @@
  * @author Martin Buchholz
  */
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.PriorityQueue;
+import java.util.Queue;
 
 public class ForgetMeNot {
     private static void checkQ(PriorityQueue<Integer> q, Integer...elts) {
--- a/test/java/util/PriorityQueue/PriorityQueueSort.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/PriorityQueue/PriorityQueueSort.java	Fri Sep 23 13:24:33 2016 -0700
@@ -37,7 +37,13 @@
  * @summary Checks that a priority queue returns elements in sorted order across various operations
  */
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Queue;
+import java.util.PriorityQueue;
 
 public class PriorityQueueSort {
 
--- a/test/java/util/PriorityQueue/RemoveContains.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/PriorityQueue/RemoveContains.java	Fri Sep 23 13:24:33 2016 -0700
@@ -28,8 +28,17 @@
  * @author  Martin Buchholz
  */
 
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.ArrayDeque;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.PriorityQueue;
+import java.util.Queue;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.LinkedBlockingDeque;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.PriorityBlockingQueue;
+import java.util.concurrent.LinkedTransferQueue;
 
 public class RemoveContains {
     static volatile int passed = 0, failed = 0;
--- a/test/java/util/concurrent/Executors/AutoShutdown.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/Executors/AutoShutdown.java	Fri Sep 23 13:24:33 2016 -0700
@@ -31,8 +31,6 @@
  */
 
 import static java.util.concurrent.Executors.defaultThreadFactory;
-import static java.util.concurrent.Executors.newFixedThreadPool;
-import static java.util.concurrent.Executors.newSingleThreadScheduledExecutor;
 import static java.util.concurrent.Executors.newSingleThreadExecutor;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
--- a/test/java/util/concurrent/tck/AtomicIntegerArrayTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/AtomicIntegerArrayTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -303,7 +303,7 @@
 
     class Counter extends CheckedRunnable {
         final AtomicIntegerArray aa;
-        volatile int counts;
+        int decs;
         Counter(AtomicIntegerArray a) { aa = a; }
         public void realRun() {
             for (;;) {
@@ -314,7 +314,7 @@
                     if (v != 0) {
                         done = false;
                         if (aa.compareAndSet(i, v, v - 1))
-                            ++counts;
+                            decs++;
                     }
                 }
                 if (done)
@@ -334,13 +334,11 @@
             aa.set(i, countdown);
         Counter c1 = new Counter(aa);
         Counter c2 = new Counter(aa);
-        Thread t1 = new Thread(c1);
-        Thread t2 = new Thread(c2);
-        t1.start();
-        t2.start();
+        Thread t1 = newStartedThread(c1);
+        Thread t2 = newStartedThread(c2);
         t1.join();
         t2.join();
-        assertEquals(c1.counts+c2.counts, SIZE * countdown);
+        assertEquals(c1.decs + c2.decs, SIZE * countdown);
     }
 
     /**
--- a/test/java/util/concurrent/tck/AtomicLongArrayTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/AtomicLongArrayTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -302,7 +302,7 @@
 
     class Counter extends CheckedRunnable {
         final AtomicLongArray aa;
-        volatile long counts;
+        int decs;
         Counter(AtomicLongArray a) { aa = a; }
         public void realRun() {
             for (;;) {
@@ -313,7 +313,7 @@
                     if (v != 0) {
                         done = false;
                         if (aa.compareAndSet(i, v, v - 1))
-                            ++counts;
+                            decs++;
                     }
                 }
                 if (done)
@@ -333,13 +333,11 @@
             aa.set(i, countdown);
         Counter c1 = new Counter(aa);
         Counter c2 = new Counter(aa);
-        Thread t1 = new Thread(c1);
-        Thread t2 = new Thread(c2);
-        t1.start();
-        t2.start();
+        Thread t1 = newStartedThread(c1);
+        Thread t2 = newStartedThread(c2);
         t1.join();
         t2.join();
-        assertEquals(c1.counts+c2.counts, SIZE * countdown);
+        assertEquals(c1.decs + c2.decs, SIZE * countdown);
     }
 
     /**
--- a/test/java/util/concurrent/tck/ConcurrentSkipListMapTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/ConcurrentSkipListMapTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -1024,7 +1024,7 @@
 
     static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception {
         NavigableMap<Integer, Integer> result =
-            (NavigableMap<Integer, Integer>) cl.newInstance();
+            (NavigableMap<Integer, Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.keySet().iterator().hasNext());
         return result;
--- a/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/ConcurrentSkipListSetTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -725,7 +725,8 @@
     }
 
     static NavigableSet<Integer> newSet(Class cl) throws Exception {
-        NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance();
+        NavigableSet<Integer> result =
+            (NavigableSet<Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.iterator().hasNext());
         return result;
--- a/test/java/util/concurrent/tck/CyclicBarrierTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/CyclicBarrierTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -40,6 +40,7 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -52,11 +53,6 @@
         return new TestSuite(CyclicBarrierTest.class);
     }
 
-    private volatile int countAction;
-    private class MyAction implements Runnable {
-        public void run() { ++countAction; }
-    }
-
     /**
      * Spin-waits till the number of waiters == numberOfWaiters.
      */
@@ -114,14 +110,16 @@
      * The supplied barrier action is run at barrier
      */
     public void testBarrierAction() throws Exception {
-        countAction = 0;
-        CyclicBarrier b = new CyclicBarrier(1, new MyAction());
+        final AtomicInteger count = new AtomicInteger(0);
+        final Runnable incCount = new Runnable() { public void run() {
+            count.getAndIncrement(); }};
+        CyclicBarrier b = new CyclicBarrier(1, incCount);
         assertEquals(1, b.getParties());
         assertEquals(0, b.getNumberWaiting());
         b.await();
         b.await();
         assertEquals(0, b.getNumberWaiting());
-        assertEquals(2, countAction);
+        assertEquals(2, count.get());
     }
 
     /**
--- a/test/java/util/concurrent/tck/DelayQueueTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/DelayQueueTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -121,10 +121,8 @@
         }
 
         public boolean equals(Object other) {
-            return equals((NanoDelay)other);
-        }
-        public boolean equals(NanoDelay other) {
-            return other.trigger == trigger;
+            return (other instanceof NanoDelay) &&
+                this.trigger == ((NanoDelay)other).trigger;
         }
 
         // suppress [overrides] javac warning
--- a/test/java/util/concurrent/tck/ForkJoinPoolTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/ForkJoinPoolTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -51,6 +51,7 @@
 import java.util.concurrent.RecursiveTask;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.ReentrantLock;
 
 import junit.framework.AssertionFailedError;
@@ -84,13 +85,6 @@
 
     // Some classes to test extension and factory methods
 
-    static class MyHandler implements Thread.UncaughtExceptionHandler {
-        volatile int catches = 0;
-        public void uncaughtException(Thread t, Throwable e) {
-            ++catches;
-        }
-    }
-
     static class MyError extends Error {}
 
     // to test handlers
@@ -101,9 +95,9 @@
 
     static class FailingThreadFactory
             implements ForkJoinPool.ForkJoinWorkerThreadFactory {
-        volatile int calls = 0;
+        final AtomicInteger calls = new AtomicInteger(0);
         public ForkJoinWorkerThread newThread(ForkJoinPool p) {
-            if (++calls > 1) return null;
+            if (calls.incrementAndGet() > 1) return null;
             return new FailingFJWSubclass(p);
         }
     }
--- a/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/ScheduledExecutorTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -537,15 +537,14 @@
      * isShutdown is false before shutdown, true after
      */
     public void testIsShutdown() {
-
         final ScheduledThreadPoolExecutor p = new ScheduledThreadPoolExecutor(1);
-        try {
-            assertFalse(p.isShutdown());
+        assertFalse(p.isShutdown());
+        try (PoolCleaner cleaner = cleaner(p)) {
+            try {
+                p.shutdown();
+                assertTrue(p.isShutdown());
+            } catch (SecurityException ok) {}
         }
-        finally {
-            try { p.shutdown(); } catch (SecurityException ok) { return; }
-        }
-        assertTrue(p.isShutdown());
     }
 
     /**
--- a/test/java/util/concurrent/tck/TreeMapTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/TreeMapTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -829,7 +829,7 @@
 
     static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception {
         NavigableMap<Integer, Integer> result
-            = (NavigableMap<Integer, Integer>) cl.newInstance();
+            = (NavigableMap<Integer, Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.keySet().iterator().hasNext());
         return result;
--- a/test/java/util/concurrent/tck/TreeSetTest.java	Fri Sep 23 13:21:23 2016 -0700
+++ b/test/java/util/concurrent/tck/TreeSetTest.java	Fri Sep 23 13:24:33 2016 -0700
@@ -722,7 +722,8 @@
     }
 
     static NavigableSet<Integer> newSet(Class cl) throws Exception {
-        NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance();
+        NavigableSet<Integer> result =
+            (NavigableSet<Integer>) cl.getConstructor().newInstance();
         assertEquals(0, result.size());
         assertFalse(result.iterator().hasNext());
         return result;