Status Update
Comments
da...@google.com <da...@google.com> #2
This is probably happening because there are multiple instances of DataStore active. You should consider managing the DataStore as a singleton. See the attached bug for more info.
ha...@gmail.com <ha...@gmail.com> #3
Thanks for investigating! I just tried @JvmDefault and got: error: An abstract DAO method must be annotated with one and only one of the following annotations: Insert,Delete,Query,Update,RawQuery
da...@google.com <da...@google.com> #4
Hmmm... that should have worked, last time I try it, it did. I'll investigate further. In the mean time, it would be great if you had a sample project with a similar setup as your to reproduce the issue, thanks!.
da...@google.com <da...@google.com> #5
Hey, I'm unable to reproduce this locally. Using @JvmDefault to add a function with implementation to a Kotlin interface that has no Room annotation works fine for me.
Your 1st comment says you are using Room 2.1.0-alpha07 can you try using Room 2.1.0 and see if the issue happens again? Or if you can provide a sample app that reproduces the issue then even better.
Your 1st comment says you are using Room 2.1.0-alpha07 can you try using Room 2.1.0 and see if the issue happens again? Or if you can provide a sample app that reproduces the issue then even better.
Description
Version used:
kotlin 1.3.30
room_version = "2.1.0-alpha07"
Devices/Android versions reproduced on:
compileSdkVersion 28
minSdkVersion 26
If this is a bug in the library, we would appreciate if you could attach:
@Entity
class TestData()
{
@PrimaryKey
var id: Int = 0
}
@Dao
interface DataDao
{
@Insert
fun insert(d: TestData)
@Update
fun update(d: TestData)
// If uncommented:
// Error: DataDao_Impl is not abstract and does not override abstract method upsert(TestData) in DataDao
/*
fun upsert(d: TestData)
{}
*/
}
// works
fun DataDao.upsert(d:TestData)
{}
@Database(entities = arrayOf(TestData::class), version = 1)
abstract class DDatabase : RoomDatabase()
{
abstract fun dao(): DataDao
}