Community
Participate
Working Groups
In the code below, Eclipse marks the call to ambiguity.meth as a compiler error "ambiguous", but the call to noAmbiguity.meth generates no compiler error, when it should generate exactly the same error. The only difference between Ambiguity and NoAmbiguity is that one of the ambiguous methods in NoAmbiguity implements an interface. The correct behaviour (according to Java Language Spec and javac) is for both calls to generate a compiler error. public class Bug { public static class Ambiguity { public void meth(int arg1, int arg2) { } public void meth(Number arg1, Number arg2) { } } public interface Interface { public void meth(Number arg1, Number arg2); } public static class NoAmbiguity implements Interface { public void meth(int arg1, int arg2) { } public void meth(Number arg1, Number arg2) { } } public static void main(String[] args) { NoAmbiguity noAmbiguity = new NoAmbiguity(); noAmbiguity.meth(new Integer(1), 2); Ambiguity ambiguity = new Ambiguity(); ambiguity.meth(new Integer(1), 2); } }
Added AmbiguousMethod test007
Verified for 3.2 M6 using warm-up build I20060327-0010.