Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-378

Breaking changes wishlist for Realm Java 10.0

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      This ticket is for tracking and general discussion of breaking changes in a future 6.0 release.

      Please edit the main post to add a topic with a sequence number, and we can discuss it in the comments. If the breaking change is decided to be worthy to add, then create a separate issue for it.

      1. Upgrade to NDK 21+. (ACCEPTED)

      This will remove MIPS support and bump minimum the minimum SDK level to 16. No-one is using MIPS anyway and bumping the minimum SDK level will affect less than 0.5% of current builders. See https://github.com/realm/realm-java/pull/6460

      2. Rework how RealmQuery.findFirstAsync() works.

      It is confusing to use and doesn't support subscriptions. The current best proposal is having a RealmOptional<Person> obj = realm.where(Person.class).findFirstAsync();. See https://github.com/realm/realm-java/issues/6040 and https://github.com/realm/realm-java/issues/5179

      3. Consider changing Realm.getInstance() to Realm.open().

      To better represent the open/close paradigm required by Realm instead of getInstance which implies a cached value is returned (which it also kinda is).

      I'm not 100% convinced it is worth breaking everyone for this, but we should probably take a closer look.

      See https://github.com/realm/realm-java/issues/5372#issuecomment-334686564

      4. Realm.init() should not define a default configuration.

      We originally did this to make picking up Realm easier and make code snippets easier to copy/paste. However, in practice, people forget that a default configuration exists which can lead to subtle errors, especially during bootstrap. We have encountered this a number of times working with POC's. Changing this means that setting up Realm will now look like this:

      Realm.init(context);
      Realm.setDefaultConfiguration(new RealmConfiguration.Builder(context).build());
      // or perhaps
      Realm.setDefaultConfiguration(Realm.createDefaultConfiguration());
      

      See https://github.com/realm/realm-java/issues/6385

      5. Bumping only the schema version without a migration defined should be allowed and just treated as a no-op migration.

      This is the behaviour you would expect from the current builder API and we have seen use cases where the DB version number follows the app version.

      If we decide that you always need a migration with a schema version bump we should always require that both properties are defined at the same place, e.g. config.schemaVersion(long version, Realm.MigrationCallback migration)

      See https://github.com/realm/realm-java/issues/6353

      6. Fix naming of Sync Error Codes

      See https://github.com/realm/realm-java/issues/6387

      7. Change default for ImportFlags

      Right now, the default is when using copyToRealmOrUpdate() to override all fields. This behaviour can be changed by using copyToRealmOrUpdate(objects, ImportFlag.CHECK_VALUES_BEFORE_SET). We should change the default so this is the default behaviour and you opt into updating all fields by using something like ImportFlag.SET_ALL_VALUES.

            Assignee:
            Unassigned Unassigned
            Reporter:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: