Community
Participate
Working Groups
I have been compiled the generics branch of GNU Classpath with ecj for a while, successfully. However, after updating to the latest CVS version this week (most recently, yesterday's (27/7/2005)), I get a strange error which makes the build fail: 1445. ERROR in ../java/lang/ref/ReferenceQueue.java (at line 91) ref.nextOnQueue = first == null ? ref : first; ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Type mismatch: cannot convert from Reference<capture-of ? extends T> to Reference<capture-of ? extends T> (This is the only error; there are plenty of warnings at present due to the use of raw collections). To me, the error doesn't even make sense, as the two are identical. Finding a machine with a copy of Sun's proprietary javac for 1.5 results in a successful compile, as did previous versions of ecj. FWIW, ref is of type Reference<? extends T> and its nextOnQueue field is of type Reference<T>. first is of type Reference (although I still get the error with Reference<T>). I've tried casts and a variety of other things to make this work, but to no avail. As I say, this code hasn't changed and it does compile with earlier versions and Sun's javac. If there is a problem, the error message could at least be more understandable. Thanks.
Could you provide exact steps to reproduce ?
Yes, run a build of ecj from CVS over the generics branch of GNU Classpath: export CVS_RSH="ssh" cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/classpath co -r generics-branch classpath ./autogen.sh && ./configure && make.
Cannot connect: Could not connect to :ext:anoncvs@savannah.gnu.org:/cvsroot/classpath: I/O exception occurred: CreateProcess: ssh savannah.gnu.org -l anoncvs cvs server error=2
Hmmm... I don't see that here, it still checks out fine. The relevant files are here: http://savannah.gnu.org/cgi-bin/viewcvs/classpath/classpath/java/lang/ref/?only_with_tag=generics-branch Note the 'generics-branch' tag.
compiler v_568 had the same problem.
Reproduced. Simpler testcase: public class X<T> { Y first; void foo(Y<? extends T> ref) { ref.next = first == null ? ref : first; } } class Y<E> { Y<E> next; }
Problem comes from the fact the conditional expression is checking types in old 1.4 fashion (operand compatibility) before attempting 1.5 (LUB), which is wrong. Added GenericTypeTest#test799. Fixed in both 3.1.1 and 3.2 streams.
Until you get the fix, you may workaround the issue by inserting an extra cast: ref.nextOnQueue = first == null ? (Reference) ref : first;
The patch (using latest ecj CVS) solves that error, but spawns lots of: 22. ERROR in ../external/w3c_dom/org/w3c/dom/bootstrap/DOMImplementationRegistry.java (at line 318) return isJRE11() ? null : (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader classLoader = null; try { classLoader = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return classLoader; } }); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Incompatible conditional operand types null and ClassLoader There are lots of those now, presumably because of the ordering change.
Yes, I figured this regression as well. Got addressed in latest.
*** Bug 101831 has been marked as a duplicate of this bug. ***
Verified in I20050920-0010 for 3.2M2
Verified using M20050923-1430 for 3.1.1