Skip to content

Commit c6962cd

Browse files
committed
7902792: MultiTest generification and redundant casts removal
1 parent 0db3a21 commit c6962cd

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/com/sun/javatest/lib/MultiTest.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ protected int decodeArg(String argv[], int index) throws SetupException {
310310
return 2;
311311
}
312312

313-
Vector tests = new Vector();
313+
Vector<Method> tests = new Vector<>();
314314
while (i < argv.length && !argv[i].startsWith("-")) {
315315
tests.addElement(getTestCase(argv[i++]));
316316
}
@@ -331,7 +331,7 @@ private void printStackTrace(Throwable t) {
331331
ps.close();
332332
}
333333

334-
private void split(String s, Vector v) {
334+
private void split(String s, Vector<String> v) {
335335
int start = 0;
336336
for (int i = s.indexOf(','); i != -1; i = s.indexOf(',', start)) {
337337
v.addElement(s.substring(start, i));
@@ -427,9 +427,9 @@ protected Status invokeTestCase(Method m)
427427
* @see #testMethods
428428
*/
429429
protected void getAllTestCases() throws SetupException {
430-
Vector tests = new Vector();
431-
Vector sortedTests = new Vector();
432-
Vector reversed = new Vector();
430+
Vector<Method> tests = new Vector<>();
431+
Vector<Method> sortedTests = new Vector<>();
432+
Vector<Method> reversed = new Vector<>();
433433

434434
try {
435435
/* Get public methods for this class
@@ -439,8 +439,8 @@ protected void getAllTestCases() throws SetupException {
439439
Method[] methods = testClass.getMethods();
440440
for (int i = 0; i < methods.length; ++i) {
441441

442-
Class[] paramTypes = methods[i].getParameterTypes();
443-
Class returnType = methods[i].getReturnType();
442+
Class<?>[] paramTypes = methods[i].getParameterTypes();
443+
Class<?> returnType = methods[i].getReturnType();
444444
if ((paramTypes.length == 0) &&
445445
Status.class.isAssignableFrom(returnType)) {
446446
tests.addElement(methods[i]);
@@ -459,17 +459,17 @@ protected void getAllTestCases() throws SetupException {
459459
(testcaseOrder.equals("sorted") ||
460460
testcaseOrder.equals("reverseSorted"))) {
461461
Object[] methodNameArray = new Object[tests.size()];
462-
Hashtable ht = new Hashtable();
462+
Hashtable<String, Method> ht = new Hashtable<>();
463463
Method m;
464464

465-
for (Enumeration e = tests.elements(); e.hasMoreElements(); ) {
466-
m = (Method) e.nextElement();
465+
for (Enumeration<Method> e = tests.elements(); e.hasMoreElements(); ) {
466+
m = e.nextElement();
467467
ht.put(m.getName(), m);
468468
}
469469

470470
int j = 0;
471-
for (Enumeration e = tests.elements(); e.hasMoreElements(); ) {
472-
methodNameArray[j] = ((Method) e.nextElement()).getName();
471+
for (Enumeration<Method> e = tests.elements(); e.hasMoreElements(); ) {
472+
methodNameArray[j] = e.nextElement().getName();
473473
j++;
474474
}
475475

@@ -506,8 +506,8 @@ protected void getAllTestCases() throws SetupException {
506506
}
507507

508508
// Reverse a vector containing methods to run
509-
public Vector reverse(Vector v) {
510-
Vector reversed = new Vector();
509+
public Vector<Method> reverse(Vector<Method> v) {
510+
Vector<Method> reversed = new Vector<>();
511511

512512
for (int i = v.size() - 1; i >= 0; i--) {
513513
reversed.addElement(v.elementAt(i));
@@ -550,9 +550,9 @@ protected Status init(String[] argv) {
550550

551551
/* Convenience variables, also added to improve performance
552552
*/
553-
protected final Class testClass = this.getClass();
553+
protected final Class<?> testClass = this.getClass();
554554

555-
protected static final Class[] testArgTypes = {};
555+
protected static final Class<?>[] testArgTypes = {};
556556

557557

558558
/**
@@ -595,7 +595,7 @@ protected Status init(String[] argv) {
595595
/**
596596
* The set of test cases to be excluded.
597597
*/
598-
protected Vector excludeTestCases = new Vector();
598+
protected Vector<String> excludeTestCases = new Vector<>();
599599

600600
// may be set if SetupException is thrown during decodeArgs() or init
601601
private boolean testNotApplicable = false;

0 commit comments

Comments
 (0)