Name: mc57594 Date: 02/21/97
if the primary expression of a method invocation has interface
type, and that interface inherits two methods with the same signature, the
compiler reports an ambiguity if f() is called through the derived
interface, even though the signatures are identical and so should be
treated as one entity for the purposes of overload resolution. (Guy Steele
has confirmed this interpretation of the JLS.)
Sample code:
interface A {
void f ();
}
interface B {
void f ();
}
interface C extends A, B {
}
class D {
void g (C c) {
c.f(); // this should not be ambiguous
}
}
Note that if C is an abstract class not an interface the code compiles
correctly.
======================================================================
- duplicates
-
JDK-4030955 Identical signatures cause ambiguity during overload resolution
-
- Closed
-