DoubleBuffer.compareTo is not anti-symmetric

Martin Buchholz martinrb at google.com
Fri Nov 20 11:19:42 PST 2009


This is a bug report.

import java.nio.*;

public class BufferCompare {
    public static void main(String[] args) {
        DoubleBuffer b1 = DoubleBuffer.wrap(new double[] { Double.NaN });
        DoubleBuffer b2 = DoubleBuffer.wrap(new double[] { 1.0 });
        System.out.printf("%b%n", b1.compareTo(b2));
        System.out.printf("%b%n", b2.compareTo(b1));
    }
}
==> javac -source 1.6 -Xlint:all BufferCompare.java
==> java -esa -ea BufferCompare
true
true

Is there any chance we might be allowed
to fix this violation of the Comparable contract?
If so, I volunteer to do so.

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20091120/e960d91a/attachment.html 


More information about the nio-dev mailing list