< prev index next >

src/com/sun/javatest/audit/Audit.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg

@@ -129,15 +129,14 @@
                     badTestDescriptionsV.addElement(tr);
 
                 if (!checkTestCases(tr, excludeList))
                     badTestCaseTestsV.addElement(tr);
 
-                Map trEnv = tr.getEnvironment();
-                for (Iterator i = trEnv.entrySet().iterator(); i.hasNext(); ) {
-                    Map.Entry e = (Map.Entry) (i.next());
-                    String key = (String) (e.getKey());
-                    String value = (String) (e.getValue());
+                Map<String, String> trEnv = tr.getEnvironment();
+                for (Map.Entry<String, String> e : trEnv.entrySet() ) {
+                    String key = e.getKey();
+                    String value = e.getValue();
                     Vector<String> allValuesForKey = envTable.get(key);
                     if (allValuesForKey == null) {
                         allValuesForKey = new Vector<>();
                         envTable.put(key, allValuesForKey);
                     }

@@ -165,13 +164,13 @@
                 //System.err.println(td.getRootRelativeURL() + " " + TestResult.getWorkRelativePath(td) + " " + e);
                 badTestsV.addElement(td);
             }
         }
 
-        for (Enumeration e = envTable.keys(); e.hasMoreElements(); ) {
-            String key = (String)(e.nextElement());
-            Vector allValuesForKey = envTable.get(key);
+        for (Enumeration<String> e = envTable.keys(); e.hasMoreElements(); ) {
+            String key = e.nextElement();
+            Vector<String> allValuesForKey = envTable.get(key);
             envCounts[allValuesForKey.size() == 1 ? 0 : 1]++;
         }
 
         if (badChecksumTestsV.size() > 0) {
             badChecksumTests = new TestResult[badChecksumTestsV.size()];

@@ -250,11 +249,11 @@
      * Get the composite set of environment values used by the tests.
      * @return A table of values.
      * The keys to the table are strings; the values are vectors of strings
      * containing the various values for that key.
      */
-    public Hashtable getEnvTable() {
+    public Hashtable<String, Vector<String>> getEnvTable() {
         return envTable;
     }
 
     /**
      * Get the statistics about the test results.

@@ -491,18 +490,18 @@
     private void showEnvValues(boolean showAll) {
         out.println();
         out.print(i18n.getString("adt.envList.title"));
 
         SortedSet<String> ss = new TreeSet<>();
-        for (Enumeration e = envTable.keys(); e.hasMoreElements(); ) {
-            String key = (String)(e.nextElement());
+        for (Enumeration<String> e = envTable.keys(); e.hasMoreElements(); ) {
+            String key = (e.nextElement());
             ss.add(key);
         }
 
-        for (Iterator iter = ss.iterator(); iter.hasNext(); ) {
-            String key = (String) (iter.next());
-            Vector allValuesForKey = envTable.get(key);
+        for (Iterator<String> iter = ss.iterator(); iter.hasNext(); ) {
+            String key = (iter.next());
+            Vector<String> allValuesForKey = envTable.get(key);
             if (allValuesForKey.size() == 1) {
                 if (showAll)
                     out.println(i18n.getString("adt.envKeyValue",
                                             new Object[] {key, allValuesForKey.elementAt(0)}));
             }

@@ -631,15 +630,15 @@
             return (a == b);
 
         //if (!a.rootRelativeFile.equals(b.rootRelativeFile))
         //    return false;
 
-        Iterator eA = a.getParameterKeys();
-        Iterator eB = b.getParameterKeys();
+        Iterator<String> eA = a.getParameterKeys();
+        Iterator<String> eB = b.getParameterKeys();
         while (eA.hasNext() && eB.hasNext()) {
-            String keyA = (String)eA.next();
-            String keyB = (String)eB.next();
+            String keyA = eA.next();
+            String keyB = eB.next();
             if (!keyA.equals(keyB)) {
                 //System.err.println("mismatch " + a.getRootRelativePath() + " a:" + keyA + " b:" + keyB);
                 return false;
             }
 
< prev index next >