Hi Tom,
On Mon, 2006-12-25 at 14:23 -0700, Tom Tromey wrote:
> > "Mark" == Mark Wielaard <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
* 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
Index: Makefile.am
===
RCS file: /cvs/mauve/mauve/Makefile.am,v
retrieving revision 1.32
diff -u -r1.32 Makefile.am
--- Makefile.am 26 Nov 2006 16:30:03 - 1.32
+++ Makefile.am 27 Dec 2006 15:44:57 -
@@ -3,7 +3,7 @@
## FIXME: dependencies
AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies
-JAVACFLAGS = -g
+JAVACFLAGS = -g -1.5
TESTFLAGS =
Index: Makefile.in
===
RCS file: /cvs/mauve/mauve/Makefile.in,v
retrieving revision 1.41
diff -u -r1.41 Makefile.in
--- Makefile.in 26 Nov 2006 16:30:03 - 1.41
+++ Makefile.in 27 Dec 2006 15:44:57 -
@@ -154,7 +154,7 @@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AUTOMAKE_OPTIONS = foreign subdir-objects no-dependencies
-JAVACFLAGS = -g
+JAVACFLAGS = -g -1.5
TESTFLAGS =
check_DATA = $(STAMP)
harness_files = \
Index: gnu/testlet/java/awt/Component/getListeners.java
===
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Component/getListeners.java,v
retrieving revision 1.1
diff -u -r1.1 getListeners.java
--- gnu/testlet/java/awt/Component/getListeners.java 23 Nov 2005 14:52:58 - 1.1
+++ gnu/testlet/java/awt/Component/getListeners.java 27 Dec 2006 15:44:57 -
@@ -69,6 +69,7 @@
}
harness.check(pass);
+ /* Doesn't compile with 1.5
// try a class that isn't a listener
pass = false;
try
@@ -80,6 +81,7 @@
pass = true;
}
harness.check(pass);
+ */
}
public void componentResized(ComponentEvent e)
Index: gnu/testlet/java/