-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
rc1
-
generic
-
generic
The Comparable Specification contains the following text:
A class's natural ordering is said to be consistent with equals if
and only if (e1.compareTo((Object)e2)==0) has the same boolean value
as e1.equals((Object)e2) for every e1 and e2 of class C.
This confuses some readers into thinking that the equals and compareTo should have the same exception behavior, but the general contracts for these methods demand that they do not. For example obj.equals(null) must return false for any non-null obj, but obj.compareTo(null) may thrown an exception. The above description should be amended to take this into account.
A class's natural ordering is said to be consistent with equals if
and only if (e1.compareTo((Object)e2)==0) has the same boolean value
as e1.equals((Object)e2) for every e1 and e2 of class C.
This confuses some readers into thinking that the equals and compareTo should have the same exception behavior, but the general contracts for these methods demand that they do not. For example obj.equals(null) must return false for any non-null obj, but obj.compareTo(null) may thrown an exception. The above description should be amended to take this into account.