hfhbd
08/03/2021, 12:52 PM// shared module, not depending on android
interface Dao {
suspend fun getAll(): List<A>
}
// android
@Dao
interface RoomDao {
@Query("select * from a")
override suspend fun getAll(): List<A>
}
I am always getting An abstract DAO method must be annotated with one and only one of the following annotations: Insert,Delete,Query,Update,RawQuery - Dao.getAll()
Do I really have to annotate the Dao.getAll
too, even if I override this function in RoomDao with the one annotation?
https://medium.com/androiddevelopers/7-pro-tips-for-room-fbadea4bfbd1#dd40hfhbd
08/03/2021, 1:03 PM// shared module, not depending on android
interface Dao {
suspend fun getAll(): List<@JvmSuppressWildcards A>
}
Reason:
"The issue is not in room restrictions, but in kotlin implementation itself. You are using generic collection method, which by default is processed to List<? extends T> java implementation, but overridden method has List<Foo> return type. Room generator matches method signature and can't find implemented method with same signature, so you get" the error
source: https://stackoverflow.com/a/56221074/6862985