< prev index next >
src/com/sun/javatest/finder/BinaryTestWriter.java
Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg
@@ -276,11 +276,11 @@
if (ts == null)
throw new NullPointerException();
try {
- Class c = Class.forName(finder);
+ Class<?> c = Class.forName(finder);
testFinder = (TestFinder) (c.newInstance());
testFinder.init(args, ts, null);
}
catch (ClassNotFoundException e) {
throw new Fault("Error: Can't find class for test finder specified: " + finder);
@@ -384,14 +384,12 @@
if (tests.length == 0 && files.length == 0)
return null;
Arrays.sort(files);
- Arrays.sort(tests, new Comparator() {
- public int compare(Object o1, Object o2) {
- TestDescription td1 = (TestDescription) o1;
- TestDescription td2 = (TestDescription) o2;
+ Arrays.sort(tests, new Comparator<TestDescription>() {
+ public int compare(TestDescription td1, TestDescription td2) {
return td1.getRootRelativeURL().compareTo(td2.getRootRelativeURL());
}
});
Vector<TestTree.Node> v = new Vector<>();
@@ -461,12 +459,12 @@
/**
* Add all the strings used in a test description to the table.
*/
void add(TestDescription test) {
- for (Iterator i = test.getParameterKeys(); i.hasNext(); ) {
- String key = (String) (i.next());
+ for (Iterator<String> i = test.getParameterKeys(); i.hasNext(); ) {
+ String key = (i.next());
String param = test.getParameter(key);
add(key);
add(param);
}
}
@@ -667,12 +665,12 @@
* followed by that many name-value pairs of string references.
*/
private void write(TestDescription td, DataOutputStream o) throws IOException {
// should consider using load/save here
writeInt(o, td.getParameterCount());
- for (Iterator i = td.getParameterKeys(); i.hasNext(); ) {
- String key = (String) (i.next());
+ for (Iterator<String> i = td.getParameterKeys(); i.hasNext(); ) {
+ String key = (i.next());
String value = td.getParameter(key);
stringTable.writeRef(key, o);
stringTable.writeRef(value, o);
}
}
< prev index next >