JDK-6245436 : (spec) Comparable.compareTo(null) should document behavior on null input
Type:Bug
Component:core-libs
Sub-Component:java.lang
Affected Version:5.0
Priority:P4
Status:Closed
Resolution:Fixed
OS:generic,windows_xp
CPU:generic,x86
Submitted:2005-03-24
Updated:2012-03-23
Resolved:2011-05-17
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 Availability Release.
java.lang.Comparable.compareTo(null) should throw NPE. It should be described in the javadoc spec.
###@###.### 2005-03-24 10:43:54 GMT
Comments
EVALUATION
The @throws was indeed needed, and added by the fix for
6427291 (coll) Comparator should mention null parameter
Marking this bug as Fix Delivered in 7-b15.
09-08-2007
EVALUATION
The class javadoc already contains the following sentence:
Note that <tt>null</tt>
is not an instance of any class, and <tt>e.compareTo(null)</tt> should
throw a <tt>NullPointerException</tt> even though <tt>e.equals(null)</tt>
returns <tt>false</tt>.<p>
I interpret this bug as a request for a similar @throws in the javadoc for the only method in the class.
###@###.### 2005-03-24 20:07:11 GMT
We should indeed add an @throws tag.
###@###.### 2005-03-26 00:48:31 GMT