Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Java8 bytecode #6372

Merged
merged 1 commit into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* None

### Fixed
* ?? (Issue [#??](https://github.com/realm/realm-java/issues/??), since ??).
* Removed Java 8 bytecode. Resulted in errors like `D8: Invoke-customs are only supported starting with Android O (--min-api 26)` if not compiled with Java 8. (Issue [#6300](https://github.com/realm/realm-java/issues/6300), since 5.8.0).

### Compatibility
* Realm Object Server: 3.11.0 or later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ public <T> void setList(String fieldName, RealmList<T> list) {
case LIST:
checkTypeOfListElements(list, RealmModel.class);
checkRealmObjectConstraints(fieldName, (RealmModel) list.first(null));
osResults.setModelList(fieldName, (RealmList<? extends RealmModel>) list);
osResults.setModelList(fieldName, (RealmList<RealmModel>) list);
break;
case INTEGER_LIST:
// Integers are a bit annoying as they are all stored as the same type in Core
Expand Down
79 changes: 56 additions & 23 deletions realm/realm-library/src/main/java/io/realm/internal/OsResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -473,68 +473,101 @@ private <T> void addTypeSpecificList(String fieldName, RealmList<T> list, AddLis
}

public void setStringList(String fieldName, RealmList<String> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addStringList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<String>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<String> list) {
builder.addStringList(0, list);
}
});
}

public void setByteList(String fieldName, RealmList<Byte> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addByteList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Byte>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Byte> list) {
builder.addByteList(0, list);
}
});
}

public void setShortList(String fieldName, RealmList<Short> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addShortList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Short>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Short> list) {
builder.addShortList(0, list);
}
});
}

public void setIntegerList(String fieldName, RealmList<Integer> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addIntegerList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Integer>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Integer> list) {
builder.addIntegerList(0, list);
}
});
}

public void setLongList(String fieldName, RealmList<Long> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addLongList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Long>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Long> list) {
builder.addLongList(0, list);
}
});
}

public void setBooleanList(String fieldName, RealmList<Boolean> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addBooleanList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Boolean>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Boolean> list) {
builder.addBooleanList(0, list);
}
});
}

public void setByteArrayList(String fieldName, RealmList<byte[]> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addByteArrayList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<byte[]>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<byte[]> list) {
builder.addByteArrayList(0, list);
}
});
}

public void setDateList(String fieldName, RealmList<Date> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addDateList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Date>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Date> list) {
builder.addDateList(0, list);
}
});
}

public void setFloatList(String fieldName, RealmList<Float> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addFloatList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Float>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Float> list) {
builder.addFloatList(0, list);
}
});
}

public void setDoubleList(String fieldName, RealmList<Double> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addDoubleList(0, lst);
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<Double>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<Double> list) {
builder.addDoubleList(0, list);
}
});
}

public void setModelList(String fieldName, RealmList<? extends RealmModel> list) {
addTypeSpecificList(fieldName, list, (builder, lst) -> {
builder.addObjectList(0, lst);
public void setModelList(String fieldName, RealmList<RealmModel> list) {
addTypeSpecificList(fieldName, list, new AddListTypeDelegate<RealmModel>() {
@Override
public void addList(OsObjectBuilder builder, RealmList<RealmModel> list) {
builder.addObjectList(0, list);
}
});
}

Expand Down