src/share/classes/sun/rmi/rmic/RMIGenerator.java
Print this page
*** 59,69 ****
*
* @author Peter Jones, Bryan Atsatt
*/
public class RMIGenerator implements RMIConstants, Generator {
! private static final Hashtable<String, Integer> versionOptions = new Hashtable<>();
static {
versionOptions.put("-v1.1", new Integer(STUB_VERSION_1_1));
versionOptions.put("-vcompat", new Integer(STUB_VERSION_FAT));
versionOptions.put("-v1.2", new Integer(STUB_VERSION_1_2));
}
--- 59,69 ----
*
* @author Peter Jones, Bryan Atsatt
*/
public class RMIGenerator implements RMIConstants, Generator {
! private static final Hashtable versionOptions = new Hashtable();
static {
versionOptions.put("-v1.1", new Integer(STUB_VERSION_1_1));
versionOptions.put("-vcompat", new Integer(STUB_VERSION_FAT));
versionOptions.put("-v1.2", new Integer(STUB_VERSION_1_2));
}
*** 94,104 ****
main.error("rmic.cannot.use.both",
explicitVersion, arg);
return false;
}
explicitVersion = arg;
! version = versionOptions.get(arg);
argv[i] = null;
}
}
}
return true;
--- 94,104 ----
main.error("rmic.cannot.use.both",
explicitVersion, arg);
return false;
}
explicitVersion = arg;
! version = ((Integer) versionOptions.get(arg)).intValue();
argv[i] = null;
}
}
}
return true;
*** 517,527 ****
* here, because javac will flag an error if there are any
* unreachable catch blocks, i.e. if the catch of an exception class
* follows a previous catch of it or of one of its superclasses.
* The following method invocation takes care of these details.
*/
! Vector<ClassDefinition> catchList = computeUniqueCatchList(exceptions);
/*
* If we need to catch any particular exceptions (i.e. this method
* does not declare java.lang.Exception), put the entire stub
* method in a try block.
--- 517,527 ----
* here, because javac will flag an error if there are any
* unreachable catch blocks, i.e. if the catch of an exception class
* follows a previous catch of it or of one of its superclasses.
* The following method invocation takes care of these details.
*/
! Vector catchList = computeUniqueCatchList(exceptions);
/*
* If we need to catch any particular exceptions (i.e. this method
* does not declare java.lang.Exception), put the entire stub
* method in a try block.
*** 613,626 ****
* If we need to catch any particular exceptions, finally write
* the catch blocks for them, rethrow any other Exceptions with an
* UnexpectedException, and end the try block.
*/
if (catchList.size() > 0) {
! for (Enumeration<ClassDefinition> enumeration = catchList.elements();
enumeration.hasMoreElements();)
{
! ClassDefinition def = enumeration.nextElement();
p.pOlnI("} catch (" + def.getName() + " e) {");
p.pln("throw e;");
}
p.pOlnI("} catch (java.lang.Exception e) {");
p.pln("throw new " + idUnexpectedException +
--- 613,626 ----
* If we need to catch any particular exceptions, finally write
* the catch blocks for them, rethrow any other Exceptions with an
* UnexpectedException, and end the try block.
*/
if (catchList.size() > 0) {
! for (Enumeration enumeration = catchList.elements();
enumeration.hasMoreElements();)
{
! ClassDefinition def = (ClassDefinition) enumeration.nextElement();
p.pOlnI("} catch (" + def.getName() + " e) {");
p.pln("throw e;");
}
p.pOlnI("} catch (java.lang.Exception e) {");
p.pln("throw new " + idUnexpectedException +
*** 648,659 ****
*
* The returned Vector will be empty if java.lang.Exception or one
* of its superclasses is in the throws clause of the method, indicating
* that no exceptions need to be caught.
*/
! private Vector<ClassDefinition> computeUniqueCatchList(ClassDeclaration[] exceptions) {
! Vector<ClassDefinition> uniqueList = new Vector<>(); // unique exceptions to catch
uniqueList.addElement(defRuntimeException);
uniqueList.addElement(defRemoteException);
/* For each exception declared by the stub method's throws clause: */
--- 648,659 ----
*
* The returned Vector will be empty if java.lang.Exception or one
* of its superclasses is in the throws clause of the method, indicating
* that no exceptions need to be caught.
*/
! private Vector computeUniqueCatchList(ClassDeclaration[] exceptions) {
! Vector uniqueList = new Vector(); // unique exceptions to catch
uniqueList.addElement(defRuntimeException);
uniqueList.addElement(defRemoteException);
/* For each exception declared by the stub method's throws clause: */
*** 680,690 ****
/*
* Compare this exception against the current list of
* exceptions that need to be caught:
*/
for (int j = 0; j < uniqueList.size();) {
! ClassDefinition def = uniqueList.elementAt(j);
if (def.superClassOf(env, decl)) {
/*
* If a superclass of this exception is already on
* the list to catch, then ignore and continue;
*/
--- 680,691 ----
/*
* Compare this exception against the current list of
* exceptions that need to be caught:
*/
for (int j = 0; j < uniqueList.size();) {
! ClassDefinition def =
! (ClassDefinition) uniqueList.elementAt(j);
if (def.superClassOf(env, decl)) {
/*
* If a superclass of this exception is already on
* the list to catch, then ignore and continue;
*/