Kotlin does not (yet) generate Java 8 default meth...
# getting-started
d
Kotlin does not (yet) generate Java 8 default methods.
n
@diesieben07 : Ohh. So how would you suggest me to proceed here? I want both these methods to be in the interface, but the getSingle should simply have the impl as in the code shown. Should I add them as extension functions in the project?
d
You can either use extension functions or implement an interface in Java with default methods that call the static "default" methods generated by kotlin.
n
I am using this interface in kotlin code, but this interface implementation will be provided by the java code base which will include the jar of the kotlin project. So I think extension function will be better?
d
Calling extension functions from Java is like calling static utility functions. If you can live with that, you should use that approach. Otherwise go with the adapter interface approach.
👍 1