bug fixed for android 2.2

This commit is contained in:
wenshao
2014-01-07 23:41:42 +08:00
parent b3407ba1e7
commit a3df9ddde0
3 changed files with 22 additions and 2 deletions
+1 -1
View File
@@ -702,5 +702,5 @@ public abstract class JSON implements JSONStreamAware, JSONAware {
return TypeUtils.cast(json, clazz, ParserConfig.getGlobalInstance());
}
public final static String VERSION = "1.1.37";
public final static String VERSION = "1.1.39";
}
@@ -24,6 +24,26 @@ public class ASMUtils {
return isAndroid(System.getProperty("java.vm.name"));
}
private static Boolean lessThanAndroid23;
public static boolean isLessThanAndroid23() {
if (lessThanAndroid23 != null) {
return lessThanAndroid23;
}
try {
Class<?> clazz = Class.forName("android.os.SystemProperties");
Method method = clazz.getMethod("getInt", String.class, int.class);
Integer sdkInt = (Integer) method.invoke(null, "ro.build.version.sdk", 0);
lessThanAndroid23 = sdkInt.intValue() < 9;
} catch (Exception e) {
e.printStackTrace();
lessThanAndroid23 = false;
}
return lessThanAndroid23;
}
public static String getDesc(Method method) {
StringBuffer buf = new StringBuffer();
buf.append("(");
@@ -55,7 +55,7 @@ public class FieldInfo implements Comparable<FieldInfo> {
Type fieldType;
Class<?> fieldClass;
if (method != null) {
if (method.getParameterTypes().length == 1) {
if (method.getParameterTypes().length == 1 && !ASMUtils.isLessThanAndroid23()) {
fieldClass = method.getParameterTypes()[0];
fieldType = method.getGenericParameterTypes()[0];
} else {