From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7057 invoked by alias); 25 Dec 2006 16:06:43 -0000 Received: (qmail 7049 invoked by uid 22791); 25 Dec 2006 16:06:42 -0000 X-Spam-Check-By: sourceware.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (83.160.170.119) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 25 Dec 2006 16:06:36 +0000 Received: from [89.98.113.56] (helo=[89.98.113.56]) by gnu.wildebeest.org with esmtp (Exim 3.36 #1 (Debian)) id 1GysLX-0004tB-00; Mon, 25 Dec 2006 17:06:39 +0100 Subject: Mauve vs 1.5 From: Mark Wielaard To: classpath@gnu.org, mauve-discuss@sourceware.org Content-Type: text/plain Date: Mon, 25 Dec 2006 16:06:00 -0000 Message-Id: <1167062788.2969.43.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2.1 (2.8.2.1-2.fc6) Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact mauve-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sourceware.org X-SW-Source: 2006-q4/txt/msg00006.txt.bz2 Hi, Here is the Christmas riddle for you all. Going through the mauve diffs between GNU Classpath 0.93 and current CVS which switched to full 1.5 language support I noticed some compilation errors. There are 2 main failures: When compiling mauve without the 1.5 flag there is the following issue with anything extending java.io.Writer. e.g.: 1. ERROR in gnu/testlet/java/io/CharArrayWriter/ProtectedVars.java line 30: public class ProtectedVars extends CharArrayWriter implements Testlet ^^^^^^^^^^^^^ The return type is incompatible with Writer.append(CharSequence, int, int), CharArrayWriter.append(CharSequence, int, int) jcf-dump shows the issue. CharArrayWriter implements Writer which extends Appendable, but makes the return type of some methods more specific: Method name:"append" public Signature: (char)java.io.Writer Method name:"append" public bridge synthetic Signature: (char)java.lang.Appendable Without -1.5 the bridge method for the covariant return type is ignored. Meaning that the compiler thinks that the class isn't implementing public Appendable append(char c) as defined by the super interface Appendable. Now this is of course easily fixed by using -1.5 so the compiler knows about covariant return types and makes all these tests that define classes that extend some Writer class compile again. But now we have another problem. Shown by anything that has implements a retrofitted Comparable interface like Integer: 1. ERROR in gnu/testlet/java/lang/Integer/compareTo.java line 98: harness.check(zero.compareTo(o) == 0); ^^^^^^^^^ The method compareTo(Integer) in the type Integer is not applicable for the arguments (Object) Oops. Since for those classes that had a compareTo(Object) already those were removed since if you implement a compareTo(T) method you automatically get a compareTo(Object) bridge method as jcf-dump shows again: Method name:"compareTo" public Signature: (java.lang.Integer)int Method name:"compareTo" public bridge synthetic Signature: (java.lang.Object)int Thanks to erasure it is still binary compatible, but no longer source compatible since now the compiler can error out while doing static type checking instead of having to go through the bridge method and generating a ClassCastException during runtime. So how do we get Mauve to compile and run the most tests? Just switching to -1.4 or -1.5 for compilation is not enough since it exposes different problems. And we cannot even easily use the Tags to see what flag to use since there is a difference between binary and source compatibility. We could introduce yet another Tag and adopt the build/Harness system to compile with an extra (-1.4 or -1.5) flag. That is a bit of an hassle though and introduces yet another layer to deal with for people using Mauve. So I am inclined to switch fully to -1.5 and just rewrite those tests that use compareTo(Object) to use the "proper" type and not explicitly check for ClassCastExceptions during runtime in Mauve itself. I don't see any way to easily use -1.4 and make the Appendable things work. And I assume we will want to switch to full 1.5 support in Mauve sooner or later anyway. Any thoughts, ideas? Cheers, Mark