Skip to content

Commit bc8ebe9

Browse files
committed
Merge branch 'master-4.0' into feature/primitive_list
2 parents 63834a1 + 6a8e500 commit bc8ebe9

130 files changed

Lines changed: 1981 additions & 1045 deletions

File tree

Some content is hidden

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

CHANGELOG.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,29 @@
2828

2929
## 3.6.0 (YYYY-MM-DD)
3030

31+
### Breaking Changes
32+
33+
* [ObjectServer] `SyncUser.logout()` no longer throws an exception when associated Realms instances are not closed (#4962).
34+
35+
### Deprecated
36+
37+
* [ObjectServer] `SyncUser#retrieveUser` and `SyncUser#retrieveUserAsync` replaced by `SyncUser#retrieveInfoForUser`
38+
and `SyncUser#retrieveInfoForUserAsync` which returns a `SyncUserInfo` with mode information (#5008).
39+
* [ObjectServer] `SyncUser#Callback` replaced by the generic version `SyncUser#RequestCallback<T>`.
40+
3141
### Enhancements
3242

3343
* [ObjectServer] Added `SyncSession.uploadAllLocalChanges()`.
3444
* [ObjectServer] APIs of `UserStore` have been changed to support same user identity but different authentication server scenario.
35-
* [ObjectServer] Added `SyncUser.allSessions` to retrive the all valid sessions belonging to the user (#4783).
45+
* [ObjectServer] Added `SyncUser.allSessions` to retrieve the all valid sessions belonging to the user (#4783).
3646
* Added `Nullable` annotation to methods that may return `null` in order to improve Kotlin usability. This also introduced a dependency to `com.google.code.findbugs:jsr305`.
3747
* Added support for new data type `MutableRealmIntegers`. The new type behaves almost exactly as a reference to a Long (mutable nullable, etc) but supports `increment` and `decrement` methods, which implement a Conflict Free Replicated Data Type, whose value will converge even when changed across distributed devices with poor connections (#4266).
3848

3949
### Bug Fixes
4050

4151
### Internal
52+
* [ObjectServer] removed `ObjectServerUser` and its inner classes, in a step to reduce `SyncUser` complexity (#3741).
53+
* [ObjectServer] changed the `SyncSessionStopPolicy` to `AfterChangesUploaded` to align with other binding and to prevent use cases where the Realm might be deleted before the last changes get synchronized (#5028).
4254

4355

4456
## 3.5.1 (YYYY-MM-DD)
@@ -48,7 +60,8 @@
4860
* Potential crash after using `Realm.getSchema()` to change the schema of a typed Realm. `Realm.getSchema()` now returns an immutable `RealmSchema` instance.
4961
* `Realm.copyToRealmOrUpdate()` might cause a `RealmList` field to contain duplicated elements (#4957).
5062
* `RealmSchema.create(String)` and `RealmObjectSchema.setClassName(String)` did not accept class name whose length was 51 to 57.
51-
* Workaround for a Android JVM crash when using 'compactOnLaunch()' (#4964).
63+
* Workaround for an Android JVM crash when using `compactOnLaunch()` (#4964).
64+
* Class name in exception message from link query is wrong (#5096).
5265

5366
### Internal
5467

@@ -765,7 +778,7 @@ No changes since 0.91.1.
765778

766779
### Breaking changes
767780

768-
* @PrimaryKey field value can now be null for String, Byte, Short, Integer, and Long types. Older Realms should be migrated, using RealmObjectSchema.setNullable(), or by adding the @Required annotation. (#2515).
781+
* @PrimaryKey field value can now be null for String, Byte, Short, Integer, and Long types. Older Realms should be migrated, using RealmObjectSchema.setNullable(), or by adding the @Required annotation (#2515).
769782
* `RealmResults.clear()` now throws UnsupportedOperationException. Use `RealmResults.deleteAllFromRealm()` instead.
770783
* `RealmResults.remove(int)` now throws UnsupportedOperationException. Use `RealmResults.deleteFromRealm(int)` instead.
771784
* `RealmResults.sort()` and `RealmList.sort()` now return the sorted result instead of sorting in-place.
@@ -807,7 +820,7 @@ No changes since 0.91.1.
807820
### Bug fixes
808821

809822
* Field annotated with @Ignored should not have accessors generated by the bytecode transformer (#2478).
810-
* RealmResults and RealmObjects can no longer accidentially be GC'ed if using `asObservable()`. Previously this caused the observable to stop emitting. (#2485).
823+
* RealmResults and RealmObjects can no longer accidentially be GC'ed if using `asObservable()`. Previously this caused the observable to stop emitting (#2485).
811824
* Fixed an build issue when using Realm in library projects on Windows (#2484).
812825
* Custom equals(), toString() and hashCode() are no longer incorrectly overwritten by the proxy class (#2545).
813826

@@ -916,7 +929,7 @@ No changes since 0.91.1.
916929
* Updated Realm Core to 0.95.6
917930
- Fixed a bug where an async query can be copied incomplete in rare cases (#1717).
918931
* Fixed potential memory leak when using async query.
919-
* Added a check to prevent removing a RealmChangeListener from a non-Looper thread (#1962). (Thank you @hohnamkung)
932+
* Added a check to prevent removing a RealmChangeListener from a non-Looper thread (#1962). (Thank you @hohnamkung.)
920933

921934
## 0.87.0 (2015-12-17)
922935
* Added Realm.asObservable(), RealmResults.asObservable(), RealmObject.asObservable(), DynamicRealm.asObservable() and DynamicRealmObject.asObservable().
@@ -966,7 +979,7 @@ No changes since 0.91.1.
966979
* Added Realm.isEmpty().
967980
* Setters in managed object for RealmObject and RealmList now throw IllegalArgumentException if the value contains an invalid (unmanaged, removed, closed, from different Realm) object (#1749).
968981
* Attempting to refresh a Realm while a transaction is in process will now throw an IllegalStateException (#1712).
969-
* The Realm AAR now also contains the ProGuard configuration (#1767). (Thank you @skyisle)
982+
* The Realm AAR now also contains the ProGuard configuration (#1767). (Thank you @skyisle.)
970983
* Updated Realm Core to 0.95.
971984
- Removed reliance on POSIX signals when using encryption.
972985

@@ -988,7 +1001,7 @@ No changes since 0.91.1.
9881001

9891002
## 0.84.0 (2015-10-22)
9901003
* Added support for async queries and transactions.
991-
* Added support for parsing JSON Dates with timezone information. (Thank you @LateralKevin)
1004+
* Added support for parsing JSON Dates with timezone information. (Thank you @LateralKevin.)
9921005
* Added RealmQuery.isEmpty().
9931006
* Added Realm.isClosed() method.
9941007
* Added Realm.distinct() method.
@@ -1060,7 +1073,7 @@ No changes since 0.91.1.
10601073
* Deprecated Realm.deleteFile(). It has been replaced by Realm.deleteRealm(RealmConfiguration).
10611074
* Deprecated Realm.compactFile(). It has been replaced by Realm.compactRealm(RealmConfiguration).
10621075
* RealmList.add(), RealmList.addAt() and RealmList.set() now copy unmanaged objects transparently into Realm.
1063-
* Realm now works with Kotlin (M12+). (Thank you @cypressious)
1076+
* Realm now works with Kotlin (M12+). (Thank you @cypressious.)
10641077
* Fixed a performance regression introduced in 0.80.3 occurring during the validation of the Realm schema.
10651078
* Added a check to give a better error message when null is used as value for a primary key.
10661079
* Fixed unchecked cast warnings when building with Realm.
@@ -1074,7 +1087,7 @@ No changes since 0.91.1.
10741087
* RealmChangedListener now also gets called on the same thread that did the commit.
10751088
* Fixed bug where Realm.createOrUpdateWithJson() reset Date and Binary data to default values if not found in the JSON output.
10761089
* Fixed a memory leak when using RealmBaseAdapter.
1077-
* RealmBaseAdapter now allow RealmResults to be null. (Thanks @zaki50)
1090+
* RealmBaseAdapter now allow RealmResults to be null. (Thanks @zaki50.)
10781091
* Fixed a bug where a change to a model class (`RealmList<A>` to `RealmList<B>`) would not throw a RealmMigrationNeededException.
10791092
* Fixed a bug where setting multiple RealmLists didn't remove the previously added objects.
10801093
* Solved ConcurrentModificationException thrown when addChangeListener/removeChangeListener got called in the onChange. (Thanks @beeender)

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ While we havn't described our code style yet, please just follow the existing st
3333

3434
For source code written in C++, we format it using `clang-format`. You can use the [plugin](https://plugins.jetbrains.com/plugin/8396-clangformatij): mark the entire file and right-click to execute `clang-format` before committing any changes. Of course, if you don't use Android Studio to edit C++ code, run `clang-format` on the command-line.
3535

36+
### Nullability by Annotataion
37+
38+
To improve code quality and usability in Kotlin, nullability of parameters and return types must be annotated with JSR305 annotations.
39+
40+
If a parameter is nullable, you must add `@Nullable` annotation to the parameter. On the other hand, if a parameter is non-null, you don't need to add `@Nonnull` annotation since all parameters are treated as `@Nonnull` by default.
41+
42+
For return types, there is no default nullability. If a method can return `null` as a return value, you must add `@Nullable` annotation to the return type. Currently, `Nonnull` annotation is not mandatory if the method never return `null`.
43+
44+
When you add a new package, you must add `package-info.java` and add `@javax.annotation.ParametersAreNonnullByDefault` to the package. Please note that you can't add multiple `package-info.java` in the same package but different location (for example, main and androidTest). When you add a package to both main and androidTest, you only need to add `package-info.java` to main.
45+
3646
### Unit Tests
3747

3848
All PR's must be accompanied by related unit tests. All bug fixes must have a unit test proving that the bug is fixed.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ RUN sdkmanager --update
5252
RUN sdkmanager 'platform-tools'
5353
RUN sdkmanager 'build-tools;26.0.1'
5454
RUN sdkmanager 'extras;android;m2repository'
55-
RUN sdkmanager 'platforms;android-25'
55+
RUN sdkmanager 'platforms;android-26'
5656

5757
# Install the NDK
5858
RUN mkdir /opt/android-ndk-tmp && \

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The API reference is located at [realm.io/docs/java/api](https://realm.io/docs/j
2424
- **Need help with your code?**: Look for previous questions on the [#realm tag](https://stackoverflow.com/questions/tagged/realm?sort=newest) — or [ask a new question](http://stackoverflow.com/questions/ask?tags=realm). We activtely monitor & answer questions on SO!
2525
- **Have a bug to report?** [Open an issue](https://github.com/realm/realm-java/issues/new). If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue.
2626
- **Have a feature request?** [Open an issue](https://github.com/realm/realm-java/issues/new). Tell us what the feature should do, and why you want the feature.
27-
- Sign up for our [**Community Newsletter**](http://eepurl.com/VEKCn) to get regular tips, learn about other use-cases and get alerted of blogposts and tutorials about Realm.
27+
- Sign up for our [**Community Newsletter**](https://go.pardot.com/l/210132/2017-04-26/3j74l) to get regular tips, learn about other use-cases and get alerted of blogposts and tutorials about Realm.
2828

2929
## Using Snapshots
3030

@@ -60,7 +60,7 @@ In case you don't want to use the precompiled version, you can build Realm yours
6060
### Prerequisites
6161

6262
* Download the [**JDK 7**](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) or [**JDK 8**](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) from Oracle and install it.
63-
* Download & install the Android SDK **Build-Tools 26.0.1**, **Android N (API 25)** (for example through Android Studio’s **Android SDK Manager**).
63+
* Download & install the Android SDK **Build-Tools 26.0.1**, **Android O (API 26)** (for example through Android Studio’s **Android SDK Manager**).
6464
* Install CMake from SDK manager in Android Studio ("SDK Tools" -> "CMake").
6565
* If you use Android Studio, Android Studio 3.0 or later is required.
6666

@@ -256,15 +256,17 @@ style/lint in the drop-down to the left of the Manage... button.
256256
## License
257257
258258
Realm Java is published under the Apache 2.0 license.
259-
The underlying core is available under the [Realm Core Binary License](LICENSE#L210-L243) while we [work to open-source it under the Apache 2.0 license](https://realm.io/docs/java/#faq).
259+
260+
Realm Core is also published under the Apache 2.0 license and is available
261+
[here](https://github.com/realm/realm-core).
260262
261263
**This product is not being made available to any person located in Cuba, Iran,
262264
North Korea, Sudan, Syria or the Crimea region, or to any other person that is
263265
not eligible to receive the product under U.S. law.**
264266
265267
## Feedback
266268
267-
**_If you use Realm and are happy with it, all we ask is that you please consider sending out a tweet mentioning [@realm](http://twitter.com/realm), or email [help@realm.io](mailto:help@realm.io) to let us know about it!_**
269+
**_If you use Realm and are happy with it, all we ask is that you please consider sending out a tweet mentioning [@realm](http://twitter.com/realm) to share your thoughts!_**
268270
269271
**_And if you don't like it, please let us know what you would like improved, so we can fix it!_**
270272

examples/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
project.ext.sdkVersion = 25
1+
project.ext.sdkVersion = 26
22
project.ext.buildTools = '26.0.1'
33

44
// Don't cache SNAPSHOT (changing) dependencies.
@@ -24,8 +24,8 @@ allprojects {
2424
}
2525
dependencies {
2626
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
27-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
28-
classpath 'com.novoda:gradle-android-command-plugin:1.5.0'
27+
classpath 'com.novoda:gradle-android-command-plugin:1.7.1'
28+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
2929
classpath "io.realm:realm-gradle-plugin:${currentVersion}"
3030
}
3131
}

examples/encryptionExample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ android {
2323
}
2424

2525
command {
26-
events 2000
26+
monkey.events 2000
2727
}
2828
}

examples/gridViewExample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ android {
2222
}
2323

2424
command {
25-
events 2000
25+
monkey.events 2000
2626
}
2727

2828
splits {

examples/introExample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ android {
2424
}
2525

2626
command {
27-
events 2000
27+
monkey.events 2000
2828
}
2929
}

examples/jsonExample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ android {
2323
}
2424

2525
command {
26-
events 2000
26+
monkey.events 2000
2727
}
2828
}
2929

examples/kotlinExample/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.1.3-2'
2+
ext.kotlin_version = '1.1.4-2'
33
repositories {
44
jcenter()
55
mavenCentral()
@@ -11,6 +11,7 @@ buildscript {
1111

1212
apply plugin: 'com.android.application'
1313
apply plugin: 'kotlin-android'
14+
apply plugin: 'kotlin-kapt'
1415
apply plugin: 'android-command'
1516
apply plugin: 'realm-android'
1617

@@ -36,7 +37,7 @@ android {
3637
}
3738

3839
command {
39-
events 2000
40+
monkey.events 2000
4041
}
4142

4243
sourceSets {

0 commit comments

Comments
 (0)