test/jdk/java/util/concurrent/ConcurrentHashMap/MapCheck.java
changeset 50764 5637aca18f1d
parent 48541 946e34c2dec9
child 58138 1e4270f875ee
equal deleted inserted replaced
50763:3a6d47df8239 50764:5637aca18f1d
   107             stest(newMap(mapClass), size);
   107             stest(newMap(mapClass), size);
   108     }
   108     }
   109 
   109 
   110     static Map newMap(Class cl) {
   110     static Map newMap(Class cl) {
   111         try {
   111         try {
   112             return (Map)cl.newInstance();
   112             return (Map)cl.getDeclaredConstructor().newInstance();
   113         } catch (Exception e) {
   113         } catch (Exception e) {
   114             throw new RuntimeException("Can't instantiate " + cl + ": " + e);
   114             throw new RuntimeException("Can't instantiate " + cl + ": " + e);
   115         }
   115         }
   116     }
   116     }
   117 
   117 
   405 
   405 
   406     static void dtest(Map s, int size, Object[] key) {
   406     static void dtest(Map s, int size, Object[] key) {
   407         timer.start("Put (putAll)           ", size * 2);
   407         timer.start("Put (putAll)           ", size * 2);
   408         Map s2 = null;
   408         Map s2 = null;
   409         try {
   409         try {
   410             s2 = (Map) (s.getClass().newInstance());
   410             s2 = (Map) s.getClass().getDeclaredConstructor().newInstance();
   411             s2.putAll(s);
   411             s2.putAll(s);
   412         }
   412         }
   413         catch (Exception e) { e.printStackTrace(); return; }
   413         catch (Exception e) { e.printStackTrace(); return; }
   414         timer.finish();
   414         timer.finish();
   415 
   415