Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 94754

Summary: [1.5][compiler] Ambiguous method call is not detected
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Olivier Thomann CLA 2005-05-11 11:30:52 EDT
Related to bug 90423, if the code is changed to:
public class Overloading {

	public static <S extends String> S foo() { 
	    System.out.println("String"); 
	    return null; 
	  }
	  
	public static <N extends Number> N foo() { 
	    System.out.println("Number");
	    return null; 
	}
	
	public static void main(String[] args) {
		Overloading.<String>foo();
		Overloading.<Number>foo();
		Overloading o = new Overloading();
	        foo();
	}
}

it compiles fine, but javac reports:
Overloading.java:17: reference to foo is ambiguous, both method <S>foo() in
Overloading and method <N>foo() in Overloading match
            foo();
            ^
1 error
Comment 1 Kent Johnson CLA 2005-06-03 11:04:09 EDT
Added onto MethodVerify test050
Comment 2 Olivier Thomann CLA 2005-06-06 16:54:17 EDT
Verified using N20050606-0010 + JDT/Core HEAD
Comment 3 Maxime Daniel CLA 2005-06-10 07:17:36 EDT
Verified for 3.1 RC2 using build I20050610-0010
Comment 4 Frederic Fusier CLA 2005-06-10 10:24:21 EDT
close