< prev index next >

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

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

*** 180,190 **** if (classpath == null) loader = null; else loader = new PathClassLoader(classpath); ! Class compilerClass; if (compilerClassName != null) { compilerClass = getClass(loader, compilerClassName); if (compilerClass == null) return Status.error("Cannot find compiler: " + compilerClassName); } --- 180,190 ---- if (classpath == null) loader = null; else loader = new PathClassLoader(classpath); ! Class<?> compilerClass; if (compilerClassName != null) { compilerClass = getClass(loader, compilerClassName); if (compilerClass == null) return Status.error("Cannot find compiler: " + compilerClassName); }
*** 199,214 **** loader = null; Object[] compileMethodArgs; Method compileMethod = getMethod(compilerClass, "compile", // JDK1.4+ ! new Class[] { String[].class, PrintWriter.class }); if (compileMethod != null) compileMethodArgs = new Object[] { args, ref }; else { compileMethod = getMethod(compilerClass, "compile", // JDK1.1-3 ! new Class[] { String[].class }); if (compileMethod != null) compileMethodArgs = new Object[] { args }; else return Status.error("Cannot find compile method for " + compilerClass.getName()); } --- 199,214 ---- loader = null; Object[] compileMethodArgs; Method compileMethod = getMethod(compilerClass, "compile", // JDK1.4+ ! new Class<?>[] { String[].class, PrintWriter.class }); if (compileMethod != null) compileMethodArgs = new Object[] { args, ref }; else { compileMethod = getMethod(compilerClass, "compile", // JDK1.1-3 ! new Class<?>[] { String[].class }); if (compileMethod != null) compileMethodArgs = new Object[] { args }; else return Status.error("Cannot find compile method for " + compilerClass.getName()); }
*** 216,231 **** Object compiler; if (Modifier.isStatic(compileMethod.getModifiers())) compiler = null; else { Object[] constrArgs; ! Constructor constr = getConstructor(compilerClass, // JDK1.1-2 ! new Class[] { OutputStream.class, String.class }); if (constr != null) constrArgs = new Object[] { new WriterStream(ref), compilerName }; else { ! constr = getConstructor(compilerClass, new Class[0]); // JDK1.3 if (constr != null) constrArgs = new Object[0]; else return Status.error("Cannot find suitable constructor for " + compilerClass.getName()); } --- 216,231 ---- Object compiler; if (Modifier.isStatic(compileMethod.getModifiers())) compiler = null; else { Object[] constrArgs; ! Constructor<?> constr = getConstructor(compilerClass, // JDK1.1-2 ! new Class<?>[] { OutputStream.class, String.class }); if (constr != null) constrArgs = new Object[] { new WriterStream(ref), compilerName }; else { ! constr = getConstructor(compilerClass, new Class<?>[0]); // JDK1.3 if (constr != null) constrArgs = new Object[0]; else return Status.error("Cannot find suitable constructor for " + compilerClass.getName()); }
*** 263,282 **** log.flush(); ref.flush(); } } ! private Class getClass(ClassLoader loader, String name) { try { return (loader == null ? Class.forName(name) : loader.loadClass(name)); } catch (ClassNotFoundException e) { return null; } } ! private Constructor getConstructor(Class<?> c, Class[] argTypes) { try { return c.getConstructor(argTypes); } catch (NoSuchMethodException e) { return null; --- 263,282 ---- log.flush(); ref.flush(); } } ! private Class<?> getClass(ClassLoader loader, String name) { try { return (loader == null ? Class.forName(name) : loader.loadClass(name)); } catch (ClassNotFoundException e) { return null; } } ! private Constructor<?> getConstructor(Class<?> c, Class<?>[] argTypes) { try { return c.getConstructor(argTypes); } catch (NoSuchMethodException e) { return null;
*** 286,296 **** t.printStackTrace(log); return null; } } ! private Method getMethod(Class<?> c, String name, Class[] argTypes) { try { return c.getMethod(name, argTypes); } catch (NoSuchMethodException e) { return null; --- 286,296 ---- t.printStackTrace(log); return null; } } ! private Method getMethod(Class<?> c, String name, Class<?>[] argTypes) { try { return c.getMethod(name, argTypes); } catch (NoSuchMethodException e) { return null;
< prev index next >