Fixed
Status Update
Comments
da...@google.com <da...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit c46d3e79b2ea8b839358f0215b0a432ef8fad7a2
Author: Clara Fok <clarafok@google.com>
Date: Fri Nov 04 15:23:25 2022
Convert androidx.activity.Cancellable to kotlin
Test: ./gradlew activity:activity:cC
Bug: 257291701
Change-Id: I057f3e54811e7399e40083ef5e3915adc4fa425d
M activity/activity/src/main/java/androidx/activity/Cancellable.kt
https://android-review.googlesource.com/2288554
Branch: androidx-main
commit c46d3e79b2ea8b839358f0215b0a432ef8fad7a2
Author: Clara Fok <clarafok@google.com>
Date: Fri Nov 04 15:23:25 2022
Convert androidx.activity.Cancellable to kotlin
Test: ./gradlew activity:activity:cC
Bug: 257291701
Change-Id: I057f3e54811e7399e40083ef5e3915adc4fa425d
M activity/activity/src/main/java/androidx/activity/Cancellable.kt
Description
room-common (androidX)
room-coroutines (androidX)
Kotlin
Version used: 2.1.0-alpha03
Devices/Android versions reproduced on: Compilation error
This issue happens when you try to make a concret Room Dao inherit from a generic Dao using coroutine (with suspend keyword on them), it displays the following error :
error: Type of the parameter must be a class annotated with @Entity or a collection/array of it.
kotlin.coroutines.Continuation<? super kotlin.Unit> p1);
^
Classes I use to reproduce this problem :
@Database(
version = 1,
entities = [
User::class
],
exportSchema = true
)
abstract class RoomDB : RoomDatabase() {
abstract fun getUserDao(): UserDao
}
@Entity(tableName = "user")
data class User(
@PrimaryKey(autoGenerate = true) val id: Long = 0,
val firstName: String,
val lastName: String
)
interface BaseDao<T> {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertOrUpdate(entity: T)
}
@Dao
interface UserDao: BaseDao<User> {
@Query("SELECT * FROM user")
suspend fun loadAll(): List<User>
}
I tried several things, like using varags in parameter on insertOrUpdate method, or giving it an output (List<Int> or Int) without any change in the error.
A sample project is in attachment to reproduce this bug.
Thank you in advance