< prev index next >

src/com/sun/javatest/TestEnvContext.java

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

@@ -91,11 +91,11 @@
      * @param tables An array of tables giving the properties to be read
      * @param tableNames An array of names, one for each table in the tables array,
      *  that will be used to identify the source of the properties in any
      *  environments that are created
      */
-    public TestEnvContext(Map[] tables, String[] tableNames) {
+    public TestEnvContext(Map<String, String>[] tables, String[] tableNames) {
         Vector<String> n = new Vector<>();
         Vector<Map<String, String>> p = new Vector<>();
         for (int i = 0; i < tables.length; i++) {
             add(p, n, tables[i], tableNames[i]);
         }

@@ -110,11 +110,11 @@
      * Create a context from a named table.
      * @param table A table giving the properties to be read
      * @param tableName The name that will be used to identify the source
      *   of the properties in any environments that are created.
      */
-    public TestEnvContext(Map table, String tableName) {
+    public TestEnvContext(Map<String, String> table, String tableName) {
         Vector<String> n = new Vector<>();
         Vector<Map<String, String>> p = new Vector<>();
         add(p, n, table, tableName);
         propTables = new Map[p.size()];
         p.copyInto(propTables);

@@ -233,15 +233,15 @@
         }
     }
 
     private void updateEnvTable() {
         // the tables given to the constructor ...
-        Map[] tables = propTables;
+        Map<String, String>[] tables = propTables;
         String[] tableNames = propTableNames;
 
         // defaults given to TestEnvironment
-        Map[] defaultTables = TestEnvironment.defaultPropTables;
+        Map<String, String>[] defaultTables = TestEnvironment.defaultPropTables;
         String[] defaultTableNames = TestEnvironment.defaultPropTableNames;
 
         // if there are defaults, merge them with the TestEnvContext tables
         // for the purposes of determining the EnvTable
         if (defaultTables != null && defaultTables.length > 0) {

@@ -267,13 +267,13 @@
 
         for (int i = 0; i < tables.length; i++) {
             if (debug)
                 System.err.println("Checking " + tableNames[i] + " for environments...");
 
-            Map table = tables[i];
-            for (Iterator ii = table.keySet().iterator(); ii.hasNext(); ) {
-                String prop = (String) (ii.next());
+            Map<String, String> table = tables[i];
+            for (Iterator<String> ii = table.keySet().iterator(); ii.hasNext(); ) {
+                String prop = (ii.next());
                 String name = null;
 
                 if (debug)
                     System.err.println("Checking property " + prop);
 

@@ -283,11 +283,11 @@
                 if (prop.endsWith(DOT_INHERITS)) {
                     name = prop.substring(ENV_DOT.length(), prop.length() - DOT_INHERITS.length());
                 }
                 else if (prop.endsWith(DOT_MENU)) {
                     name = prop.substring(ENV_DOT.length(), prop.length() - DOT_MENU.length());
-                    String value = (String) (table.get(prop));
+                    String value = (table.get(prop));
                     if ("false".equals(value))
                         sortedInsert(menuExcludeVec, name);
                 }
                 else if (prop.endsWith(DOT_DESCRIPTION)) {
                     name = prop.substring(ENV_DOT.length(), prop.length() - DOT_DESCRIPTION.length());

@@ -339,11 +339,11 @@
                 return;
         }
         v.addElement(s);
     }
 
-    private Map[] propTables;
+    private Map<String, String>[] propTables;
     private String[] propTableNames;
     private String[] envNames;
     private String[] envMenuNames;
 
     private static I18NResourceBundle i18n = I18NResourceBundle.getBundleForClass(TestEnvContext.class);
< prev index next >