This is the mail archive of the mauve-discuss@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Mauve vs 1.5


>>>>> "Mark" == Mark Wielaard <mark@klomp.org> 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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]