Summary: | Bad compiler error "The constructor ... is ambiguous" | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | NoName <utilisateur_182> |
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
Status: | RESOLVED DUPLICATE | QA Contact: | |
Severity: | major | ||
Priority: | P3 | ||
Version: | 3.3 | ||
Target Milestone: | 3.3 RC4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Same error reported without generics: public void test2(TreeMap tm) { TreeMap copy = new TreeMap(tm); } *** This bug has been marked as a duplicate of bug 189933 *** Fix for bug 189933 fixes this problem as well. Both issues (generic and non generic cases) are fixed with fix for bug 189933. |
Build ID: I20070601-1539 Steps To Reproduce: 1. Try to compile the sample code below with eclipse 3.3RC3 2. An error is reported : The constructor TreeMap(Map) is ambiguous 3. javac (jdk1.5.0_11) doesn't report that error More information: import java.util.TreeMap; === Sample code ========================== public class TestAmbiguous { public void test(TreeMap<String, Object> tm) { TreeMap copy = new TreeMap(tm); } } === javac output =================== > "C:\Program Files\Java\jdk1.5.0_11\bin\javac.exe" -Xlint TestAmbig uous.java TestAmbiguous.java:6: warning: [unchecked] unchecked call to TreeMap(java.util.S ortedMap<K,? extends V>) as a member of the raw type java.util.TreeMap TreeMap copy = new TreeMap(tm); ^ 1 warning