[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to handle throws declarations with duplicate exceptions



>The only objection I can imagine to option 4 would be if there is
>some significance to multiple copies of a single exception in an
>Exceptions attribute.  So does anybody know of any such
>significance?


1. I suspect option 4 could interfere with the operation of class reflection.
Refering to JavaDocs for JDK 1.4.0,

Class.getInterfaces()
If this object represents a class, the return value is an array containing objects
representing all interfaces implemented by the class. The order of the interface
objects in the array corresponds to the **order** of the interface names in
the implements clause of the declaration of the class represented by this object


Although the JavaDoc did not explicitly describes the behaviour in the circumstance
of having duplicate interfaces declared, I would suspect the above function
will happily return all the duplicate copies in order

2. What is the effect on serialisation? Would the optimised class be incompatible
with the original class incompatible w.r.t. serialisation?

From memory, serialisation UID is calculated based on class name, declared interfaces,
fields and methods. I suspect the UID calculation algorithm would give a different
answer.

Cheer,
Stephen