Skip to content

Commit 085a392

Browse files
authored
Merge pull request #7436 from realm/support-new-datatypes
Support new datatypes: - UUID - RealmAny - RealmMap - RealmSet
2 parents b07bdce + 9eac763 commit 085a392

File tree

310 files changed

+46623
-7619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

310 files changed

+46623
-7619
lines changed

CHANGELOG.md

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,71 @@
1+
## 10.6.0-BETA.2 (2021-06-14)
2+
3+
### Breaking Changes
4+
* ``MapChangeSet.getDeletionsCount()` has been replaced with `MapChangeSet.getDeletions()` that return the keys for entries that has been deleted instead of just the number of deleted entries.
5+
* Primary keys now have automatic indexes again. Indexes was removed in v10.0.0 because they were not needed, but it caused issues when upgrading from a pre v10 version of Realm, and in some cases resulted in large delays when upgrading the fileformat. (Issue [#7426](https://github.com/realm/realm-java/issues/7426), since 10.0.0).
6+
7+
### Enhancements
8+
* Allow `insert` and `insertOrUpdate` operations on `RealmObject` or `RealmObject` collections containing `RealmDictionary` or `RealmSet` fields.
9+
* Added support for `RealmDictionary` in `DynamicRealmObject` with `setDictionary(String fieldName, RealmDictionary<?> dictionary)`, `getDictionary(String fieldName, Class<?> primitiveType)`, and `getDictionary(String fieldName)`.
10+
* Added support for `RealmSet` in `DynamicRealmObject` with `setRealmSet(String fieldName, RealmSet<?> realmSet)`, `getRealmSet(String fieldName, Class<?> primitiveType)`, and `getRealmSet(String fieldName)`.
11+
12+
### Fixed
13+
* Removed wrong `@Nullable` annotation on `RealmQuery.maxRealmAny()`.
14+
* Fixed `RealmAny.getValueClass()` returning the `RealmObject` proxy class instead of the model class on a `RealmAny` referencing a managed `RealmObject`.
15+
16+
### Compatibility
17+
* File format: Generates Realms with format v22. Unsynced Realms will be upgraded from Realm Java 2.0 and later. Synced Realms can only be read and upgraded if created with Realm Java v10.0.0-BETA.1.
18+
* APIs are backwards compatible with all previous release of realm-java in the 10.6.y series.
19+
* Realm Studio 11.0.0-alpha.0 or above is required to open Realms created by this version.
20+
21+
### Internal
22+
* Updated to Realm Core 11.0.2, commit a30382469eb72c0cf1824b44e7062071c2f3f3a9.
23+
* Updated to Gradle 6.8.3.
24+
25+
26+
## 10.6.0-BETA.1 (2021-05-17)
27+
28+
### Breaking Changes
29+
* [RealmApp] Sync protocol version increased to 3. This version adds support for the new data types introduced in file format version 21.
30+
* File format version bumped to 21. In this version we support new basic datatypes `UUID` and `RealmAny`, as well as `RealmSet` and `RealmMap` collections with string-based keys (i.e. `RealmDictionary`).
31+
* Queries no longer do nullability checks on non-nullable fields, so using `null` as an argument will not throw an `IllegalArgumentException`.
32+
* String query filters `contains`, `beginsWith`, `endsWith`, and `like`, now throw a null pointer exception on null values.
33+
* The query builder no longer throw `IllegalStateException` but `IllegalArgumentException`.
34+
* The `distinct` query filter on unsupported fields no longer throws an exception when applied through when querying across relationships.
35+
* The `distinct` query filter no longer throws an exception when applied on non-existent fields.
36+
37+
### Enhancements
38+
* Added support for `java.util.UUID` as supported field in model classes.
39+
* Added support for `java.util.UUID` as a primary key.
40+
* Added support for `RealmAny` as supported field in model classes. A `RealmAny` is used to represent a polymorphic Realm value or Realm Object, is indexable but cannot be used as a primary key. See [Javadoc for RealmAny](https://docs.mongodb.com/realm-sdks/java/latest/io/realm/RealmAny.html).
41+
* Added support for `RealmDictionary` as supported field in model classes. A `RealmDictionary` is a `Map` of strings to values - all types under the `RealmAny` umbrella can be used as values. See [Javadoc for RealmDictionary](https://docs.mongodb.com/realm-sdks/java/latest/io/realm/RealmDictionary.html) and [Javadoc for RealmMap](https://docs.mongodb.com/realm-sdks/java/latest/io/realm/RealmMap.html). `RealmDictionary` is not yet supported by any of the `Realm.insert` and `Realm.createFromJson` methods - This support will be added in a future release.
42+
* Added support for `RealmSet` as supported field in model classes. A `RealmSet` is a collection that implements the Java `Set` interface and contains no duplicate values - all types under the `RealmAny` umbrella can be used as values. See [Javadoc for RealmSet](https://docs.mongodb.com/realm-sdks/java/latest/io/realm/RealmSet.html). `RealmSet` is not yet supported by any of the `Realm.insert` and `Realm.createFromJson` methods - This support will be added in a future release.
43+
* Allow UTF8 encoded characters in property names in string-based queries ([#4467](https://github.com/realm/realm-core/issues/4467))
44+
* The error message when the initial steps of opening a Realm file fails is now more descriptive.
45+
* Make conversion of Decimal128 to/from string work for numbers with more than 19 significant digits. ([#4548](https://github.com/realm/realm-core/issues/4548))
46+
* Remove type coercion on bool and ObjectId when doing queries.
47+
* Allow passing arguments into string-based query predicates.
48+
* Queries across relationships now support the `between` operator.
49+
* Queries on numerical fields (byte, short, int, long, float, double, decimal128) now accept any numerical value as an argument.
50+
* `isEmpty` query filter can now be applied on `RealmList` and `RealmObject` fields.
51+
52+
### Fixed
53+
* Fix assertion failures such as "!m_notifier_skip_version.version" or "m_notifier_sg->get_version() + 1 == new_version.version" when performing writes inside change notification callbacks. Previously refreshing the Realm by beginning a write transaction would skip delivering notifications, leaving things in an inconsistent state. Notifications are now delivered recursively when needed instead. ([Cocoa #7165](https://github.com/realm/realm-cocoa/issues/7165)).
54+
* Fixed name aliasing not working in sort/distinct clauses when doing string-based queries. ([#4550](https://github.com/realm/realm-core/issues/4550), never before working).
55+
* Potential/unconfirmed fix for crashes associated with failure to memory map (low on memory, low on virtual address space). For example ([#4514](https://github.com/realm/realm-core/issues/4514)).
56+
* Syncing large Decimal128 values will cause "Assertion failed: cx.w[1] == 0" ([#4519](https://github.com/realm/realm-core/issues/4519), since v10.0.0)
57+
* Classes names "class_class_..." were not handled correctly when doing queries ([#4480](https://github.com/realm/realm-core/issues/4480))
58+
* Fix collection notification reporting for modifications. This could be observed by receiving the wrong indices of modifications on sorted or distinct results, or notification blocks sometimes not being called when only modifications have occurred. ([#4573](https://github.com/realm/realm-core/pull/4573) since v6).
59+
60+
### Compatibility
61+
* File format: Generates Realms with format v21. Unsynced Realms will be upgraded from Realm Java 2.0 and later. Synced Realms can only be read and upgraded if created with Realm Java v10.0.0-BETA.1.
62+
* APIs are backwards compatible with all previous release of realm-java in the 10.6.y series.
63+
* Realm Studio 11.0.0-alpha.0 or above is required to open Realms created by this version.
64+
65+
### Internal
66+
* Updated to Realm Core 11.0.0-beta.4, commit: d50aef63a8aaf435e3afed82b589b47d8e1ab1ab.
67+
68+
169
## 10.5.0 (2021-05-07)
270

371
### Breaking Changes
@@ -26,7 +94,7 @@
2694

2795
## 10.4.0 (2021-03-26)
2896

29-
All releases from 10.4.0 and forward are now found on `mavenCentral()` instead of `jcenter()`.
97+
All releases from 10.4.0 and forward are now found on `mavenCentral()` instead of `jcenter()`.
3098

3199
A minimal supported setup will therefore now look like this:
32100

@@ -76,7 +144,7 @@ for more information.
76144
* None.
77145

78146
### Fixes
79-
* RxJava Flowables/Observables and Coroutine Flows would crash if they were created from a `RealmList` and the parent object holding the list was deleted. Now, the stream is disposed/closed instead. (Issue [#7242](https://github.com/realm/realm-java/issues/7242))
147+
* RxJava Flowables/Observables and Coroutine Flows would crash if they were created from a `RealmList` and the parent object holding the list was deleted. Now, the stream is disposed/closed instead. (Issue [#7242](https://github.com/realm/realm-java/issues/7242))
80148
* Fixes Realm models default values containing objects with a PK might crash with a `RealmPrimaryKeyConstraintException`. (Issue [#7269] (https://github.com/realm/realm-java/issues/7269))
81149

82150
### Compatibility

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ENV ANDROID_HOME /opt/android-sdk-linux
1414
# Need by cmake
1515
ENV ANDROID_NDK_HOME /opt/android-ndk
1616
ENV ANDROID_NDK /opt/android-ndk
17-
ENV PATH ${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
17+
ENV PATH ${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/cmdline-tools/latest:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools
1818
ENV PATH ${PATH}:${NDK_HOME}
1919
ENV NDK_CCACHE /usr/bin/ccache
2020
ENV CCACHE_CPP2 yes
@@ -52,9 +52,12 @@ RUN DEBIAN_FRONTEND=noninteractive \
5252
&& apt-get clean
5353

5454
# Install the Android SDK
55+
# See https://developer.android.com/studio/index.html#downloads for latest version
5556
RUN cd /opt && \
56-
wget -q https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O android-tools-linux.zip && \
57-
unzip android-tools-linux.zip -d ${ANDROID_HOME} && \
57+
wget -q https://dl.google.com/android/repository/commandlinetools-linux-7302050_latest.zip -O android-tools-linux.zip && \
58+
mkdir --parents ${ANDROID_HOME}/cmdline-tools/latest && \
59+
unzip android-tools-linux.zip -d ${ANDROID_HOME}/cmdline-tools/latest && \
60+
mv ${ANDROID_HOME}/cmdline-tools/latest/cmdline-tools/* ${ANDROID_HOME}/cmdline-tools/latest/ && \
5861
rm -f android-tools-linux.zip
5962

6063
# Grab what's needed in the SDK

Jenkinsfile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import groovy.json.JsonOutput
77
// CONSTANTS
88

99
// Branches from which we release SNAPSHOT's. Only release branches need to run on actual hardware.
10-
releaseBranches = ['master', 'next-major', 'v10', 'releases']
10+
releaseBranches = ['master', 'next-major', 'support-new-datatypes', 'releases']
1111
// Branches that are "important", so if they do not compile they will generate a Slack notification
12-
slackNotificationBranches = [ 'master', 'releases', 'next-major', 'v10' ]
12+
slackNotificationBranches = [ 'master', 'releases', 'next-major', 'support-new-datatypes' ]
1313
// WARNING: Only set to `false` as an absolute last resort. Doing this will disable all integration
1414
// tests.
1515
enableIntegrationTests = true
@@ -236,7 +236,20 @@ def runBuild(buildFlags, instrumentationTestTarget) {
236236
if (isReleaseBranch) {
237237
signingFlags = "-PsignBuild=true -PsignSecretRingFile=\"${SIGN_KEY}\" -PsignPassword=${SIGN_KEY_PASSWORD}"
238238
}
239-
sh "./gradlew assemble ${buildFlags} ${signingFlags} --stacktrace"
239+
// Work around https://github.com/realm/realm-java/issues/7476 by building each artifact independantly instead
240+
// of using Gradle to call down into sub projects (which seems to trigger a bug somewhere).
241+
sh """
242+
cd realm-annotations
243+
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
244+
cd ../realm-transformer
245+
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
246+
cd ../library-build-transformer
247+
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
248+
cd ../gradle-plugin
249+
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
250+
cd ../realm
251+
./gradlew publishToMavenLocal ${buildFlags} ${signingFlags} --stacktrace
252+
"""
240253
}
241254
}
242255

@@ -308,7 +321,7 @@ def runBuild(buildFlags, instrumentationTestTarget) {
308321
},
309322
'Gradle Plugin' : {
310323
try {
311-
gradle('gradle-plugin', 'check --debug')
324+
gradle('gradle-plugin', 'check')
312325
} finally {
313326
storeJunitResults 'gradle-plugin/build/test-results/test/TEST-*.xml'
314327
}

dependencies.list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ REALM_CORE=10.3.3
44

55
# Version of MongoDB Realm used by integration tests
66
# See https://github.com/realm/ci/packages/147854 for available versions
7-
MONGODB_REALM_SERVER=2021-03-09
7+
MONGODB_REALM_SERVER=2021-04-22
88

99
# Common Android settings across projects
1010
GRADLE_BUILD_TOOLS=4.0.0
@@ -13,7 +13,7 @@ KOTLIN=1.3.72
1313
KOTLIN_COROUTINES=1.3.9
1414

1515
# Common classpath dependencies
16-
gradle=6.5
16+
gradle=6.8.3
1717
ndkVersion=22.0.7026061
1818
BUILD_INFO_EXTRACTOR_GRADLE=4.17.0
1919
GRADLE_BINTRAY_PLUGIN=1.8.5
3.22 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

examples/gradlew

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
154156
else
155157
eval `echo args$i`="\"$arg\""
156158
fi
157-
i=$((i+1))
159+
i=`expr $i + 1`
158160
done
159161
case $i in
160-
(0) set -- ;;
161-
(1) set -- "$args0" ;;
162-
(2) set -- "$args0" "$args1" ;;
163-
(3) set -- "$args0" "$args1" "$args2" ;;
164-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
162+
0) set -- ;;
163+
1) set -- "$args0" ;;
164+
2) set -- "$args0" "$args1" ;;
165+
3) set -- "$args0" "$args1" "$args2" ;;
166+
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167+
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168+
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169+
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170+
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171+
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170172
esac
171173
fi
172174

@@ -175,14 +177,9 @@ save () {
175177
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176178
echo " "
177179
}
178-
APP_ARGS=$(save "$@")
180+
APP_ARGS=`save "$@"`
179181

180182
# Collect all arguments for the java command, following the shell quoting and substitution rules
181183
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182184

183-
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184-
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185-
cd "$(dirname "$0")"
186-
fi
187-
188185
exec "$JAVACMD" "$@"

examples/gradlew.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
3235
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3336
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3437

@@ -81,6 +84,7 @@ set CMD_LINE_ARGS=%*
8184

8285
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8386

87+
8488
@rem Execute Gradle
8589
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
8690

2.67 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)