ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/IntMapCheck.java
(Generate patch)

Comparing jsr166/src/test/loops/IntMapCheck.java (file contents):
Revision 1.14 by jsr166, Thu Jan 15 18:34:19 2015 UTC vs.
Revision 1.15 by jsr166, Sun Oct 23 03:03:23 2016 UTC

# Line 73 | Line 73 | public class IntMapCheck {
73  
74      static Map<Integer,Integer> newMap(Class<?> cl) {
75          try {
76 <            Map m = (Map<Integer,Integer>)cl.newInstance();
77 <            return m;
76 >            return (Map<Integer,Integer>) cl.getConstructor().newInstance();
77          } catch (Exception e) {
78              throw new RuntimeException("Can't instantiate " + cl + ": " + e);
79          }
# Line 439 | Line 438 | public class IntMapCheck {
438          t3("Put (presized)         ", size, s, key, size);
439  
440          timer.start("Put (putAll)           ", size * 2);
441 <        Map<Integer,Integer> s2 = null;
441 >        final Map<Integer,Integer> s2;
442          try {
443 <            s2 = (Map<Integer,Integer>) (s.getClass().newInstance());
443 >            s2 = (Map<Integer,Integer>)
444 >                s.getClass().getConstructor().newInstance();
445              s2.putAll(s);
446          }
447          catch (Exception e) { e.printStackTrace(); return; }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines