mirror of
https://github.com/alibaba/fastjson.git
synced 2026-10-27 04:10:07 +08:00
bug fixed for android 2.2
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user