New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.2.21反序列泛型时报java.lang.ClassCastException,在1.2.12中却不报错 #937
Comments
wuwen5
added a commit
to wuwen5/fastjson
that referenced
this issue
Dec 7, 2016
Merged
目前使用这种方式是ok的 Out<Info> out = JSON.parseObject(jString, new TypeReference<Out<Info>>(){}); |
@wuwen5 ,这种方式是可以获取到,但是可能不符合我的场景,我的场景下,Info是通过反射获取到的,需要传个参数进去才能知道是Info类,就像1.2.12版本那样,这样显式的我无法通过反射传入Info类型 |
@dengyj3 这个问题已经修复,请使用1.2.22版本。 |
asa1997
pushed a commit
to Be-Secure/fastjson
that referenced
this issue
Feb 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1、自定义泛型类(Out类中带泛型类型T):
2、对象类:
3、测试代码:
4、报错信息(1.2.21版本下执行结果):
Exception in thread "main" java.lang.ClassCastException: fastjson.test.Info cannot be cast to fastjson.test.Out
at fastjson.test.JsonTest.returnOut(JsonTest.java:21)
at fastjson.test.JsonTest.main(JsonTest.java:17)
5、1.2.12版本下执行结果:
fastjson.test.Out@433a87a0
user
请问1.2.21和1.2.12 在泛型类的反序列化上有什么差异?
The text was updated successfully, but these errors were encountered: