bug fixed for generic types

This commit is contained in:
wenshao
2012-11-07 23:10:44 +08:00
parent e8198d6b1b
commit fa48fe21bd
4 changed files with 83 additions and 1 deletions
@@ -0,0 +1,16 @@
package com.alibaba.json.bvt.bug;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
public class Bug_for_huangchun extends TestCase {
public void test_serialize_url() throws Exception {
JSONObject json = new JSONObject();
json.put("info", "<a href=\"http://www.baidu.com\"> 问题链接 </a> ");
String text = JSON.toJSONString(json);
System.out.println(text);
}
}
@@ -0,0 +1,33 @@
package com.alibaba.json.bvt.bug;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
public class Bug_for_jinghui70 extends TestCase {
public static abstract class IdObject<I> {
private I id;
public I getId() {
return id;
}
public void setId(I id) {
this.id = id;
}
}
public static class Child extends IdObject<Long> {
}
public void test_generic() throws Exception {
String str = "{\"id\":0}";
Child child = JSON.parseObject(str, Child.class);
Assert.assertEquals(Long.class, child.getId().getClass());
}
}