-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Always
Description
object RealmWorker { val realm: Realm init { val config = RealmConfiguration.create( schema = setOf(FeedR::class, FeedItemR::class, FeedMediaR::class) ) realm = Realm.open(config) } } class FeedR : RealmObject { ... @JvmField var items: RealmList<FeedItemR> = realmListOf() fun fromFeed(feed: Feed) { ... this.items = realmListOf<FeedItemR>().apply { for (item in feed.items) { val itemR = FeedItemR() itemR.fromFeedItem(item) add(itemR) } } } }
val feedR = FeedR() feedR.fromFeed(result_.feed) realm.writeBlocking { copyToRealm(feedR) }
Stacktrace & log output
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
java.lang.ClassCastException: io.realm.kotlin.internal.UnmanagedRealmList cannot be cast to io.realm.kotlin.internal.ManagedRealmList at io.realm.kotlin.internal.RealmObjectHelper.assignTyped$io_realm_kotlin_library(RealmObjectHelper.kt:797) at io.realm.kotlin.internal.RealmObjectHelper.assign$io_realm_kotlin_library(RealmObjectHelper.kt:734) at io.realm.kotlin.internal.RealmUtilsKt.copyToRealm(RealmUtils.kt:220) at io.realm.kotlin.internal.RealmUtilsKt.copyToRealm$default(RealmUtils.kt:144) at io.realm.kotlin.internal.InternalMutableRealm$DefaultImpls.copyToRealm(InternalMutableRealm.kt:57) at io.realm.kotlin.internal.SuspendableWriter$WriterRealm.copyToRealm(SuspendableWriter.kt:58) at io.realm.kotlin.MutableRealm$DefaultImpls.copyToRealm$default(MutableRealm.kt:88) at ac.mdiq.podcini.ui.fragment.OnlineFeedViewFragment$parseFeed$1$result$1$1.invoke(OnlineFeedViewFragment.kt:406) at ac.mdiq.podcini.ui.fragment.OnlineFeedViewFragment$parseFeed$1$result$1$1.invoke(OnlineFeedViewFragment.kt:405) at io.realm.kotlin.internal.SuspendableWriter$write$2.invokeSuspend(SuspendableWriter.kt:125) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
```
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
SDK 33, 34
What Atlas App Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
Manjaro 24.0
Build environment
Android Studio version: IntelliJ IDEA 2024.1.1 (Community Edition)
Android Build Tools version: 34
Gradle version: 8.5
BTW, it's my first attempt to integrate Realm in my open source project, hoping to replace SQLite. If someone suspect something I do could cause this exception, please make some suggestions.