Community
Participate
Working Groups
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 {}
On line: AA<Object> res1= bb.test(); // different errors Our latest reports: Type mismatch: cannot convert from BB to AA<Object> as does javac.
We now detect the ambiguous methods. The type mismatches are only detected after a valid method is found. Added GenericType test706
Verified using N20050606-0010 + JDT/Core HEAD
Verified for 3.1 RC2 using build I20050610-0010
close