diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15bd9e1d..f78a4fc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,31 @@
+# 0.9.18
+* fix of overflow detection for numeric primitive types
+* fix of method prefix of error message
+* issue #125 avoid nested JsonException
+* fix #109 treat wildcard generics variable as Object
+
+# 0.9.17
+* fix leading zero
+* fix #112 #119
+* fix of parsing zero & min values
+* issue #115 better leading zero detection
+* fix #144, parse max int/long
+* fix #110 if @JsonProperty is marked on field, ignore getter/setter
+
+# 0.9.16
+
+* issue #107 annotation should be marked on getter/setter if present
+* fix ctor is null when encoding issue
+* issue #104, JsonWrapper argument should not be mandatory
+* issue #99 added mustBeValid method to Any class
+* issue #97 demonstrate JsonProperty when both field and setter
+* like "1.0e+10" should not fail
+* issue #94 skip transient field
+* issue #94 fix JsonProperty not changing fromNames and toNames
+* issue #93 some control character should be esacped specially
+* issue #93 fix control character serialization
+* issue #92 fix generics support
+
# 0.9.15
breaking changes
diff --git a/pom.xml b/pom.xml
index 0f93f153..06286ec7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.jsoniter
- 0.9.18-SNAPSHOT
+ 0.9.18
jsoniter
json iterator
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
diff --git a/src/main/java/com/jsoniter/Codegen.java b/src/main/java/com/jsoniter/Codegen.java
index c1fa2edc..0b2922b9 100644
--- a/src/main/java/com/jsoniter/Codegen.java
+++ b/src/main/java/com/jsoniter/Codegen.java
@@ -129,7 +129,7 @@ private static Type chooseImpl(Type type) {
clazz = (Class) pType.getRawType();
typeArgs = pType.getActualTypeArguments();
} else if (type instanceof WildcardType) {
- clazz = Object.class;
+ return Object.class;
} else {
clazz = (Class) type;
}
diff --git a/src/main/java/com/jsoniter/CodegenImplNative.java b/src/main/java/com/jsoniter/CodegenImplNative.java
index 4ce5c768..156ce8f2 100644
--- a/src/main/java/com/jsoniter/CodegenImplNative.java
+++ b/src/main/java/com/jsoniter/CodegenImplNative.java
@@ -6,6 +6,7 @@
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashMap;
@@ -177,6 +178,8 @@ public static String getTypeName(Type fieldType) {
ParameterizedType pType = (ParameterizedType) fieldType;
Class clazz = (Class) pType.getRawType();
return clazz.getCanonicalName();
+ } else if (fieldType instanceof WildcardType) {
+ return Object.class.getCanonicalName();
} else {
throw new JsonException("unsupported type: " + fieldType);
}
@@ -204,6 +207,8 @@ private static String genReadOp(String cacheKey, Type valueType) {
if (nativeRead != null) {
return nativeRead;
}
+ } else if (valueType instanceof WildcardType) {
+ return NATIVE_READS.get(Object.class.getCanonicalName());
}
Codegen.getDecoder(cacheKey, valueType);
if (Codegen.canStaticAccess(cacheKey)) {
diff --git a/src/main/java/com/jsoniter/output/Codegen.java b/src/main/java/com/jsoniter/output/Codegen.java
index f6e7f775..e99209d4 100644
--- a/src/main/java/com/jsoniter/output/Codegen.java
+++ b/src/main/java/com/jsoniter/output/Codegen.java
@@ -10,6 +10,7 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
import java.util.*;
class Codegen {
diff --git a/src/main/java/com/jsoniter/output/CodegenImplNative.java b/src/main/java/com/jsoniter/output/CodegenImplNative.java
index e953ab5d..4237a5d2 100644
--- a/src/main/java/com/jsoniter/output/CodegenImplNative.java
+++ b/src/main/java/com/jsoniter/output/CodegenImplNative.java
@@ -7,6 +7,7 @@
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashMap;
@@ -282,6 +283,10 @@ public static void genWriteOp(CodegenResult ctx, String code, Type valueType, bo
ctx.append(String.format("stream.writeVal((%s)%s);", getTypeName(valueType), code));
return;
}
+ if (valueType instanceof WildcardType) {
+ ctx.append(String.format("stream.writeVal((%s)%s);", getTypeName(Object.class), code));
+ return;
+ }
}
if (!isCollectionValueNullable) {
@@ -313,6 +318,8 @@ public static String getTypeName(Type fieldType) {
ParameterizedType pType = (ParameterizedType) fieldType;
Class clazz = (Class) pType.getRawType();
return clazz.getCanonicalName();
+ } else if (fieldType instanceof WildcardType) {
+ return Object.class.getCanonicalName();
} else {
throw new JsonException("unsupported type: " + fieldType);
}
diff --git a/src/main/java/com/jsoniter/spi/ClassDescriptor.java b/src/main/java/com/jsoniter/spi/ClassDescriptor.java
index 61b43df7..4c65da68 100644
--- a/src/main/java/com/jsoniter/spi/ClassDescriptor.java
+++ b/src/main/java/com/jsoniter/spi/ClassDescriptor.java
@@ -391,6 +391,9 @@ private static Map collectTypeVariableLookup(Type type) {
vars.putAll(collectTypeVariableLookup(clazz.getGenericSuperclass()));
return vars;
}
+ if (type instanceof WildcardType) {
+ return vars;
+ }
throw new JsonException("unexpected type: " + type);
}
diff --git a/src/main/java/com/jsoniter/spi/TypeLiteral.java b/src/main/java/com/jsoniter/spi/TypeLiteral.java
index 8f9f5423..b4461390 100644
--- a/src/main/java/com/jsoniter/spi/TypeLiteral.java
+++ b/src/main/java/com/jsoniter/spi/TypeLiteral.java
@@ -122,7 +122,7 @@ private static String generateCacheKey(Type type, String prefix) {
decoderClassName.append(formatTypeWithoutSpecialCharacter(compType));
decoderClassName.append("_array");
} else if (type instanceof WildcardType) {
- decoderClassName.append("_wildcard");
+ decoderClassName.append(Object.class.getName());
} else {
throw new UnsupportedOperationException("do not know how to handle: " + type);
}
@@ -148,7 +148,7 @@ private static String formatTypeWithoutSpecialCharacter(Type type) {
return formatTypeWithoutSpecialCharacter(gaType.getGenericComponentType()) + "_array";
}
if (type instanceof WildcardType) {
- return type.toString();
+ return Object.class.getCanonicalName();
}
throw new JsonException("unsupported type: " + type + ", of class " + type.getClass());
}
diff --git a/src/test/java/com/jsoniter/TestGenerics.java b/src/test/java/com/jsoniter/TestGenerics.java
index 5f3d4077..a48ea648 100644
--- a/src/test/java/com/jsoniter/TestGenerics.java
+++ b/src/test/java/com/jsoniter/TestGenerics.java
@@ -1,10 +1,6 @@
package com.jsoniter;
-import com.jsoniter.output.JsonStream;
-import com.jsoniter.spi.Binding;
-import com.jsoniter.spi.ClassDescriptor;
-import com.jsoniter.spi.ClassInfo;
-import com.jsoniter.spi.TypeLiteral;
+import com.jsoniter.spi.*;
import junit.framework.TestCase;
import java.io.IOException;
@@ -15,7 +11,7 @@
public class TestGenerics extends TestCase {
static {
-// JsonIterator.setMode(DecodingMode.REFLECTION_MODE);
+// JsonIterator.setMode(DecodingMode.DYNAMIC_MODE_AND_MATCH_FIELD_STRICTLY);
}
public void test_int_list() throws IOException {
diff --git a/src/test/java/com/jsoniter/output/TestGenerics.java b/src/test/java/com/jsoniter/output/TestGenerics.java
index 36772484..53d5a95a 100644
--- a/src/test/java/com/jsoniter/output/TestGenerics.java
+++ b/src/test/java/com/jsoniter/output/TestGenerics.java
@@ -5,7 +5,9 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class TestGenerics extends TestCase {
static {
@@ -39,6 +41,7 @@ public void test_inherited_getter_is_not_duplicate() throws IOException {
public static class TestObject7 {
public List> field;
+ public Map,?> field2;
}
public void test_wildcard() throws IOException {
@@ -46,6 +49,9 @@ public void test_wildcard() throws IOException {
ArrayList list = new ArrayList();
list.add(1);
obj.field = list;
- assertEquals("{\"field\":[1]}", JsonStream.serialize(obj));
+ HashMap map = new HashMap();
+ map.put("hello", 1);
+ obj.field2 = map;
+ assertEquals("{\"field\":[1],\"field2\":{\"hello\":1}}", JsonStream.serialize(obj));
}
}