Skip to content

Commit c8a8821

Browse files
committed
Merge branch 'master-4.0' into feature/primitive_list
2 parents f3f4a26 + 0506351 commit c8a8821

84 files changed

Lines changed: 4899 additions & 988 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: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 4.0.0-BETA3 (YYYY-MM-DD)
1+
4.0.0-BETA3 (YYYY-MM-DD)
22

33
### Internal
44

@@ -30,10 +30,34 @@
3030
* Upgraded to Realm Sync 2.0.0-rc12.
3131
* Upgraded to Realm Core 3.0.0-rc3.
3232

33-
### Credits
33+
34+
## 3.7.1 (YYYY-MM-DD)
35+
36+
### Bug Fixes
37+
38+
* Fixed potential memory leaks of `LinkView` when calling bulk insertions APIs.
39+
40+
### Internal
41+
42+
* Replaced LinkView with Object Store's List.
43+
44+
45+
## 3.7.0 (2017-09-01)
46+
47+
### Deprecated
48+
49+
* [ObjectServer] `SyncUser.getManagementRealm()`. Use `SyncUser.getPermissionManager()` instead.
50+
51+
### Enhancements
52+
53+
* [ObjectServer] `SyncUser.getPermissionManager` added as a helper API for working with permissions and permission offers.
54+
55+
### Internal
56+
57+
* [ObjectServer] Upgraded OkHttp to 3.7.0.
3458

3559

36-
## 3.6.0 (YYYY-MM-DD)
60+
## 3.6.0 (2017-09-01)
3761

3862
### Breaking Changes
3963

@@ -59,25 +83,20 @@ and `SyncUser#retrieveInfoForUserAsync` which returns a `SyncUserInfo` with mode
5983

6084
### Bug Fixes
6185

