Bug 94898 - [1.5] errors in ambiguous method invocation detection
Summary: [1.5] errors in ambiguous method invocation detection
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-12 03:23 EDT by Markus Keller CLA
Modified: 2005-06-10 10:24 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-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