Breaking changes which don't make sense between 1.9.1 and 1.10.1

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintableJSON

      How frequently does the bug occur?

      Always on 1.10.1

      Description

      In 1.9.1, the following would work, where defaultRealmConfiguration is a RealmConfiguration

          open val hasAnyRecords: Boolean
              get() = if (
                  isDefaultRealmOpen &&
                  defaultRealmConfiguration.schema.isNotEmpty()
              ) {
                  var hasAny = false
                  for (it in defaultRealmConfiguration.schema) {
                      if (defaultRealm.query(clazz = it).count().find() > 0L) {
                          hasAny = true
                          break
                      }
                  }
                  Timber.tag(TAG).v("Repo contains records: $hasAny")
                  hasAny
              } else {
                  false
              }
      

      As of 1.10.1 you are now requiring a TypedRealmObject for the defaultRealm.query(...) method. Why not still allow the more loose type BaseRealmObject? Especially, considering that's the type you're storing in the schema property for the RealmConfiguration, which makes it a convenient place to know all the types available in the Realm, and to be able to query them easily.

      Or, is there an easier way to know if the Realm has any data in it?

      Stacktrace & log output

      There is not a stack trace, there's a built-time error in Android Studio, which says:

      Type mismatch: inferred type is BaseRealmObject but TypedRealmObject was expected

      Can you reproduce the bug?

      Always

      Reproduction Steps

      Use the code with a RealmConfiguration on 1.9.1 and 1.10.1

      Version

      1.10.1

      What Atlas App Services are you using?

      Local Database only

      Are you using encryption?

      No

      Platform OS and version(s)

      Android 33

      Build environment

      Android Studio version:
      Android Studio Flamingo | 2022.2.1 Patch

      Android Build Tools version:

      Build #AI-222.4459.24.2221.10121639, built on May 12, 2023

      Gradle version: 8.0.2

              Assignee:
              Unassigned
              Reporter:
              Unito Sync Bot
              Archiver:
              Marc Greenfield

                Created:
                Updated:
                Resolved:
                Archived: