From: Keith Packard Date: Fri, 17 Jun 2016 15:54:19 +0000 (-0700) Subject: altoslib: Stop reflective JSON class walk at Object instead of null X-Git-Tag: 1.6.4~1^2~1 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=0c5a1bea3ffa7c4b6b1503733e33911cbfcb3e80;hp=383dec4449f8160c06804fba06290e7a07335934;p=fw%2Faltos 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 --- 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();