Synesso / instinct

Automatically exported from code.google.com/p/instinct
0 stars 0 forks source link

Autoboxing problem with Double and Boolean #6

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For some reason when something like:

    expect.that(1.1).closeTo(1.0, 0.11);

is written Java 5 does not box the double (1.1) to a Double object, but
instead matches the:

    <T extends Comparable<T>> ComparableChecker<T> that(T comparable);

declaration of 'that', as opposed to the:

    DoubleChecker that(Double d);

declaration of 'that'.

I've tried reordering the declarations in the interface so that the
DoubleChecker version of 'that' appears before the ComparableChecker<T>
version, but to no avail.

The only work around I know of is to write:

    expect.that(new Double(1.1)).closeTo(1.0, 0.11);

Original issue reported on code.google.com by cwmy...@gmail.com on 10 Aug 2007 at 5:01

GoogleCodeExporter commented 9 years ago
It's worth noting that Double implements Comparable<Double>.

Original comment by cwmy...@gmail.com on 10 Aug 2007 at 5:06