DoubleBuffer.compareTo is not anti-symmetric

Martin Buchholz martinrb at
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
==> java -esa -ea BufferCompare

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

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the nio-dev mailing list