Здравствуйте, Qbit86, Вы писали:
C>>Вот за каким хреном так сделали?
Q>Представь, что у тебя твой TestClass реализует не только интерфейс ITest, но и ICompletelyDifferentInterface:
Q>Q>internal interface ICompletelyDifferentInterface
Q>{
Q> void Method() => Console.WriteLine(nameof(ICompletelyDifferentInterface));
Q>}
Q>
Q>Метод Method() какого интерфейса по-твоему должен быть вызван в вызове `obj.Method()`?
interface I1 {
default void method() {
System.out.println("I1");
}
}
interface I2 {
default void method() {
System.out.println("I2");
}
}
static class TestClass implements I1, I2 {
}
java: types test.Test.I1 and test.Test.I2 are incompatible;
class test.Test.TestClass inherits unrelated defaults for method() from types test.Test.I1 and test.Test.I2
static class TestClass implements I1, I2 {
@Override
public void method() {
I1.super.method();
}
}
работает