Bug 191029

Summary: Bad compiler error "The constructor ... is ambiguous"
Product: [Eclipse Project] JDT Reporter: NoName <utilisateur_182>
Component: CoreAssignee: 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:

Description NoName CLA 2007-06-05 09:40:13 EDT
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
Comment 1 NoName CLA 2007-06-05 09:45:22 EDT
Same error reported without generics:

	public void test2(TreeMap tm) {
		TreeMap copy = new TreeMap(tm);
	}
Comment 2 Olivier Thomann CLA 2007-06-05 09:46:40 EDT

*** This bug has been marked as a duplicate of bug 189933 ***
Comment 3 Olivier Thomann CLA 2007-06-05 09:47:40 EDT
Fix for bug 189933 fixes this problem as well.
Comment 4 Olivier Thomann CLA 2007-06-05 09:49:29 EDT
Both issues (generic and non generic cases) are fixed with fix for bug 189933.