summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-06-17 08:54:19 -0700
committerKeith Packard <keithp@keithp.com>2016-06-17 08:54:19 -0700
commit0c5a1bea3ffa7c4b6b1503733e33911cbfcb3e80 (patch)
treee04d400331b72efc304ac0f51f22d58e09831d8e
parent383dec4449f8160c06804fba06290e7a07335934 (diff)
altoslib: Stop reflective JSON class walk at Object instead of null
Android has classes above Object which are all tied together which cause the object walking to fail in pretty spectacular ways. As Object has no interesting fields, that serves as a fine barrier to the super class walk and works on both android and real java. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosJson.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/altoslib/AltosJson.java b/altoslib/AltosJson.java
index 346144d9..67f3a00a 100644
--- a/altoslib/AltosJson.java
+++ b/altoslib/AltosJson.java
@@ -1063,7 +1063,7 @@ public class AltosJson extends JsonUtil {
} else {
object = c.newInstance();
}
- for (; c != null; c = c.getSuperclass()) {
+ for (; c != Object.class; c = c.getSuperclass()) {
for (Field field : c.getDeclaredFields()) {
String fieldName = field.getName();
Class fieldClass = field.getType();
@@ -1208,7 +1208,7 @@ public class AltosJson extends JsonUtil {
}
} else {
assert_hash(true);
- for (Class c = object.getClass(); c != null; c = c.getSuperclass()) {
+ for (Class c = object.getClass(); c != Object.class; c = c.getSuperclass()) {
for (Field field : c.getDeclaredFields()) {
String fieldName = field.getName();