Community
Participate
Working Groups
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
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.