| Summary: | [1.5] errors in ambiguous method invocation detection | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Core | Assignee: | 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: | |||
Added MethodVerify test058 Verified using N20050606-0010 + JDT/Core HEAD Verified for 3.1 RC2 using build I20050610-0010 close |
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); } }