Summary: | [1.6][compiler] Incorrectly report ambiguity of methods with generics | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Ildar Safarov <ildar.safarov> | ||||||
Component: | Core | Assignee: | Kent Johnson <kent_johnson> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | major | ||||||||
Priority: | P3 | CC: | jarthana, joerg, srikanth_sankaran, yozh | ||||||
Version: | 3.5 | ||||||||
Target Milestone: | 3.5 M7 | ||||||||
Hardware: | PC | ||||||||
OS: | Linux | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
It is definitely a bug, because === List<String> l = Collections.emptyList(); === is correct code. *** Bug 225518 has been marked as a duplicate of this bug. *** Created attachment 129261 [details]
Proposed patch and testcase
Fix and test released for 3.5M7 Verified for 3.5M7 using build I20090426-2000 *** Bug 264491 has been marked as a duplicate of this bug. *** |
Created attachment 128957 [details] Archived eclipse project where bug is reproduced Build ID: M20090211-1700 Steps To Reproduce: Define this: === public interface MyCollection<E> { <T> MyCollection<T> uncheckedCast(); } public interface MyList<E> extends MyCollection<E> { <T> MyList<T> uncheckedCast(); } public class MyCollectionImpl<E> implements MyCollection<E> { public <T> MyCollectionImpl<T> uncheckedCast() { return null; } } public class MyListImpl<E> extends MyCollectionImpl<E> implements MyList<E> { public <T> MyListImpl<T> uncheckedCast() { return null; } } public class Main { public static void main(String[] args) { MyList<Integer> ints = new MyListImpl<Integer>(); MyList<String> strings = ints.uncheckedCast(); } } === Eclipse will report "The method uncheckedCast() is ambiguous for the type MyList<Integer> Main.java line 7". While everything is ok with javac (JDK version 1.6 update 10). Compiler compliance level is set to 1.6 in project settings. More information: I already reported similar bug for static methods - id was 225518 - but presented example was incorrect.