Hi Tom, On Mon, 2006-12-25 at 14:23 -0700, Tom Tromey wrote: > >>>>> "Mark" == Mark Wielaard 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 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. Nice. I hadn't thought about that solution. And it does seem to test the thing that the original code was testing. Attached is the patch that I'll commit to switch to -1.5 by default now. Most issues were fixed by the above trick. Some others were done by supplying more specific types for some (local) variables. There are some tests disabled now regarding getEventListeners() for classes that don't extend EventListener. I don't see a way to adapt these tests, but they also look like something that nobody would every do in real world code. But if someone has a trick to test this for some real-world cases that would be nice. 2006-12-27 Mark Wielaard * Makefile.am (JAVACFLAGS): Use -1.5. * Makefile.in: Regenerated. * gnu/testlet/java/awt/Component/getListeners.java: Disable non-compiling test. * gnu/testlet/javax/swing/table/DefaultTableColumnModel/ getListeners.java: Likewise. * gnu/testlet/java/awt/Container/getListeners.java: Likewise. * gnu/testlet/javax/swing/DefaultListSelectionModel/ getListeners.java: Likewise. * gnu/testlet/javax/swing/JComponent/getListeners.java: Likewise. * gnu/testlet/javax/swing/event/EventListenerList/add.java: Use more specific local variable types. * gnu/testlet/javax/swing/event/EventListenerList/ getListenerCount.java: Likewise. * gnu/testlet/javax/swing/event/EventListenerList/ getListenerList.java: Likewise. * gnu/testlet/javax/swing/event/EventListenerList/getListeners.java: Likewise. Disable non-compiling test. * gnu/testlet/javax/swing/event/EventListenerList/remove.java: Likewise. * gnu/testlet/java/lang/Double/compareTo.java: Add Comparable cast. * gnu/testlet/java/lang/Float/compareTo.java: Likewise. * gnu/testlet/java/lang/Integer/compareTo.java: Likewise. * gnu/testlet/java/math/BigDecimal/DiagBigDecimal.java: Likewise. * gnu/testlet/java/math/BigInteger/compareTo.java: Likewise. * gnu/testlet/java/util/Date/compareTo.java: Likewise. * gnu/testlet/javax/imageio/spi/ServiceRegistry/setOrdering.java: Use correct class literal. Cheers, Mark