< prev index next >

src/com/sun/javatest/TestEnvironment.java

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

@@ -115,11 +115,11 @@
         defaultPropTableNames = new String[0];
         defaultPropTables = new Map[0];
     }
 
     static String[] defaultPropTableNames = { };
-    static Map[] defaultPropTables = { };
+    static Map<String, String>[] defaultPropTables = new Map[0];
 
     /**
      * Construct an environment for a named group of properties.
      * @param name      The name by which to identify the group of properties
      *                  for this environment

@@ -128,11 +128,11 @@
      * @param propTableName
      *                  The name of the property table, for use in diagnostics etc
      * @throws TestEnvironment.Fault if there is an error in the table
      *
      */
-    public TestEnvironment(String name, Map propTable, String propTableName)
+    public TestEnvironment(String name, Map<String, String> propTable, String propTableName)
                 throws Fault {
         this(name, (new Map[] {propTable}), (new String[] {propTableName}));
     }
 
     /**

@@ -176,18 +176,18 @@
         // properties of the form env.NAME.KEY=value and add KEY=value into the
         // environment's table
         for (int inheritIndex = 0; inheritIndex < inherits.length; inheritIndex++) {
             String prefix = "env." + inherits[inheritIndex] + ".";
             for (int propIndex = propTables.length - 1; propIndex >= 0; propIndex--) {
-                Map propTable = propTables[propIndex];
-                for (Iterator i = propTable.keySet().iterator(); i.hasNext(); ) {
-                    String prop = (String) (i.next());
+                Map<String, String> propTable = propTables[propIndex];
+                for (Iterator<String> i = propTable.keySet().iterator(); i.hasNext(); ) {
+                    String prop = (i.next());
                     if (prop.startsWith(prefix)) {
                         String key = prop.substring(prefix.length());
                         if (!table.containsKey(key)) {
                             Element elem = new Element(key,
-                                                       (String)(propTable.get(prop)),
+                                    (propTable.get(prop)),
                                                        inherits[inheritIndex],
                                                        propTableNames[propIndex]);
                             table.put(key, elem);
                         }
                     }

@@ -195,17 +195,17 @@
             }
         }
 
         // finally, add in any top-level names (not beginning with env.)
         for (int propIndex = propTables.length - 1; propIndex >= 0; propIndex--) {
-            Map propTable = propTables[propIndex];
-            for (Iterator i = propTable.keySet().iterator(); i.hasNext(); ) {
-                String key = (String) (i.next());
+            Map<String, String> propTable = propTables[propIndex];
+            for (Iterator<String> i = propTable.keySet().iterator(); i.hasNext(); ) {
+                String key = (i.next());
                 if (!key.startsWith("env.")) {
                     if (!table.containsKey(key)) {
                         Element elem = new Element(key,
-                                                   (String)(propTable.get(key)),
+                                (propTable.get(key)),
                                                    null,
                                                    propTableNames[propIndex]);
                         table.put(key, elem);
                     }
                 }

@@ -556,12 +556,12 @@
      * the text VALUE_NOT_DEFINED.
      * @return true if and only if there are any entries containing the text
      * VALUE_NOT_DEFINED.
      */
     public boolean hasUndefinedValues() {
-        for (Iterator i = elements().iterator(); i.hasNext(); ) {
-            TestEnvironment.Element entry = (TestEnvironment.Element) (i.next());
+        for (Iterator<Element> i = elements().iterator(); i.hasNext(); ) {
+            Element entry = i.next();
             if (entry.value.indexOf("VALUE_NOT_DEFINED") >= 0)
                 return true;
         }
         return false;
     }

@@ -623,11 +623,11 @@
      * @return  An enumeration that yields the various keys, explicit or inherited,
      *          that are available in this environment. The keys do <em>not</em>
      *          include the `env.<em>environment-name</em>.' prefix of the corresponding
      *          property names.
      */
-    public Set keys() {
+    public Set<String> keys() {
         return table.keySet();
     }
 
     /**
      * Get a collection containing those entries in this environment that have been

@@ -635,11 +635,11 @@
      * other entries.
      * @return a collection of those entries in this environment that have been
      * referenced.
      * @see #resetElementsUsed
      */
-    public Collection elementsUsed() {
+    public Collection<Element> elementsUsed() {
         return cache.values();
     }
 
     /**
      * Reset the record of entries in this environment that have been referenced.

@@ -653,11 +653,11 @@
      * Enumerate the elements for this environment, including any inherited elements.
      *
      * @return  An enumeration that yields the various elements, explicit or inherited,
      *          that are available in this environment.
      */
-    public Collection elements() {
+    public Collection<Element> elements() {
         return table.values();
     }
 
 
     protected TestEnvironment(TestEnvironment o) {
< prev index next >