Bug 97219 - [1.5] eclipse does not detect ambiguous method invocation errors
Summary: [1.5] eclipse does not detect ambiguous method invocation errors
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-30 06:58 EDT by Markus Keller CLA
Modified: 2005-06-10 10:27 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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