-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
对于enum 类型,ASMDeserializer 的 parse 部分问题 #676
Comments
使用1.2.11 版本 |
问题已经修复,请等待下一个版本 |
wenshao
added a commit
that referenced
this issue
Jun 26, 2016
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
问题复现:
代码:
中modelType 为 MenuExpend 的field,一个customer 的enum。
这样立即报错。 exception is :java.lang.IllegalArgumentException: No enum constant
解决思路:
本以为是 EnumDeserializer 的deserialze 方法,经过追踪,却是使用的ASMDeserializer。
MenuExpend menuExpend = JSON.parseObject(jsonStr, MenuExpend.class,Feature.DisableASM);
使用如上的代码,并没有禁用掉ASM。
最后在debug 的时候,尝试把ParseConfig 的asmEnable 改为false,使用EnumDeserializer 进行反序列化。反序列话后的 modelType 为null,无异常。
其中有判断
。
那为什么ASM 中无法判断呢。看到ASMDeserializerFactory 中有写 isEnun() 的方法。不过我没看到具体生成的代码是什么。。。。
求作者修正改问题。
The text was updated successfully, but these errors were encountered: