< prev index next >

src/com/sun/javatest/batch/ObserverCommand.java

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

@@ -90,27 +90,27 @@
         }
     }
 
     public void run(CommandContext ctx) throws Fault {
         try {
-            Class oc = loadClass(className);
+            Class<?> oc = loadClass(className);
 
             Harness.Observer o = null;
             if (classArgs == null || classArgs.length == 0) {
                 o = tryConstructor(oc,
-                                   new Class[] { },
+                                   new Class<?>[] { },
                                    new Object[] { });
             }
             else if (classArgs.length == 1) {
                 o = tryConstructor(oc,
-                                   new Class[] { String.class },
+                                   new Class<?>[] { String.class },
                                    new Object[] { classArgs[0] });
             }
 
             if (o == null)
                 o = tryConstructor(oc,
-                                   new Class[] { String[].class },
+                                   new Class<?>[] { String[].class },
                                    new Object[] { classArgs });
 
             if (o == null)
                 throw new Fault(i18n, "observer.cantFindConstructor", className);
 

@@ -128,15 +128,15 @@
         catch (InvocationTargetException e) {
             throw new Fault(i18n, "observer.cantCreateClass", className);
         }
     }
 
-    private Harness.Observer tryConstructor(Class<?> obsClass, Class[] argTypes, Object[] args)
+    private Harness.Observer tryConstructor(Class<?> obsClass, Class<?>[] argTypes, Object[] args)
         throws IllegalAccessException, InstantiationException, InvocationTargetException
     {
         try {
-            Constructor c = obsClass.getConstructor(argTypes);
+            Constructor<?> c = obsClass.getConstructor(argTypes);
             return (Harness.Observer) (c.newInstance(args));
         }
         catch (NoSuchMethodException e) {
             return null;
         }

@@ -158,11 +158,11 @@
 
     private void setClassPath(URL[] path) {
         classLoader = new URLClassLoader(path);
     }
 
-    private Class loadClass(String name) throws ClassNotFoundException {
+    private Class<?> loadClass(String name) throws ClassNotFoundException {
         return (classLoader == null ? Class.forName(name) : classLoader.loadClass(name));
     }
 
     private void addClassPathEntry(String s, Vector<URL> v) throws Fault {
         try {
< prev index next >