Skip to content

Commit

Permalink
Fix a lint error in proxy classes when the 'minSdkVersion' of user's …
Browse files Browse the repository at this point in the history
…project is smaller than 11.

fixes #3356
  • Loading branch information
zaki50 committed Aug 29, 2016
1 parent 12b3afd commit 591bc6a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

* Move JNI build to CMake.

### Bug fixes

* Fixed a lint error in proxy classes when the 'minSdkVersion' of user's project is smaller than 11 (#3356).

## 1.2.0

### Bug fixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public void generate() throws IOException, UnsupportedOperationException {
.emitEmptyLine();

ArrayList<String> imports = new ArrayList<String>();
imports.add("android.annotation.TargetApi");
imports.add("android.os.Build");
imports.add("android.util.JsonReader");
imports.add("android.util.JsonToken");
imports.add("io.realm.RealmFieldType");
Expand Down Expand Up @@ -1553,6 +1555,7 @@ private void emitCreateOrUpdateUsingJsonObject(JavaWriter writer) throws IOExcep

private void emitCreateUsingJsonStream(JavaWriter writer) throws IOException {
writer.emitAnnotation("SuppressWarnings", "\"cast\"");
writer.emitAnnotation("TargetApi", "Build.VERSION_CODES.HONEYCOMB");
writer.beginMethod(
qualifiedClassName,
"createUsingJsonStream",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.realm;


import android.annotation.TargetApi;
import android.os.Build;
import android.util.JsonReader;
import android.util.JsonToken;
import io.realm.RealmFieldType;
Expand Down Expand Up @@ -490,6 +492,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 {
some.test.AllTypes obj = realm.createObject(some.test.AllTypes.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.realm;


import android.annotation.TargetApi;
import android.os.Build;
import android.util.JsonReader;
import android.util.JsonToken;
import io.realm.RealmFieldType;
Expand Down Expand Up @@ -225,6 +227,7 @@ public static some.test.Booleans createOrUpdateUsingJsonObject(Realm realm, JSON
}

@SuppressWarnings("cast")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static some.test.Booleans createUsingJsonStream(Realm realm, JsonReader reader)
throws IOException {
some.test.Booleans obj = realm.createObject(some.test.Booleans.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.realm;


import android.annotation.TargetApi;
import android.os.Build;
import android.util.JsonReader;
import android.util.JsonToken;
import io.realm.RealmFieldType;
Expand Down Expand Up @@ -910,6 +912,7 @@ public static some.test.NullTypes createOrUpdateUsingJsonObject(Realm realm, JSO
}

@SuppressWarnings("cast")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static some.test.NullTypes createUsingJsonStream(Realm realm, JsonReader reader)
throws IOException {
some.test.NullTypes obj = realm.createObject(some.test.NullTypes.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.realm;


import android.annotation.TargetApi;
import android.os.Build;
import android.util.JsonReader;
import android.util.JsonToken;
import io.realm.RealmFieldType;
Expand Down Expand Up @@ -163,6 +165,7 @@ public static some.test.Simple createOrUpdateUsingJsonObject(Realm realm, JSONOb
}

@SuppressWarnings("cast")
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static some.test.Simple createUsingJsonStream(Realm realm, JsonReader reader)
throws IOException {
some.test.Simple obj = realm.createObject(some.test.Simple.class);
Expand Down

0 comments on commit 591bc6a

Please sign in to comment.