Update: Seems like it's really a bug.
A class or super-class method declaration always takes priority over a default method!
default hello(...)
method from the Myinterface
allows you to write without errors:
ClassB b = new ClassB();
b.hello();
Until runtime, because at runtime hello(...)
method from the ClassA
takes the highest priority (but the method is private). Therefore, IllegalAccessError
occurs.
If you remove the default hello(...)
method from the interface, you get the same illegal access error, but now at compile time.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…