commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 36527] New: - compareTo is inconsistent with equals
Date Tue, 06 Sep 2005 21:13:18 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36527>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36527

           Summary: compareTo is inconsistent with equals
           Product: Commons
           Version: 2.1 Final
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Lang
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: elharo@metalab.unc.edu


The ordering of the compareTo method method in the Fraction class is
inconsistent with equals() because 1/2 is not equal to 2/4. However
1/2.compareTo(2/4) is 0. 

My gut feeling is that the equals method is broken and should be fixed. 1/2 ==
2/4. However if there are good reasons for keeping the current behavior, then at
a minimum the inconsistency shoudl be called out in the JavaDoc, and users
should be warned against using fractions in hash tables and sorted maps and the
like. 

For background see http://java.sun.com/j2se/1.3/docs/api/java/lang/Comparable.html

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message