Bug 97219

Summary: [1.5] eclipse does not detect ambiguous method invocation errors
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-05-30 06:58:30 EDT
I20050527-1300

Example adapted from bug 97027. Several of the calls to test() are flagged by
javac ("reference to test is ambiguous, both method test() in xy.AA<xy.CC> and
method <T>test() in xy.BB match"), but accepted by Eclipse.

public class Try {
  public static void main(String[] args) {
    BB bb= new BB();
    
    AA<CC> res= bb.test(); // eclipse accepts, javac rejects
    AA<Object> res1= bb.test(); // different errors
    BB res2= bb.test(); // eclipse accepts, javac rejects
    AA res3= bb.test(); // eclipse accepts, javac rejects
    bb.<Object>test(); // both accept
    
    AA<CC> a= bb;
    a.test(); // both accept
  }
}

class AA<T> {
  public AA<Object> test() { System.out.println("AA<T>#test()"); return null; }
}
class BB extends AA<CC> {
  public <T> BB test() { System.out.println("BB#test()"); return null; }
}
class CC {}
Comment 1 Philipe Mulet CLA 2005-06-01 12:29:12 EDT
On line:     AA<Object> res1= bb.test(); // different errors
Our latest reports: Type mismatch: cannot convert from BB to AA<Object>
as does javac.

Comment 2 Kent Johnson CLA 2005-06-01 14:52:26 EDT
We now detect the ambiguous methods. The type mismatches are only detected 
after a valid method is found.

Added GenericType test706
Comment 3 Olivier Thomann CLA 2005-06-06 17:08:20 EDT
Verified using N20050606-0010 + JDT/Core HEAD
Comment 4 Maxime Daniel CLA 2005-06-10 10:01:53 EDT
Verified for 3.1 RC2 using build I20050610-0010
Comment 5 Frederic Fusier CLA 2005-06-10 10:27:39 EDT
close