Hi,
Please i need help from you.
since i updated my kotlin from 1.5.31 to 1.6.0, my Android Room baseDao class can’t be compiled again.
Below my BaseDao class:
interface BaseDao<T> {
/**
* Insert an object in the database.
*
*/
@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(obj: T): Long
/**
* Insert an array of objects in the database.
*
* @param obj the objects to be inserted.
*/
@Insert
suspend fun insert(vararg obj: T): LongArray
/**
* Update an object from the database.
*
* @param obj the object to be updated
*/
@Update(onConflict = OnConflictStrategy.REPLACE)
suspend fun update(obj: T)
/**
* Delete an object from the database
*
* @param obj the object to be deleted
*/
@Delete
suspend fun delete(obj: T)
}
@Transaction
suspend inline fun <reified T> BaseDao<T>.insertOrUpdate(item: T) {
if (insert(item) != -1L) return
update(item)
}
Sample of error:
BaseDao.java:19: error: Type of the parameter must be a class annotated with @Entity or a collection/array of it.
kotlin.coroutines.Continuation<? super java.lang.Long> continuation);
error: Not sure how to handle insert method’s return type.
public abstract java.lang.Object insert(T obj, @org.jetbrains.annotations.NotNull()
Thanks for your help.