JDK-6269713 : (coll) Unchecked exception specifications of collection classes are missing or inaccurate
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:collections
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-05-12
  • Updated: 2017-05-16
  • Resolved: 2005-09-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
6 b51Fixed
The collection interfaces have exception specifications like

     * @throws UnsupportedOperationException <tt>add</tt> is not supported by
     *         this collection.
     * @throws ClassCastException class of the specified element prevents it
     *         from being added to this collection.
     * @throws NullPointerException if the specified element is null and this
     *         collection does not support null elements.
     * @throws IllegalArgumentException some aspect of this element prevents
     *         it from being added to this collection.
    boolean add(E o);

When this method is doc'ed in extending/implementing classes/interfaces,
a different set of exceptions must be spec'ed.  Often IllegalArgumentException
is never thrown, and often NullPointerException is a mandatory exception
because null elements are never permitted.

All such methods in all the collection classes must be carefully audited for
correctness of all unchecked exceptions.

javadoc by default does not inherit unchecked exception specifications,
so a reader might assume from reading the specs that e.g. NullPointerException
is never thrown.
###@###.### 2005-05-12 22:40:45 GMT

EVALUATION Will be fixed as part of the jsr166x project. ###@###.### 2005-05-12 22:42:12 GMT