https://kotlinlang.org logo
#announcements
Title
# announcements
d

Dalinar

09/19/2017, 6:20 AM
is it ok to override a java default method (in the kotlin subclass interface of the java interface)? I ask because you can't call it via super so was wondering if there could be any unforseen consequences
k

karelpeeters

09/19/2017, 10:19 AM
Are you talking about a default method in a Kotlin interface? If so, you can't call it via super because default methods don't exist in jdk6, so Kotlin uses a trick to make them work, every implementation automatically calls
MyInterface.DefaultMethods.myDefaultMethod(this)
or something like that. You should be fine overriding it, and if you want you can also call the default method from Java.
d

Dalinar

09/19/2017, 11:19 AM
yes, thanks for the explanation
2 Views