Realm v7.0.0 Release Notes

Release Date: 2020-05-16 // 16 days ago
  • 🚀 NOTE: This version bumps the Realm file format to version 10. Files created with previous versions of Realm will be automatically upgraded. It is not possible to downgrade to version 9 or earlier. Only Studio 3.11 or later will be able to open the new file format.

    💥 Breaking Changes

    • 🏗 [ObjectServer] Removed deprecated method SyncConfiguration.Builder.partialRealm(). Use SyncConfiguration.Builder.fullSynchronization() instead.
    • 🔀 [ObjectServer] Removed deprecated methods SyncConfiguration.automatic() and SyncConfiguration.automatic(User, Uri). Use SyncUser.getDefaultConfiguration() and SyncUser.createConfiguration(Url).
    • 🚚 [ObjectServer] Removed deprecated method ErrorCode.fromInt(int).
    • 🔀 [ObjectServer] Removed deprecated method SyncCredentials.nickname(name) and SyncCredentials.nickname(name, isAdmin). Use SyncCredentials.usernamePassword(username, password) instead.
    • 🏗 [ObjectServer] Deprecated state SyncSession.State.ERROR has been removed. Use SyncConfiguration.Builder.errorHandler(ErrorHandler) instead.
    • 🚚 [ObjectServer] IncompatibleSyncedFileException is removed as it is no longer used.
    • 🔀 [ObjectServer] New error codes thrown by the underlying sync layers now have proper enum mappings in ErrorCode.java. A few other errors have been renamed in order to have consistent naming. (Issue #6387)
    • 🔀 RxJava Flowables and Observables are now subscribed to and unsubscribed to asynchronously on the thread holding the live Realm, instead of previously where this was done synchronously.
    • 🏗 All RxJava Flowables and Observables now return frozen objects instead of live objects. This can be configured using RealmConfiguration.Builder.rxFactory(new RealmObservableFactory(true|false)). By using frozen objects, it is possible to send RealmObjects across threads, which means that all RxJava operators should now be supported without the need to copy Realm data into unmanaged objects.
    • 👍 MIPS is not supported anymore.
    • Realm now requires minSdkVersion 16. Up from 9.
    • 🚚 [ObjectServer] IncompatibleSyncedFileException is removed and no longer thrown.

    ✨ Enhancements

    • ➕ Added Realm.freeze(), RealmObject.freeze(), RealmResults.freeze() and RealmList.freeze(). These methods will return a frozen version of the current Realm data. This data can be read from any thread without throwing an IllegalStateException, but will never change. All frozen Realms and data can be closed by calling Realm.close() on the frozen Realm, but fully closing all live Realms will also close the frozen ones. Frozen data can be queried as normal, but trying to mutate it in any way will throw an IllegalStateException. This includes all methods that attempt to refresh or add change listeners. (Issue #6590)
    • ➕ Added Realm.isFrozen(), RealmObject.isFrozen(), RealmObject.isFrozen(RealmModel), RealmResults.isFrozen() and RealmList.isFrozen(), which returns whether or not the data is frozen.
    • ➕ Added RealmConfiguration.Builder.maxNumberOfActiveVersions(long number). Setting this will cause Realm to throw an IllegalStateException if too many versions of the Realm data are live at the same time. Having too many versions can dramatically increase the filesize of the Realm.
    • RealmResults.asJSON() is no longer @Beta.
    • 0️⃣ The default toString() for proxy objects now print the length of binary fields. (Issue #6767)

    🛠 Fixes

    • 🛠 If a DynamicRealm and Realm was opened for the same file they would share transaction state by accident. The implication was that writes to a Realm would immediately show up in the DynamicRealm. This has been fixed, so now it is required to call refresh() on the other Realm or wait for normal change listeners to detect the change.

    Compatibility

    • Realm Object Server: 3.23.1 or later.
    • Realm Studio: 3.11 or later.
    • ⬆️ File format: Generates Realms with format v10 (Reads and upgrades all previous formats from Realm Java 2.0 and later).
    • 🚀 APIs are backwards compatible with all previous release of realm-java in the 7.x.y series.

    Internal

    • OsSharedRealm.VersionID.hashCode() was not implemented correctly and included the memory location in the hashcode.
    • ⬆️ OKHttp was upgraded to 3.10.0 from 3.9.0.
    • ⬆️ The NDK has been upgraded from r10e to r21.
    • The compiler used for C++ code has changed from GCC to Clang.
    • ⬆️ OpenSSL used by Realms encryption layer has been upgraded from 1.0.2k to 1.1.1b.
    • ⚡️ Updated to Object Store commit: 820b74e2378f111991877d43068a95d2b7a2e404.
    • ⚡️ Updated to Realm Sync 5.0.3.
    • ⚡️ Updated to Realm Core 6.0.4.

    Credits

    • 👍 Thanks to @joxon for better support for binary fields in proxy objects.