Skip to content

Commit f3f4a26

Browse files
committed
Merge branch 'master-4.0' into feature/primitive_list
2 parents bc8ebe9 + 5391d11 commit f3f4a26

73 files changed

Lines changed: 2041 additions & 2095 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: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 4.0.0-BETA3 (YYYY-MM-DD)
2+
3+
### Internal
4+
5+
* Upgraded to Realm Sync 2.0.0-rc16.
6+
* Upgraded to Realm Core 3.0.0-rc5.
7+
18
## 4.0.0-BETA2 (2017-07-27)
29

310
### Bug Fixes
@@ -44,14 +51,20 @@ and `SyncUser#retrieveInfoForUserAsync` which returns a `SyncUserInfo` with mode
4451
* [ObjectServer] APIs of `UserStore` have been changed to support same user identity but different authentication server scenario.
4552
* [ObjectServer] Added `SyncUser.allSessions` to retrieve the all valid sessions belonging to the user (#4783).
4653
* 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`.
54+
* `org.jetbrains.annotations.NotNull` is now an alias for `@Required`. This means that the Realm Schema now fully understand Kotlin non-null types.
4755
* 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).
56+
* Added more detailed exception message for `RealmMigrationNeeded`.
57+
* Bumping schema version only without any actual schema changes will just succeed even when the migration block is not supplied. It threw an `RealmMigrationNeededException` before in the same case.
58+
* Throw `IllegalStateException` when schema validation fails because of wrong declaration of `@LinkingObjects`.
4859

4960
### Bug Fixes
5061

5162
### Internal
63+
5264
* [ObjectServer] removed `ObjectServerUser` and its inner classes, in a step to reduce `SyncUser` complexity (#3741).
5365
* [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).
54-
66+
* Upgraded Realm Sync to 1.10.8
67+
* Let Object Store handle migration.
5568

5669
## 3.5.1 (YYYY-MM-DD)
5770

dependencies.list

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Realm Sync Core release used by Realm Java
22
# https://github.com/realm/realm-sync/releases
3-
REALM_SYNC_VERSION=2.0.0-rc12
4-
REALM_SYNC_SHA256=5f111903159ee2d74c5418560c72977e91a10e291e23e6a7d9999aa856858ca4
3+
REALM_SYNC_VERSION=2.0.0-rc16
4+
REALM_SYNC_SHA256=c20c4e7333f01a3a4ea350cb20b9b7feba95ad4e52d612368b6187b72d518aa1
55

66
# Object Server Release used by Integration tests
77
# Stable releases: https://packagecloud.io/realm/realm?filter=debs

realm/realm-annotations-processor/src/main/java/io/realm/processor/ClassMetaData.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.Set;
2626

2727
import javax.annotation.processing.ProcessingEnvironment;
28+
import javax.lang.model.element.AnnotationMirror;
2829
import javax.lang.model.element.Element;
2930
import javax.lang.model.element.ElementKind;
3031
import javax.lang.model.element.ExecutableElement;
@@ -375,7 +376,7 @@ private boolean categorizeField(Element element) {
375376
if (!categorizeIndexField(element, field)) { return false; }
376377
}
377378

378-
if (field.getAnnotation(Required.class) != null) {
379+
if (isRequiredField(field)) {
379380
categorizeRequiredField(element, field);
380381
} else {
381382
// The field doesn't have the @Required annotation.
@@ -408,6 +409,23 @@ private boolean categorizeField(Element element) {
408409
return true;
409410
}
410411

412+
private boolean isRequiredField(VariableElement field) {
413+
if (field.getAnnotation(Required.class) != null) {
414+
return true;
415+
}
416+
417+
// Kotlin uses the `org.jetbrains.annotations.NotNull` annotation to mark non-null fields.
418+
// In order to fully support the Kotlin type system we interpret `@NotNull` as an alias
419+
// for `@Required`
420+
for (AnnotationMirror annotation : field.getAnnotationMirrors()) {
421+
if (annotation.getAnnotationType().toString().equals("org.jetbrains.annotations.NotNull")) {
422+
return true;
423+
}
424+
}
425+
426+
return false;
427+
}
428+
411429
// The field has the @Index annotation. It's only valid for column types:
412430
// STRING, DATE, INTEGER, BOOLEAN, and RealmMutableInteger
413431
private boolean categorizeIndexField(Element element, VariableElement variableElement) {
@@ -441,13 +459,13 @@ private boolean categorizeIndexField(Element element, VariableElement variableEl
441459
private void categorizeRequiredField(Element element, VariableElement variableElement) {
442460
if (Utils.isPrimitiveType(variableElement)) {
443461
Utils.error(String.format(Locale.US,
444-
"@Required annotation is unnecessary for primitive field \"%s\".", element));
462+
"@Required or @NotNull annotation is unnecessary for primitive field \"%s\".", element));
445463
return;
446464
}
447465

448-
if (Utils.isRealmList(variableElement) || Utils.isRealmModel(variableElement)) {
466+
if (Utils.isRealmModel(variableElement)) {
449467
Utils.error(String.format(Locale.US,
450-
"Field \"%s\" with type \"%s\" cannot be @Required.", element, element.asType()));
468+
"Field \"%s\" with type \"%s\" cannot be @Required or @NotNull.", element, element.asType()));
451469
return;
452470
}
453471

0 commit comments

Comments
 (0)