提交 bf14ebe9 编写于 作者: K khazra

7151348: Build breaks due to warning clean up in sun.rmi.*(7146763)

Summary: Undo changes to sun/rmi/rmic/* commited as fix for 7146763
Reviewed-by: smarks
上级 b7959667
...@@ -160,7 +160,7 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment { ...@@ -160,7 +160,7 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment {
} }
/** list of generated source files created in this environment */ /** list of generated source files created in this environment */
private Vector<File> generatedFiles = new Vector<>(); private Vector generatedFiles = new Vector();
/** /**
* Remember a generated source file generated so that it * Remember a generated source file generated so that it
...@@ -177,9 +177,9 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment { ...@@ -177,9 +177,9 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment {
*/ */
public void deleteGeneratedFiles() { public void deleteGeneratedFiles() {
synchronized(generatedFiles) { synchronized(generatedFiles) {
Enumeration<File> enumeration = generatedFiles.elements(); Enumeration enumeration = generatedFiles.elements();
while (enumeration.hasMoreElements()) { while (enumeration.hasMoreElements()) {
File file = enumeration.nextElement(); File file = (File) enumeration.nextElement();
file.delete(); file.delete();
} }
generatedFiles.removeAllElements(); generatedFiles.removeAllElements();
......
...@@ -73,15 +73,14 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -73,15 +73,14 @@ public class Main implements sun.rmi.rmic.Constants {
File destDir; File destDir;
int flags; int flags;
long tm; long tm;
Vector<String> classes; Vector classes;
boolean nowrite; boolean nowrite;
boolean nocompile; boolean nocompile;
boolean keepGenerated; boolean keepGenerated;
boolean status; boolean status;
String[] generatorArgs; String[] generatorArgs;
Vector<Generator> generators; Vector generators;
Class<? extends BatchEnvironment> environmentClass = Class environmentClass = BatchEnvironment.class;
BatchEnvironment.class;
boolean iiopGeneration = false; boolean iiopGeneration = false;
/** /**
...@@ -184,7 +183,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -184,7 +183,7 @@ public class Main implements sun.rmi.rmic.Constants {
destDir = null; destDir = null;
flags = F_WARNINGS; flags = F_WARNINGS;
tm = System.currentTimeMillis(); tm = System.currentTimeMillis();
classes = new Vector<>(); classes = new Vector();
nowrite = false; nowrite = false;
nocompile = false; nocompile = false;
keepGenerated = false; keepGenerated = false;
...@@ -192,7 +191,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -192,7 +191,7 @@ public class Main implements sun.rmi.rmic.Constants {
if (generatorArgs == null) { if (generatorArgs == null) {
return false; return false;
} }
generators = new Vector<>(); generators = new Vector();
// Pre-process command line for @file arguments // Pre-process command line for @file arguments
try { try {
...@@ -412,7 +411,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -412,7 +411,7 @@ public class Main implements sun.rmi.rmic.Constants {
// Get the environment required by this generator... // Get the environment required by this generator...
Class<?> envClass = BatchEnvironment.class; Class envClass = BatchEnvironment.class;
String env = getString("generator.env." + arg); String env = getString("generator.env." + arg);
if (env != null) { if (env != null) {
try { try {
...@@ -424,7 +423,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -424,7 +423,7 @@ public class Main implements sun.rmi.rmic.Constants {
// Yes, so switch to the new one... // Yes, so switch to the new one...
environmentClass = BatchEnvironment.class.asSubclass(environmentClass); environmentClass = envClass;
} else { } else {
...@@ -496,9 +495,8 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -496,9 +495,8 @@ public class Main implements sun.rmi.rmic.Constants {
try { try {
Class[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class}; Class[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class};
Object[] ctorArgs = {out,classPath,this}; Object[] ctorArgs = {out,classPath,this};
Constructor<? extends BatchEnvironment> constructor = Constructor constructor = environmentClass.getConstructor(ctorArgTypes);
environmentClass.getConstructor(ctorArgTypes); result = (BatchEnvironment) constructor.newInstance(ctorArgs);
result = constructor.newInstance(ctorArgs);
result.reset(); result.reset();
} }
catch (Exception e) { catch (Exception e) {
...@@ -532,7 +530,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -532,7 +530,7 @@ public class Main implements sun.rmi.rmic.Constants {
*/ */
for (int i = classes.size()-1; i >= 0; i-- ) { for (int i = classes.size()-1; i >= 0; i-- ) {
Identifier implClassName = Identifier implClassName =
Identifier.lookup(classes.elementAt(i)); Identifier.lookup((String)classes.elementAt(i));
/* /*
* Fix bugid 4049354: support using '.' as an inner class * Fix bugid 4049354: support using '.' as an inner class
...@@ -560,7 +558,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -560,7 +558,7 @@ public class Main implements sun.rmi.rmic.Constants {
try { try {
ClassDefinition def = decl.getClassDefinition(env); ClassDefinition def = decl.getClassDefinition(env);
for (int j = 0; j < generators.size(); j++) { for (int j = 0; j < generators.size(); j++) {
Generator gen = generators.elementAt(j); Generator gen = (Generator)generators.elementAt(j);
gen.generate(env, def, destDir); gen.generate(env, def, destDir);
} }
} catch (ClassNotFound ex) { } catch (ClassNotFound ex) {
...@@ -675,7 +673,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -675,7 +673,7 @@ public class Main implements sun.rmi.rmic.Constants {
do { do {
done = true; done = true;
for (Enumeration<?> e = env.getClasses() ; e.hasMoreElements() ; ) { for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
ClassDeclaration c = (ClassDeclaration)e.nextElement(); ClassDeclaration c = (ClassDeclaration)e.nextElement();
done = compileClass(c,buf,env); done = compileClass(c,buf,env);
} }
...@@ -684,9 +682,7 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -684,9 +682,7 @@ public class Main implements sun.rmi.rmic.Constants {
/* /*
* Compile a single class. * Compile a single class.
* Fallthrough is intentional
*/ */
@SuppressWarnings("fallthrough")
public boolean compileClass (ClassDeclaration c, public boolean compileClass (ClassDeclaration c,
ByteArrayOutputStream buf, ByteArrayOutputStream buf,
BatchEnvironment env) BatchEnvironment env)
...@@ -883,6 +879,6 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -883,6 +879,6 @@ public class Main implements sun.rmi.rmic.Constants {
args[1] = (arg1 != null ? arg1.toString() : "null"); args[1] = (arg1 != null ? arg1.toString() : "null");
args[2] = (arg2 != null ? arg2.toString() : "null"); args[2] = (arg2 != null ? arg2.toString() : "null");
return java.text.MessageFormat.format(format, (Object[]) args); return java.text.MessageFormat.format(format, args);
} }
} }
...@@ -61,7 +61,7 @@ import com.sun.corba.se.impl.util.Utility; ...@@ -61,7 +61,7 @@ import com.sun.corba.se.impl.util.Utility;
*/ */
public class RMIGenerator implements RMIConstants, Generator { public class RMIGenerator implements RMIConstants, Generator {
private static final Hashtable<String, Integer> versionOptions = new Hashtable<>(); private static final Hashtable versionOptions = new Hashtable();
static { static {
versionOptions.put("-v1.1", new Integer(STUB_VERSION_1_1)); versionOptions.put("-v1.1", new Integer(STUB_VERSION_1_1));
versionOptions.put("-vcompat", new Integer(STUB_VERSION_FAT)); versionOptions.put("-vcompat", new Integer(STUB_VERSION_FAT));
...@@ -96,7 +96,7 @@ public class RMIGenerator implements RMIConstants, Generator { ...@@ -96,7 +96,7 @@ public class RMIGenerator implements RMIConstants, Generator {
return false; return false;
} }
explicitVersion = arg; explicitVersion = arg;
version = versionOptions.get(arg); version = ((Integer) versionOptions.get(arg)).intValue();
argv[i] = null; argv[i] = null;
} }
} }
...@@ -519,7 +519,7 @@ public class RMIGenerator implements RMIConstants, Generator { ...@@ -519,7 +519,7 @@ public class RMIGenerator implements RMIConstants, Generator {
* follows a previous catch of it or of one of its superclasses. * follows a previous catch of it or of one of its superclasses.
* The following method invocation takes care of these details. * The following method invocation takes care of these details.
*/ */
Vector<ClassDefinition> catchList = computeUniqueCatchList(exceptions); Vector catchList = computeUniqueCatchList(exceptions);
/* /*
* If we need to catch any particular exceptions (i.e. this method * If we need to catch any particular exceptions (i.e. this method
...@@ -615,10 +615,10 @@ public class RMIGenerator implements RMIConstants, Generator { ...@@ -615,10 +615,10 @@ public class RMIGenerator implements RMIConstants, Generator {
* UnexpectedException, and end the try block. * UnexpectedException, and end the try block.
*/ */
if (catchList.size() > 0) { if (catchList.size() > 0) {
for (Enumeration<ClassDefinition> enumeration = catchList.elements(); for (Enumeration enumeration = catchList.elements();
enumeration.hasMoreElements();) enumeration.hasMoreElements();)
{ {
ClassDefinition def = enumeration.nextElement(); ClassDefinition def = (ClassDefinition) enumeration.nextElement();
p.pOlnI("} catch (" + def.getName() + " e) {"); p.pOlnI("} catch (" + def.getName() + " e) {");
p.pln("throw e;"); p.pln("throw e;");
} }
...@@ -650,8 +650,8 @@ public class RMIGenerator implements RMIConstants, Generator { ...@@ -650,8 +650,8 @@ public class RMIGenerator implements RMIConstants, Generator {
* of its superclasses is in the throws clause of the method, indicating * of its superclasses is in the throws clause of the method, indicating
* that no exceptions need to be caught. * that no exceptions need to be caught.
*/ */
private Vector<ClassDefinition> computeUniqueCatchList(ClassDeclaration[] exceptions) { private Vector computeUniqueCatchList(ClassDeclaration[] exceptions) {
Vector<ClassDefinition> uniqueList = new Vector<>(); // unique exceptions to catch Vector uniqueList = new Vector(); // unique exceptions to catch
uniqueList.addElement(defRuntimeException); uniqueList.addElement(defRuntimeException);
uniqueList.addElement(defRemoteException); uniqueList.addElement(defRemoteException);
...@@ -682,7 +682,8 @@ public class RMIGenerator implements RMIConstants, Generator { ...@@ -682,7 +682,8 @@ public class RMIGenerator implements RMIConstants, Generator {
* exceptions that need to be caught: * exceptions that need to be caught:
*/ */
for (int j = 0; j < uniqueList.size();) { for (int j = 0; j < uniqueList.size();) {
ClassDefinition def = uniqueList.elementAt(j); ClassDefinition def =
(ClassDefinition) uniqueList.elementAt(j);
if (def.superClassOf(env, decl)) { if (def.superClassOf(env, decl)) {
/* /*
* If a superclass of this exception is already on * If a superclass of this exception is already on
......
...@@ -455,7 +455,7 @@ public class Main { ...@@ -455,7 +455,7 @@ public class Main {
BatchEnvironment env; BatchEnvironment env;
try { try {
Constructor<? extends BatchEnvironment> cons = Constructor<? extends BatchEnvironment> cons =
batch.envClass.getConstructor(new Class<?>[] { RootDoc.class }); batch.envClass.getConstructor(new Class[] { RootDoc.class });
env = cons.newInstance(rootDoc); env = cons.newInstance(rootDoc);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new AssertionError(e); throw new AssertionError(e);
......
...@@ -69,7 +69,7 @@ public final class Resources { ...@@ -69,7 +69,7 @@ public final class Resources {
format = "missing resource key: key = \"" + key + "\", " + format = "missing resource key: key = \"" + key + "\", " +
"arguments = \"{0}\", \"{1}\", \"{2}\""; "arguments = \"{0}\", \"{1}\", \"{2}\"";
} }
return MessageFormat.format(format, (Object[]) args); return MessageFormat.format(format, args);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册