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

Daniele Segato

09/18/2018, 5:07 PM
I've stumbled into the first problem I had caused by kotlin.. "default" function do not work if a Java class extends them, this happened with Room database, the code below gives an error when I try to compile:
Copy code
error: MyDao_Impl is not abstract and does not override abstract method myInterfaceMethod(String) in MyDao
If I write the same Dao in Java it compile with no issue:
Copy code
@Dao
public interface TestDao {
    @Ignore
    default String myInterfaceMethod(String test) {
        return test;
    }
}
anyone know if there's a way to make it work? maybe some Annotation?
If I add
@JvmDefault
annotation on the method Android Studio complains I should set jvm-target-1.8 and when i build I get a different error:
Copy code
error: An abstract DAO method must be annotated with one and only one of the following annotations: Insert,Delete,Query,Update,RawQuery
watching the
_Impl
it added a method with empty return null body