ok, default methods in interfaces within in Kotlin...
# announcements
a
ok, default methods in interfaces within in Kotlin class heirarchy being called from java can result in
AbstractMethodError
. So how do you work around this: Interface
Base
with method
init()
in Java. Kotlin extends this with interface
MyBase
and adds a default implementation of
init()
. That is extended into
MyMegaBase
interface which does more. Then finally
HappyConcreteClass
class implements those and has a base class but does not override the default method. So a call that basically says the following, results in an `AbstractMethodError`:
Copy code
if (instance instanceof Base) {
  ((Base)instance).init();
}
The default method should be generated into
MyMegaBase
as the first class that implements the interface, yes? So why the error. (reported as https://youtrack.jetbrains.com/issue/KT-11267, but maybe isn’t a bug, it is just not allowed)