This is the mail archive of the 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]

Mauve vs 1.5


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 e.g.:

1. ERROR in gnu/testlet/java/io/CharArrayWriter/  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

Method name:"append" public Signature: (char)
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

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<T> interface like Integer:

1. ERROR in gnu/testlet/java/lang/Integer/  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

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

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?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]