I have an interface in Kotlin that I want to have default implementations so that implementing classes will only have to implement a subset of the methods. Example:
interface PersonInterface {
val firstname: String?
get() = null
val lastName: String?
get() = null
val phoneNumbers: List<String>?
get() = null
val interests: List<List<String>>?
get() = emptyList()
}
This in my understanding would create default implementations for the methods to return null or an empty list or whatever I would have as defaults in general.
But if I create the following class in Java (which I expected it would compile):
public class Employee implements PersonInterface {
}
I get:
Class Employee must either be declared abstract or implement abstract method getFirstName in PersonInterface
Is it possible to use default interface implementation defined in Kotlin from Java?