uniqueList.addElement(defRemoteException);
/* For each exception declared by the stub method's throws clause: */
nextException:
for (int i = 0; i < exceptions.length; i++) {
ClassDeclaration decl = exceptions[i];
try {
if (defException.subClassOf(env, decl)) {
/*
* (If java.lang.Exception (or a superclass) was declared
* in the throws clause of this stub method, then we don't
* have to bother catching anything; clear the list and
* return.)
*/
uniqueList.clear();
break;
} else if (!defException.superClassOf(env, decl)) {
/*
* Ignore other Throwables that do not extend Exception,
* since they do not need to be caught anyway.
*/
continue;
}
/*
* 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;
*/
continue nextException;
} else if (def.subClassOf(env, decl)) {
/*
* If a subclass of this exception is on the list
* to catch, then remove it.
*/
uniqueList.removeElementAt(j);
} else {
j++; // else continue comparing
}
}
/* This exception is unique: add it to the list to catch. */
uniqueList.addElement(decl.getClassDefinition(env));
} catch (ClassNotFound e) {
env.error(0, "class.not.found", e.name, decl.getName());
/*
* REMIND: We do not exit from this exceptional condition,
* generating questionable code and likely letting the
* compiler report a resulting error later.
*/