62-
### Internal
63-
64-
* [ObjectServer] removed `ObjectServerUser` and its inner classes, in a step to reduce `SyncUser` complexity (#3741).
65-
* [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).
66-
* Upgraded Realm Sync to 1.10.8
67-
* Let Object Store handle migration.
68-
69-
## 3.5.1 (YYYY-MM-DD)
70-
71-
### Bug Fixes
72-
7386
* Potential crash after using `Realm.getSchema()` to change the schema of a typed Realm. `Realm.getSchema()` now returns an immutable `RealmSchema` instance.
74-
* `Realm.copyToRealmOrUpdate()` might cause a `RealmList` field to contain duplicated elements (#4957).
87+
* `Realm.copyToRealmOrUpdate()` could cause a `RealmList` field to contain duplicated elements (#4957).
7588
* `RealmSchema.create(String)` and `RealmObjectSchema.setClassName(String)` did not accept class name whose length was 51 to 57.
7689
* Workaround for an Android JVM crash when using `compactOnLaunch()` (#4964).
7790
* Class name in exception message from link query is wrong (#5096).
91+
* The `compactOnLaunch` callback is no longer invoked if the Realm at that path is already open on other threads.
7892

7993
### Internal
8094

95+
* [ObjectServer] removed `ObjectServerUser` and its inner classes, in a step to reduce `SyncUser` complexity (#3741).
96+
* [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).
97+
* Upgraded Realm Sync to 1.10.8
98+
* Let Object Store handle migration.
99+
81100

82101
## 3.5.0 (2017-07-11)
83102

@@ -194,6 +213,7 @@ and `SyncUser#retrieveInfoForUserAsync` which returns a `SyncUserInfo` with mode
194213
### Enhancements
195214

196215
* [ObjectServer] Added support for `SyncUser.isAdmin()` (#4353).
216+
* [ObjectServer] New set of Permission API's have been added to `SyncUser` through `SyncUser.getPermissionManager()` (#4296).
197217
* [ObjectServer] Added support for changing passwords through `SyncUser.changePassword()` (#4423).
198218
* [ObjectServer] Added support for `SyncConfiguration.Builder.waitForInitialRemoteData()` (#4270).
199219
* Transient fields are now allowed in model classes, but are implicitly treated as having the `@Ignore` annotation (#4279).

examples/kotlinExample/build.gradle

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

realm/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.1.4-2'
2+
ext.kotlin_version = '1.1.4-3'
33
repositories {
44
mavenLocal()
55
google()

realm/config/findbugs/findbugs-filter.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@
2121
<Match>
2222
<Class name="io.realm.PermissionOfferResponseRealmProxy"/>
2323
</Match>
24+
<Match>
25+
<Class name="io.realm.PermissionRealmProxy"/>
26+
</Match>
2427

2528
</FindBugsFilter>

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class RealmProxyClassGenerator {
4949
"android.util.JsonToken",
5050
"io.realm.exceptions.RealmMigrationNeededException",
5151
"io.realm.internal.ColumnInfo",
52-
"io.realm.internal.LinkView",
52+
"io.realm.internal.OsList",
5353
"io.realm.internal.OsObject",
5454
"io.realm.internal.OsSchemaInfo",
5555
"io.realm.internal.OsObjectSchemaInfo",
@@ -519,8 +519,8 @@ private void emitRealmList(
519519
.beginControlFlow("if (" + fieldName + "RealmList != null)")
520520
.emitStatement("return " + fieldName + "RealmList")
521521
.nextControlFlow("else")
522-
.emitStatement("LinkView linkView = proxyState.getRow$realm().getLinkList(%s)", fieldIndexVariableReference(field))
523-
.emitStatement(fieldName + "RealmList = new RealmList<%s>(%s.class, linkView, proxyState.getRealm$realm())",
522+
.emitStatement("OsList osList = proxyState.getRow$realm().getLinkList(%s)", fieldIndexVariableReference(field))
523+
.emitStatement(fieldName + "RealmList = new RealmList<%s>(%s.class, osList, proxyState.getRealm$realm())",
524524
genericType, genericType)
525525
.emitStatement("return " + fieldName + "RealmList")
526526
.endControlFlow()
@@ -556,8 +556,8 @@ public void emit(JavaWriter writer) throws IOException {
556556
}
557557
});
558558
writer.emitStatement("proxyState.getRealm$realm().checkIfValid()")
559-
.emitStatement("LinkView links = proxyState.getRow$realm().getLinkList(%s)", fieldIndexVariableReference(field))
560-
.emitStatement("links.clear()")
559+
.emitStatement("OsList osList = proxyState.getRow$realm().getLinkList(%s)", fieldIndexVariableReference(field))
560+
.emitStatement("osList.removeAll()")
561561
.beginControlFlow("if (value == null)")
562562
.emitStatement("return")
563563
.endControlFlow()
@@ -568,7 +568,7 @@ public void emit(JavaWriter writer) throws IOException {
568568
.beginControlFlow("if (((RealmObjectProxy) linkedObject).realmGet$proxyState().getRealm$realm() != proxyState.getRealm$realm())")
569569
.emitStatement("throw new IllegalArgumentException(\"Each element of 'value' must belong to the same Realm.\")")
570570
.endControlFlow()
571-
.emitStatement("links.add(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex())")
571+
.emitStatement("osList.addRow(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex())")
572572
.endControlFlow()
573573
.endMethod();
574574
}
@@ -1010,13 +1010,13 @@ private void emitInsertMethod(JavaWriter writer) throws IOException {
10101010
.emitStatement("RealmList<%s> %sList = ((%s) object).%s()",
10111011
genericType, fieldName, interfaceName, getter)
10121012
.beginControlFlow("if (%sList != null)", fieldName)
1013-
.emitStatement("long %1$sNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.%1$sIndex, rowIndex)", fieldName)
1013+
.emitStatement("OsList %1$sOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.%1$sIndex)", fieldName)
10141014
.beginControlFlow("for (%1$s %2$sItem : %2$sList)", genericType, fieldName)
10151015
.emitStatement("Long cacheItemIndex%1$s = cache.get(%1$sItem)", fieldName)
10161016
.beginControlFlow("if (cacheItemIndex%s == null)", fieldName)
10171017
.emitStatement("cacheItemIndex%1$s = %2$s.insert(realm, %1$sItem, cache)", fieldName, Utils.getProxyClassSimpleName(field))
10181018
.endControlFlow()
1019-
.emitStatement("LinkView.nativeAdd(%1$sNativeLinkViewPtr, cacheItemIndex%1$s)", fieldName)
1019+
.emitStatement("%1$sOsList.addRow(cacheItemIndex%1$s)", fieldName)
10201020
.endControlFlow()
10211021
.endControlFlow();
10221022

@@ -1090,13 +1090,13 @@ private void emitInsertListMethod(JavaWriter writer) throws IOException {
10901090
.emitStatement("RealmList<%s> %sList = ((%s) object).%s()",
10911091
genericType, fieldName, interfaceName, getter)
10921092
.beginControlFlow("if (%sList != null)", fieldName)
1093-
.emitStatement("long %1$sNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.%1$sIndex, rowIndex)", fieldName)
1093+
.emitStatement("OsList %1$sOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.%1$sIndex)", fieldName)
10941094
.beginControlFlow("for (%1$s %2$sItem : %2$sList)", genericType, fieldName)
10951095
.emitStatement("Long cacheItemIndex%1$s = cache.get(%1$sItem)", fieldName)
10961096
.beginControlFlow("if (cacheItemIndex%s == null)", fieldName)
10971097
.emitStatement("cacheItemIndex%1$s = %2$s.insert(realm, %1$sItem, cache)", fieldName, Utils.getProxyClassSimpleName(field))
10981098
.endControlFlow()
1099-
.emitStatement("LinkView.nativeAdd(%1$sNativeLinkViewPtr, cacheItemIndex%1$s)", fieldName)
1099+
.emitStatement("%1$sOsList.addRow(cacheItemIndex%1$s)", fieldName)
11001100
.endControlFlow()
11011101
.endControlFlow();
11021102

@@ -1163,8 +1163,8 @@ private void emitInsertOrUpdateMethod(JavaWriter writer) throws IOException {
11631163
final String genericType = Utils.getGenericTypeQualifiedName(field);
11641164
writer
11651165
.emitEmptyLine()
1166-
.emitStatement("long %1$sNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.%1$sIndex, rowIndex)", fieldName)
1167-
.emitStatement("LinkView.nativeClear(%sNativeLinkViewPtr)", fieldName)
1166+
.emitStatement("OsList %1$sOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.%1$sIndex)", fieldName)
1167+
.emitStatement("%1$sOsList.removeAll()", fieldName)
11681168
.emitStatement("RealmList<%s> %sList = ((%s) object).%s()",
11691169
genericType, fieldName, interfaceName, getter)
11701170
.beginControlFlow("if (%sList != null)", fieldName)
@@ -1173,7 +1173,7 @@ private void emitInsertOrUpdateMethod(JavaWriter writer) throws IOException {
11731173
.beginControlFlow("if (cacheItemIndex%s == null)", fieldName)
11741174
.emitStatement("cacheItemIndex%1$s = %2$s.insertOrUpdate(realm, %1$sItem, cache)", fieldName, Utils.getProxyClassSimpleName(field))
11751175
.endControlFlow()
1176-
.emitStatement("LinkView.nativeAdd(%1$sNativeLinkViewPtr, cacheItemIndex%1$s)", fieldName)
1176+
.emitStatement("%1$sOsList.addRow(cacheItemIndex%1$s)", fieldName)
11771177
.endControlFlow()
11781178
.endControlFlow()
11791179
.emitEmptyLine();
@@ -1247,8 +1247,8 @@ private void emitInsertOrUpdateListMethod(JavaWriter writer) throws IOException
12471247
final String genericType = Utils.getGenericTypeQualifiedName(field);
12481248
writer
12491249
.emitEmptyLine()
1250-
.emitStatement("long %1$sNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.%1$sIndex, rowIndex)", fieldName)
1251-
.emitStatement("LinkView.nativeClear(%sNativeLinkViewPtr)", fieldName)
1250+
.emitStatement("OsList %1$sOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.%1$sIndex)", fieldName)
1251+
.emitStatement("%1$sOsList.removeAll()", fieldName)
12521252
.emitStatement("RealmList<%s> %sList = ((%s) object).%s()",
12531253
genericType, fieldName, interfaceName, getter)
12541254
.beginControlFlow("if (%sList != null)", fieldName)
@@ -1257,7 +1257,7 @@ private void emitInsertOrUpdateListMethod(JavaWriter writer) throws IOException
12571257
.beginControlFlow("if (cacheItemIndex%s == null)", fieldName)
12581258
.emitStatement("cacheItemIndex%1$s = %2$s.insertOrUpdate(realm, %1$sItem, cache)", fieldName, Utils.getProxyClassSimpleName(field))
12591259
.endControlFlow()
1260-
.emitStatement("LinkView.nativeAdd(%1$sNativeLinkViewPtr, cacheItemIndex%1$s)", fieldName)
1260+
.emitStatement("%1$sOsList.addRow(cacheItemIndex%1$s)", fieldName)
12611261
.endControlFlow()
12621262
.endControlFlow()
12631263
.emitEmptyLine();

realm/realm-annotations-processor/src/test/resources/io/realm/AllTypesRealmProxy.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import android.util.JsonToken;
88
import io.realm.exceptions.RealmMigrationNeededException;
99
import io.realm.internal.ColumnInfo;
10-
import io.realm.internal.LinkView;
10+
import io.realm.internal.OsList;
1111
import io.realm.internal.OsObject;
1212
import io.realm.internal.OsObjectSchemaInfo;
1313
import io.realm.internal.OsSchemaInfo;
@@ -361,8 +361,8 @@ protected final void copy(ColumnInfo rawSrc, ColumnInfo rawDst) {
361361
if (columnRealmListRealmList != null) {
362362
return columnRealmListRealmList;
363363
} else {
364-
LinkView linkView = proxyState.getRow$realm().getLinkList(columnInfo.columnRealmListIndex);
365-
columnRealmListRealmList = new RealmList<some.test.AllTypes>(some.test.AllTypes.class, linkView, proxyState.getRealm$realm());
364+
OsList osList = proxyState.getRow$realm().getLinkList(columnInfo.columnRealmListIndex);
365+
columnRealmListRealmList = new RealmList<some.test.AllTypes>(some.test.AllTypes.class, osList, proxyState.getRealm$realm());
366366
return columnRealmListRealmList;
367367
}
368368
}
@@ -391,8 +391,8 @@ protected final void copy(ColumnInfo rawSrc, ColumnInfo rawDst) {
391391
}
392392

393393
proxyState.getRealm$realm().checkIfValid();
394-
LinkView links = proxyState.getRow$realm().getLinkList(columnInfo.columnRealmListIndex);
395-
links.clear();
394+
OsList osList = proxyState.getRow$realm().getLinkList(columnInfo.columnRealmListIndex);
395+
osList.removeAll();
396396
if (value == null) {
397397
return;
398398
}
@@ -403,7 +403,7 @@ protected final void copy(ColumnInfo rawSrc, ColumnInfo rawDst) {
403403
if (((RealmObjectProxy) linkedObject).realmGet$proxyState().getRealm$realm() != proxyState.getRealm$realm()) {
404404
throw new IllegalArgumentException("Each element of 'value' must belong to the same Realm.");
405405
}
406-
links.add(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex());
406+
osList.addRow(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex());
407407
}
408408
}
409409

@@ -817,13 +817,13 @@ public static long insert(Realm realm, some.test.AllTypes object, Map<RealmModel
817817

818818
RealmList<some.test.AllTypes> columnRealmListList = ((AllTypesRealmProxyInterface) object).realmGet$columnRealmList();
819819
if (columnRealmListList != null) {
820-
long columnRealmListNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.columnRealmListIndex, rowIndex);
820+
OsList columnRealmListOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.columnRealmListIndex);
821821
for (some.test.AllTypes columnRealmListItem : columnRealmListList) {
822822
Long cacheItemIndexcolumnRealmList = cache.get(columnRealmListItem);
823823
if (cacheItemIndexcolumnRealmList == null) {
824824
cacheItemIndexcolumnRealmList = AllTypesRealmProxy.insert(realm, columnRealmListItem, cache);
825825
}
826-
LinkView.nativeAdd(columnRealmListNativeLinkViewPtr, cacheItemIndexcolumnRealmList);
826+
columnRealmListOsList.addRow(cacheItemIndexcolumnRealmList);
827827
}
828828
}
829829
return rowIndex;
@@ -885,13 +885,13 @@ public static void insert(Realm realm, Iterator<? extends RealmModel> objects, M
885885

886886
RealmList<some.test.AllTypes> columnRealmListList = ((AllTypesRealmProxyInterface) object).realmGet$columnRealmList();
887887
if (columnRealmListList != null) {
888-
long columnRealmListNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.columnRealmListIndex, rowIndex);
888+
OsList columnRealmListOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.columnRealmListIndex);
889889
for (some.test.AllTypes columnRealmListItem : columnRealmListList) {
890890
Long cacheItemIndexcolumnRealmList = cache.get(columnRealmListItem);
891891
if (cacheItemIndexcolumnRealmList == null) {
892892
cacheItemIndexcolumnRealmList = AllTypesRealmProxy.insert(realm, columnRealmListItem, cache);
893893
}
894-
LinkView.nativeAdd(columnRealmListNativeLinkViewPtr, cacheItemIndexcolumnRealmList);
894+
columnRealmListOsList.addRow(cacheItemIndexcolumnRealmList);
895895
}
896896
}
897897
}
@@ -950,16 +950,16 @@ public static long insertOrUpdate(Realm realm, some.test.AllTypes object, Map<Re
950950
Table.nativeNullifyLink(tableNativePtr, columnInfo.columnObjectIndex, rowIndex);
951951
}
952952

953-
long columnRealmListNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.columnRealmListIndex, rowIndex);
954-
LinkView.nativeClear(columnRealmListNativeLinkViewPtr);
953+
OsList columnRealmListOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.columnRealmListIndex);
954+
columnRealmListOsList.removeAll();
955955
RealmList<some.test.AllTypes> columnRealmListList = ((AllTypesRealmProxyInterface) object).realmGet$columnRealmList();
956956
if (columnRealmListList != null) {
957957
for (some.test.AllTypes columnRealmListItem : columnRealmListList) {
958958
Long cacheItemIndexcolumnRealmList = cache.get(columnRealmListItem);
959959
if (cacheItemIndexcolumnRealmList == null) {
960960
cacheItemIndexcolumnRealmList = AllTypesRealmProxy.insertOrUpdate(realm, columnRealmListItem, cache);
961961
}
962-
LinkView.nativeAdd(columnRealmListNativeLinkViewPtr, cacheItemIndexcolumnRealmList);
962+
columnRealmListOsList.addRow(cacheItemIndexcolumnRealmList);
963963
}
964964
}
965965

@@ -1026,16 +1026,16 @@ public static void insertOrUpdate(Realm realm, Iterator<? extends RealmModel> ob
10261026
Table.nativeNullifyLink(tableNativePtr, columnInfo.columnObjectIndex, rowIndex);
10271027
}
10281028

1029-
long columnRealmListNativeLinkViewPtr = Table.nativeGetLinkView(tableNativePtr, columnInfo.columnRealmListIndex, rowIndex);
1030-
LinkView.nativeClear(columnRealmListNativeLinkViewPtr);
1029+
OsList columnRealmListOsList = new OsList(table.getUncheckedRow(rowIndex), columnInfo.columnRealmListIndex);
1030+
columnRealmListOsList.removeAll();
10311031
RealmList<some.test.AllTypes> columnRealmListList = ((AllTypesRealmProxyInterface) object).realmGet$columnRealmList();
10321032
if (columnRealmListList != null) {
10331033
for (some.test.AllTypes columnRealmListItem : columnRealmListList) {
10341034
Long cacheItemIndexcolumnRealmList = cache.get(columnRealmListItem);
10351035
if (cacheItemIndexcolumnRealmList == null) {
10361036
cacheItemIndexcolumnRealmList = AllTypesRealmProxy.insertOrUpdate(realm, columnRealmListItem, cache);
10371037
}
1038-
LinkView.nativeAdd(columnRealmListNativeLinkViewPtr, cacheItemIndexcolumnRealmList);
1038+
columnRealmListOsList.addRow(cacheItemIndexcolumnRealmList);
10391039
}
10401040
}
10411041

realm/realm-annotations-processor/src/test/resources/io/realm/BooleansRealmProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import android.util.JsonToken;
88
import io.realm.exceptions.RealmMigrationNeededException;
99
import io.realm.internal.ColumnInfo;
10-
import io.realm.internal.LinkView;
10+
import io.realm.internal.OsList;
1111
import io.realm.internal.OsObject;
1212
import io.realm.internal.OsObjectSchemaInfo;
1313
import io.realm.internal.OsSchemaInfo;

0 commit comments

Comments
 (0)