--- jsr166/src/test/loops/NavigableMapCheck.java 2015/01/15 18:34:19 1.14 +++ jsr166/src/test/loops/NavigableMapCheck.java 2016/10/23 03:03:23 1.16 @@ -62,13 +62,11 @@ public class NavigableMapCheck { } TestTimer.printStats(); - } static NavigableMap newMap(Class cl) { try { - NavigableMap m = (NavigableMap) cl.newInstance(); - return m; + return (NavigableMap) cl.getConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("Can't instantiate " + cl + ": " + e); } @@ -317,9 +315,9 @@ public class NavigableMapCheck { static void dtest(NavigableMap s, int size, Integer[] key) { timer.start("Put (putAll) ", size * 2); - NavigableMap s2 = null; + final NavigableMap s2; try { - s2 = (NavigableMap) (s.getClass().newInstance()); + s2 = (NavigableMap) s.getClass().getConstructor().newInstance(); s2.putAll(s); } catch (Exception e) { e.printStackTrace(); return; } @@ -481,9 +479,7 @@ public class NavigableMapCheck { if (timePerOp < stats.least) stats.least = timePerOp; } } - } - } static class Stats {