Kotlin does not (yet) generate Java 8 default methods.
n
nayanjyoti
07/19/2017, 9:16 AM
@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
diesieben07
07/19/2017, 9:17 AM
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
nayanjyoti
07/19/2017, 9:25 AM
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
diesieben07
07/19/2017, 9:47 AM
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.