Community
Participate
Working Groups
JavaC (1.5) compiles this with no problem, Eclipse compiler does not (embedded eclipse compiler in IDEA 6.0.1, not sure what version exactly it is) ==[ ERROR ]== Information:Compilation completed with 1 error and 0 warnings Information:1 error Information:0 warnings src\com\sun\tools\javac\util\List.java Error:Error:line (379)Type mismatch: cannot convert from List<A> to List<A> -- Source file is from Mustang (JDK6) sources, build 104, if I am not mistaken Following is the critical source fragment: @Override public Iterator<A> iterator() { if (tail == null) return emptyIterator(); return new Iterator<A>() { List<A> elems = List.this; // <========= line 379 public boolean hasNext() { return elems.tail != null; } public A next() { if (elems.tail == null) throw new NoSuchElementException(); A result = elems.head; elems = elems.tail; return result; } public void remove() { throw new UnsupportedOperationException(); } }; }
I'll see if we can reproduce with HEAD.
I don't have access to the source code of this class. Would it be possible for you to provide a small test case not related to Sun code?
(In reply to comment #2) > Would it be possible for you to provide a small test case not related to Sun > code? > here you are: public class Bug<A> { void bug() { new Runnable() { public void run() { Bug<A> bug = Bug.this; } }; } }
(In reply to comment #3) > (In reply to comment #2) > > Would it be possible for you to provide a small test case not related to Sun > > code? > > > or even simple: public class Bug<A> { Bug<A> reproduce() { return Bug.this; } }
Are you sure your test cases don't compile with your version? I tried with HEAD, 3.2.0 and 3.2.1 and I could not reproduce. Could you please provide your compiler settings?
Again, it is an eclipse compiler embedded in IDEA 6.0.1. I inspected bundled org.eclipse.jdt.core.jar and its manifest says: Bundle-Version: 3.2.0.v_631 Is this what you need?
Yes, thank you. This means IDEA 6.01 is using 3.2M4 Eclipse compiler. Closing as a duplicate of bug 122610. If possible, you can try to patch this jar with the one from Eclipse 3.2.0 (v_671). I'll add specific regression test for this one.
*** This bug has been marked as a duplicate of 122610 ***
Reproduced with v_631 and checked that it is fixed with v_632. Added regression tests org.eclipse.jdt.core.tests.compiler.regression.GenericTypeTest#test1069/1070