realm-java v4.0.0 Release Notes

Release Date: 2017-10-16 // over 6 years ago
  • πŸ’₯ Breaking Changes

    ⬆️ The internal file format has been upgraded. Opening an older Realm will upgrade the file automatically, but older versions of Realm will no longer be able to read the file.

    • ⚑️ [ObjectServer] Updated protocol version to 22 which is only compatible with Realm Object Server >= 2.0.0.
    • πŸ”€ [ObjectServer] Removed deprecated APIs SyncUser.retrieveUser() and SyncUser.retrieveUserAsync(). Use SyncUser.retrieveInfoForUser() and retrieveInfoForUserAsync() instead.
    • πŸ”€ [ObjectServer] SyncUser.Callback now accepts a generic parameter indicating type of object returned when onSuccess is called.
    • πŸ”€ [ObjectServer] Renamed SyncUser.getAccessToken to SyncUser.getRefreshToken.
    • πŸ”€ [ObjectServer] Removed deprecated API SyncUser.getManagementRealm().
    • Calling distinct() on a sorted RealmResults no longer clears any sorting defined (#3503).
    • 😌 Relaxed upper bound of type parameter of RealmList, RealmQuery, RealmResults, RealmCollection, OrderedRealmCollection and OrderedRealmCollectionSnapshot.
    • ⬆️ Realm has upgraded its RxJava1 support to RxJava2 (#3497)
      • Realm.asObservable() has been renamed to Realm.asFlowable().
      • RealmList.asObservable() has been renamed to RealmList.asFlowable().
      • RealmResults.asObservable() has been renamed to RealmResults.asFlowable().
      • RealmObject.asObservable() has been renamed to RealmObject.asFlowable().
      • RxObservableFactory now return RxJava2 types instead of RxJava1 types.
    • βœ‚ Removed deprecated APIs RealmSchema.close() and RealmObjectSchema.close(). Those don't have to be called anymore.
    • βœ‚ Removed deprecated API RealmResults.removeChangeListeners(). Use RealmResults.removeAllChangeListeners() instead.
    • βœ‚ Removed deprecated API RealmObject.removeChangeListeners(). Use RealmObject.removeAllChangeListeners() instead.
    • πŸ‘ Removed UNSUPPORTED_TABLE, UNSUPPORTED_MIXED and UNSUPPORTED_DATE from RealmFieldType.
    • βœ‚ Removed deprecated API RealmResults.distinct()/RealmResults.distinctAsync(). Use RealmQuery.distinct()/RealmQuery.distinctAsync() instead.
    • 🚚 RealmQuery.createQuery(Realm, Class), RealmQuery.createDynamicQuery(DynamicRealm, String), RealmQuery.createQueryFromResult(RealmResults) and RealmQuery.createQueryFromList(RealmList) have been removed. Use Realm.where(Class), DynamicRealm.where(String), RealmResults.where() and RealmList.where() instead.

    ✨ Enhancements

    • πŸ“‡ [ObjectServer] SyncUserInfo now also exposes a users metadata using SyncUserInfo.getMetadata()
    • πŸ‘ RealmList can now contain String, byte[], Boolean, Long, Integer, Short, Byte, Double, Float and Date values. Queries and Importing primitive lists from JSON are not supported yet.
    • βž• Added support for lists of primitives in RealmObjectSchema with addRealmListField(String fieldName, Class<?> primitiveType)
    • βž• Added support for lists of primitives in DynamicRealmObject with setList(String fieldName, RealmList<?> list) and getList(String fieldName, Class<?> primitiveType).
    • 🐎 Minor performance improvement when copy/insert objects into Realm.
    • βž• Added static RealmObject.getRealm(RealmModel), RealmObject.getRealm() and DynamicRealmObject.getDynamicRealm() (#4720).
    • βž• Added RealmResults.asChangesetObservable() that emits the pair (results, changeset) (#4277).
    • βž• Added RealmList.asChangesetObservable() that emits the pair (list, changeset) (#4277).
    • βž• Added RealmObject.asChangesetObservable() that emits the pair (object, changeset) (#4277).
    • All Realm annotations are now kept at runtime, allowing runtime tools access to them (#5344).
    • Speedup schema initialization when a Realm file is first accessed (#5391).

    πŸ› Bug Fixes

    • [ObjectServer] Exposing a RealmConfiguration that allows a user to open the backup Realm after the client reset (#4759/#5223).
    • πŸ”€ [ObjectServer] Realm no longer throws a native β€œunsupported instruction” exception in some cases when opening a synced Realm asynchronously (https://github.com/realm/realm-object-store/issues/502).
    • πŸ›  [ObjectServer] Fixed "Cannot open the read only Realm" issue when getPermissionManager (#5414).
    • Throw IllegalArgumentException instead of IllegalStateException when calling string/binary data setters if the data length exceeds the limit.
    • βž• Added support for ISO8601 2-digit time zone designators (#5309).
    • "Bad File Header" caused by the device running out of space while compacting the Realm (#5011).
    • RealmQuery.equalTo() failed to find null values on an indexed field if using Case.INSENSITIVE (#5299).
    • Assigning a managed object's own list to itself would accidentally clear it (#5395).
    • Don't try to acquire ApplicationContext if not available in Realm.init(Context) (#5389).
    • Removing and re-adding a changelistener from inside a changelistener sometimes caused notifications to be missed (#5411).

    Internal

    • ⬆️ Upgraded to Realm Sync 2.0.2.
    • ⬆️ Upgraded to Realm Core 4.0.2.
    • ⬆️ Upgraded to OkHttp 3.9.0.
    • ⬆️ Upgraded to RxJava 2.1.4.
    • πŸ‘‰ Use Object Store to create the primary key table.

    Credits

    • πŸ‘ Thanks to @JussiPekonen for adding support for 2-digit time zone designators when importing JSON (#5309).