Community
Participate
Working Groups
In the below given test case, Eclispe java compiler reports "Type mismatch: cannot convert from Collection<IDA.Enum1> to Collection<IDA.Enum1>" error in S.java. Interestingly, the error does not appear when these interfaces/classes are in the same file (non-public). ID.java: ------- import java.util.Collection; public interface ID { Collection<? extends Comparable<?>> getIds(); } IDA.java: -------- import java.util.Collection; public interface IDA<T1, C1, E1, E2, C2, T2> extends ID { enum Enum1 { ONE, TWO } Collection<IDA.Enum1> getIds(); } S.java: ------ import java.util.Collection; class S { public static void cow(IDA<?, ?, ?, ?, ?, ?> s) { Collection<IDA.Enum1> ids = s.getIds(); // Error here } }
I just tried with 3.2RC2 and I could not reproduce. Could you please try with RC2 and let me know if you reproduce? I could not reproduce using 3.2RC1, 3.2M6, 3.2M4. What is your build id?
The buildId is I20060428-1315. This error was not occurring prior to 3.2RC2.
I tried with the same build and I could not reproduce. Could you please provide your compiler preferences? Thanks.
Created attachment 40025 [details] JDT (compiler) preferences My compiler prefrences.
Here is how you can reproduce it. (I have turned on "Build Automatically" option.) 1) Create a Java project and dump the files into the project. 2) Clean the project. The build should not show any error. 3) Now, open S.java, type an arbitrary whitespace, and save the file. The error should appear.
Reproduced using RC2. Seems to affect the incremental compiler only. A batch compilation works fine.
Reproduced, added GenericTypeTest#test0976. This indeed is a regression introduced with fix for bug 137203. Tuned LookupEnvironment#convertUnresolvedBinaryToRawType(...) to meet expectation.
Markus: as Martin's backup, can you pls cast your vote ? This is a regression introduced in RC2. Without it, we have an inconsistency in between the type resolved from source and binary reference, which are thus no longer comparing identical any longer. This likely is also visible in DOM AST.
Created attachment 40029 [details] Proposed patch Patch contains the LookupEnvironment fix + regression test. Also added a small performance change (check Object scenario which occurs frequently from what was seen during debugging - Object cannot be generic per construction).
+1 for 3.2 RC3.
*** Bug 139619 has been marked as a duplicate of this bug. ***
fixed in HEAD
*** Bug 139669 has been marked as a duplicate of this bug. ***
Verified using N20060503-0010 for 3.2RC3
Double-checked using build N20060504-0010
*** Bug 140466 has been marked as a duplicate of this bug. ***