commit-classpath
[Top][All Lists]
Advanced

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

[bugs #8413] IntBuffer.compareTo is non-transitive


From: Michael Koch
Subject: [bugs #8413] IntBuffer.compareTo is non-transitive
Date: Thu, 29 Apr 2004 14:05:06 -0400
User-agent: Mozilla/5.0 (compatible; Konqueror/3.2; Linux; de, address@hidden) (KHTML, like Gecko)

This mail is an automated notification from the bugs tracker
 of the project: classpath.

/**************************************************************************/
[bugs #8413] Latest Modifications:

Changes by: 
                Michael Koch <address@hidden>
'Date: 
                Thu 04/29/04 at 18:05 (GMT)

            What     | Removed                   | Added
---------------------------------------------------------------------------
          Resolution | None                      | Fixed
              Status | Open                      | Closed


------------------ Additional Follow-up Comments ----------------------------
I commited a fix to cvs for all buffer classes. The new implementation is 
backed by a new mauve test and should be okay now. Thx for your report.






/**************************************************************************/
[bugs #8413] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8413>
Project: classpath
Submitted by: 0
On: Thu 04/01/04 at 17:01

Severity:  5 - Average
Resolution:  Fixed
Assigned to:  None
Status:  Closed
Platform Version:  None


Summary:  IntBuffer.compareTo is non-transitive

Original Submission:  
I think I noticed a bug in the Gnu Classpath implementation of 
java.nio.IntBuffer while browsing CVS and I wouldn't be surprised if the same 
bug is present in the other buffer classes as well. FYI, I have never seen the 
Sun source code for the java.nio classes.

The compareTo method begins like this:

  public int compareTo (Object obj)
  {
    IntBuffer a = (IntBuffer) obj;

    if (a.remaining () != remaining ())
      return 1;

This fails transitivity. Consider two buffers a and b with different remaining 
sizes:

a.compareTo(b) returns 1 and b.compareTo(a) returns 1. In other words a > b and 
b > a. 

I have not actually written test code for this, so possibly I'm missing 
something. If so, I apologize. Also my apologies if this is a duplicate report. 
Savannah was acting up and I couldn't search the bug database. :-(

I suspect you need something like this instead:

    if (a.remaining () != remaining ()) {
        if (a.remaining() > b.remaining) return 1;
        else return -1;
  }

However, I don't yet know which case should return 1 and which one should 
return -1. 


Follow-up Comments
------------------


-------------------------------------------------------
Date: Thu 04/29/04 at 18:05         By: mkoch
I commited a fix to cvs for all buffer classes. The new implementation is 
backed by a new mauve test and should be okay now. Thx for your report.

-------------------------------------------------------
Date: Thu 04/01/04 at 17:03         By: None
I congratulate you on not requiring me to log in to submit a bug report. Betas 
the hell out of Apache. :-)

In case you need to contact me to ask about this. this bug was submitted by 
Elliotte Harold. You can reach me at address@hidden,unc.edu. 












For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=8413>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]