Bug 94898

Summary: [1.5] errors in ambiguous method invocation detection
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-12 03:23:27 EDT
I20050509-2010

I found differences between eclipse and javac regarding ambiguous method
invocation errors. See comments below.

package test1;
public class Main<A, B extends Number> {
    <T> T aaa(T t) {
        System.out.println("T");
        return null;
    }

    /**
     * uncomment this -> eclipse accepts, javac rejects all 3 calls below:
     * reference to aaa is ambiguous, both method 
     * <T>aaa(T) in test1.Main<java.lang.Object> and method
     * aaa(A)in test1.Main<java.lang.Object> match
     *   main.aaa(null);
     *       ^
     */
//    void aaa(A a) {
//    	System.out.println("A");
//    }

    /**
     * uncomment this -> javac accepts, eclipse rejects the call
     * main.aaa(15); below:
     * The method aaa(Integer) is ambiguous for the type Main<Object,Integer>
     */
//    void aaa(B b) {
//    	System.out.println("B");
//    }
    
    public static void main(String[] args) {
        Main<Object, Integer> main = new Main<Object, Integer>();
        main.aaa(null);
        main.aaa("X");
        main.aaa(15);
    }
}
Comment 1 Kent Johnson CLA 2005-06-03 11:04:56 EDT
Added MethodVerify test058
Comment 2 Olivier Thomann CLA 2005-06-06 16:56:57 EDT
Verified using N20050606-0010 + JDT/Core HEAD
Comment 3 Maxime Daniel CLA 2005-06-10 08:54:47 EDT
Verified for 3.1 RC2 using build I20050610-0010
Comment 4 Frederic Fusier CLA 2005-06-10 10:24:48 EDT
close