- assigned_to: cclifton --> nobody
interface I { }
class A implements I { }
class B implements I {
void m(A a) {
System.out.println("in B");
}
}
class C extends B {
void m(I i) {
System.out.println("in C");
}
}
public class AmbigClient {
public static void main(String[] args) {
A arg = new A();
new C().m(arg);
}
}
Per JLS2 15.12.1, second main bullet, class C is searched for
methods applicable to the call.
Per JLS2 15.12.2.1, the paragraph following the two bullet
points, all applicable methods to the call found in C, _or
inherited by C_, are identified. (This inheritance check is
missing in mjc; we only look in supertypes if the search fails
on the subtype.)
Per JLS2 15.12.2.2, neither method is most specific: An
instance of C can be converted to an instance of B, but an
instance of I cannot be converted to an instance of A. An
instance of A can be converted to an instance of I, but an
instance of B cannot be converted to an instance of C. An
ambiguity should be signaled.