Community
Participate
Working Groups
public class AmbiguousMethodTest { public static void main(String[] args){ new ExtendDao().testAmbiguous(); } } class SuperObject { } class DerivedObject extends SuperObject{ } class BaseDao{ protected <T extends SuperObject> void test(T t){ System.out.println("BaseDao test()"); } } class ExtendDao extends BaseDao{ public void test(SuperObject t){ System.out.println("ExtendDao test()"); } public void testAmbiguous(){ this.test(new DerivedObject()); } } Eclipse compile has error: The method test(SuperObject) is ambiguous for the type ExtendDao but when I use javac to compile, it is correct!
3.2 still exhibits the same behavior.
I thought this was fixed for 3.2M5, but it seems not Try testing with this code also, without line marked /*1*/ both 2 and 3 show as errors, with line 1 only 3 shows as an error! package test; import java.util.List; import java.util.Set; public class Test { interface OrderedSet<E> extends List<E>, Set<E> { /*1*/ boolean add(E o); } public static void main(String[] args) { OrderedSet<String> os = null; /*2*/ os.add("hello"); OrderedSet<Integer> os2 = null; /*3*/ os2.add(1); } }
Added AmbiguousMethod test008 and test009
Verified for 3.2 M6 using warm-up build I20060327-0010.