Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ private void emitRealmList(
.beginControlFlow("if (" + fieldName + "RealmList != null)")
.emitStatement("return " + fieldName + "RealmList")
.nextControlFlow("else")
.emitStatement("OsList osList = proxyState.getRow$realm().getLinkList(%s)", fieldIndexVariableReference(field))
.emitStatement("OsList osList = proxyState.getRow$realm().getList(%s)", fieldIndexVariableReference(field))
.emitStatement(fieldName + "RealmList = new RealmList<%s>(%s.class, osList, proxyState.getRealm$realm())",
genericType, genericType)
.emitStatement("return " + fieldName + "RealmList")
Expand Down Expand Up @@ -556,7 +556,7 @@ public void emit(JavaWriter writer) throws IOException {
}
});
writer.emitStatement("proxyState.getRealm$realm().checkIfValid()")
.emitStatement("OsList osList = proxyState.getRow$realm().getLinkList(%s)", fieldIndexVariableReference(field))
.emitStatement("OsList osList = proxyState.getRow$realm().getList(%s)", fieldIndexVariableReference(field))
.emitStatement("osList.removeAll()")
.beginControlFlow("if (value == null)")
.emitStatement("return")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

@SuppressWarnings("all")
public class AllTypesRealmProxy extends some.test.AllTypes
implements RealmObjectProxy, AllTypesRealmProxyInterface {
implements RealmObjectProxy, AllTypesRealmProxyInterface {

static final class AllTypesColumnInfo extends ColumnInfo {
long columnStringIndex;
Expand Down Expand Up @@ -111,9 +111,9 @@ protected final void copy(ColumnInfo rawSrc, ColumnInfo rawDst) {
private AllTypesColumnInfo columnInfo;
private ProxyState<some.test.AllTypes> proxyState;
private final MutableRealmInteger.Managed columnMutableRealmIntegerMutableRealmInteger = new MutableRealmInteger.Managed<some.test.AllTypes>() {
@Override protected ProxyState<some.test.AllTypes> getProxyState() { return proxyState; }
@Override protected long getColumnIndex() { return columnInfo.columnMutableRealmIntegerIndex; }
};
@Override protected ProxyState<some.test.AllTypes> getProxyState() { return proxyState; }
@Override protected long getColumnIndex() { return columnInfo.columnMutableRealmIntegerIndex; }
};
private RealmList<some.test.AllTypes> columnRealmListRealmList;
private RealmResults<some.test.AllTypes> parentObjectsBacklinks;

Expand Down Expand Up @@ -361,7 +361,7 @@ protected final void copy(ColumnInfo rawSrc, ColumnInfo rawDst) {
if (columnRealmListRealmList != null) {
return columnRealmListRealmList;
} else {
OsList osList = proxyState.getRow$realm().getLinkList(columnInfo.columnRealmListIndex);
OsList osList = proxyState.getRow$realm().getList(columnInfo.columnRealmListIndex);
columnRealmListRealmList = new RealmList<some.test.AllTypes>(some.test.AllTypes.class, osList, proxyState.getRealm$realm());
return columnRealmListRealmList;
}
Expand Down Expand Up @@ -391,7 +391,7 @@ protected final void copy(ColumnInfo rawSrc, ColumnInfo rawDst) {
}

proxyState.getRealm$realm().checkIfValid();
OsList osList = proxyState.getRow$realm().getLinkList(columnInfo.columnRealmListIndex);
OsList osList = proxyState.getRow$realm().getList(columnInfo.columnRealmListIndex);
osList.removeAll();
if (value == null) {
return;
Expand Down Expand Up @@ -452,7 +452,7 @@ public static List<String> getFieldNames() {

@SuppressWarnings("cast")
public static some.test.AllTypes createOrUpdateUsingJsonObject(Realm realm, JSONObject json, boolean update)
throws JSONException {
throws JSONException {
final List<String> excludeFields = new ArrayList<String>(2);
some.test.AllTypes obj = null;
if (update) {
Expand Down Expand Up @@ -569,7 +569,7 @@ public static some.test.AllTypes createOrUpdateUsingJsonObject(Realm realm, JSON
@SuppressWarnings("cast")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static some.test.AllTypes createUsingJsonStream(Realm realm, JsonReader reader)
throws IOException {
throws IOException {
boolean jsonHasPrimaryKey = false;
final some.test.AllTypes obj = new some.test.AllTypes();
final AllTypesRealmProxyInterface objProxy = (AllTypesRealmProxyInterface) obj;
Expand Down Expand Up @@ -635,7 +635,7 @@ public static some.test.AllTypes createUsingJsonStream(Realm realm, JsonReader r
} else if (name.equals("columnMutableRealmInteger")) {
Long val = null;
if (reader.peek() != JsonToken.NULL) {
val = reader.nextLong()
val = reader.nextLong();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did this compile before? 🤔

Copy link
Copy Markdown
Contributor Author

@zaki50 zaki50 Sep 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess Google's compile-testing library does not see semi-colons when comparing generated code.

} else {
reader.skipValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public RealmList<DynamicRealmObject> getList(String fieldName) {

long columnIndex = proxyState.getRow$realm().getColumnIndex(fieldName);
try {
OsList osList = proxyState.getRow$realm().getLinkList(columnIndex);
OsList osList = proxyState.getRow$realm().getList(columnIndex);
//noinspection ConstantConditions
@Nonnull
String className = osList.getTargetTable().getClassName();
Expand Down Expand Up @@ -745,7 +745,7 @@ public void setList(String fieldName, RealmList<DynamicRealmObject> list) {
}

long columnIndex = proxyState.getRow$realm().getColumnIndex(fieldName);
OsList osList = proxyState.getRow$realm().getLinkList(columnIndex);
OsList osList = proxyState.getRow$realm().getList(columnIndex);
Table linkTargetTable = osList.getTargetTable();
//noinspection ConstantConditions
@Nonnull
Expand Down Expand Up @@ -968,7 +968,7 @@ public String toString() {
break;
case LIST:
String targetClassName = proxyState.getRow$realm().getTable().getLinkTarget(columnIndex).getClassName();
sb.append(String.format(Locale.US, "RealmList<%s>[%s]", targetClassName, proxyState.getRow$realm().getLinkList(columnIndex).size()));
sb.append(String.format(Locale.US, "RealmList<%s>[%s]", targetClassName, proxyState.getRow$realm().getList(columnIndex).size()));
break;
case UNSUPPORTED_TABLE:
case UNSUPPORTED_MIXED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public boolean isNullLink(long columnIndex) {
}

@Override
public OsList getLinkList(long columnIndex) {
public OsList getList(long columnIndex) {
throw getStubException();
}

Expand Down
107 changes: 107 additions & 0 deletions realm/realm-library/src/main/java/io/realm/internal/OsList.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package io.realm.internal;

import java.util.Date;

import javax.annotation.Nullable;


/**
* Java wrapper of Object Store List class. This backs managed versions of RealmList.
*/
Expand Down Expand Up @@ -47,6 +52,108 @@ public void setRow(long pos, long targetRowIndex) {
nativeSetRow(nativePtr, pos, targetRowIndex);
}

public void addNull() {
// FIXME zaki50 implement this
}

public void insertNull(long pos) {
// FIXME zaki50 implement this
}

public void setNull(long pos) {
// FIXME zaki50 implement this
}

public void addLong(long value) {
// FIXME zaki50 implement this
}

public void insertLong(long pos, long value) {
// FIXME zaki50 implement this
}

public void setLong(long pos, long value) {
// FIXME zaki50 implement this
}

public void addDouble(double value) {
// FIXME zaki50 implement this
}

public void insertDouble(long pos, double value) {
// FIXME zaki50 implement this
}

public void setDouble(long pos, double value) {
// FIXME zaki50 implement this
}

public void addFloat(float value) {
// FIXME zaki50 implement this
}

public void insertFloat(long pos, float value) {
// FIXME zaki50 implement this
}

public void setFloat(long pos, float value) {
// FIXME zaki50 implement this
}

public void addBoolean(boolean value) {
// FIXME zaki50 implement this
}

public void insertBoolean(long pos, boolean value) {
// FIXME zaki50 implement this
}

public void setBoolean(long pos, boolean value) {
// FIXME zaki50 implement this
}

public void addBinary(byte[] value) {
// FIXME zaki50 implement this
}

public void insertBinary(long pos, byte[] value) {
// FIXME zaki50 implement this
}

public void setBinary(long pos, byte[] value) {
// FIXME zaki50 implement this
}

public void addString(String value) {
// FIXME zaki50 implement this
}

public void insertString(long pos, String value) {
// FIXME zaki50 implement this
}

public void setString(long pos, String value) {
// FIXME zaki50 implement this
}

public void addDate(Date value) {
// FIXME zaki50 implement this
}

public void insertDate(long pos, Date value) {
// FIXME zaki50 implement this
}

public void setDate(long pos, Date value) {
// FIXME zaki50 implement this
}

@Nullable
public Object getValue(long pos) {
// FIXME zaki50 implement this
return null;
}

public void move(long sourceIndex, long targetIndex) {
nativeMove(nativePtr, sourceIndex, targetIndex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public boolean isNullLink(long columnIndex) {
}

@Override
public OsList getLinkList(long columnIndex) {
public OsList getList(long columnIndex) {
throw new IllegalStateException(QUERY_NOT_RETURNED_MESSAGE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public interface Row {

boolean isNullLink(long columnIndex);

OsList getLinkList(long columnIndex);
OsList getList(long columnIndex);

void setLong(long columnIndex, long value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public boolean isNullLink(long columnIndex) {
}

@Override
public OsList getLinkList(long columnIndex) {
public OsList getList(long columnIndex) {
return new OsList(this, columnIndex);
}

Expand Down