Re: Mauve vs 1.5

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

 



>>>>> "Mark" == Mark Wielaard <mark@xxxxxxxxx> writes:

[ CharArrayWriter and Appendable ]
Mark> Now this is of course easily fixed by using -1.5 so the compiler knows
Mark> about covariant return types and makes all these tests that define
Mark> classes that extend some Writer class compile again.

Yes, let's do that...

Mark> But now we have another problem. Shown by anything that has implements a
Mark> retrofitted Comparable<T> interface like Integer:

Mark> 1. ERROR in gnu/testlet/java/lang/Integer/compareTo.java  line 98:
Mark>         harness.check(zero.compareTo(o) == 0);
Mark>                            ^^^^^^^^^
Mark>   The method compareTo(Integer) in the type Integer is not applicable for the arguments (Object)

In this code, 'o' is just 'zero' cast to an Object.

You could just change it to use compareTo(zero), but that doesn't test
the same thing...

You could change it to:

harness.check(((Comparable) zero).compareTo(o) == 0);

This will check using the raw Comparable and preserve the meaning of
the test, more or less.

Tom


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux