--- jsr166/src/test/loops/DenseMapMicroBenchmark.java 2014/12/18 18:43:22 1.7 +++ jsr166/src/test/loops/DenseMapMicroBenchmark.java 2016/10/23 03:03:23 1.10 @@ -47,13 +47,13 @@ public class DenseMapMicroBenchmark { time0(NANOS_PER_JOB, jobs); final String nameHeader = "Method"; - int nameWidth = nameHeader.length(); + int nameWidth = nameHeader.length(); for (Job job : jobs) nameWidth = Math.max(nameWidth, job.name().length()); final int itemsPerTest = SIZE * OPS_PER_ITER * ITERS_PER_TEST; final String timeHeader = "Nanos/item"; - int timeWidth = timeHeader.length(); + int timeWidth = timeHeader.length(); final String ratioHeader = "Ratio"; int ratioWidth = ratioHeader.length(); String format = String.format("%%-%ds %%%dd %%.3f%%n", @@ -70,7 +70,6 @@ public class DenseMapMicroBenchmark { } } - static Long[] toLongs(Integer[] ints) { Long[] longs = new Long[ints.length]; for (int i = 0; i < ints.length; i++) @@ -100,7 +99,6 @@ public class DenseMapMicroBenchmark { return doubles; } - static final class Hasher extends Job { final Object[] elts; final Class mapClass; @@ -111,9 +109,9 @@ public class DenseMapMicroBenchmark { this.mapClass = mapClass; } public void work() { - Map m = null; + final Map m; try { - m = (Map) mapClass.newInstance(); + m = (Map) mapClass.getConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("Can't instantiate " + mapClass + ": " + e); }