According to jls-9.4.1.3
If an interface I inherits a default method whose signature is override-equivalent with another method inherited by I, then a compile-time error occurs. (This is the case whether the other method is abstract or default.)
From above description following code should not compile.
However, when I compile this code, its working absolutely fine.
interface A {
void foo(String s);
}
interface B<T> extends A {
default void foo(T x) {
}
}
interface C extends B<String> {
}
Why does it compile?