Skip to content
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

java 读取方式 枚举类型如果从非0开始 且中间不连续的自定义枚举 读取json 会抛异常 #87

Open
yangqingming opened this issue Jul 19, 2021 · 6 comments

Comments

@yangqingming
Copy link

java 读取方式 枚举类型如果从非0开始 且中间不连续的自定义枚举 读取json 会抛异常

@davyxu
Copy link
Owner

davyxu commented Jul 19, 2021

报错信息给下啊?你用的啥json序列化器

@yangqingming
Copy link
Author

image
image

@davyxu
Copy link
Owner

davyxu commented Jul 19, 2021

先尝试用其他json序列化器。 这个貌似是阿里的序列化器的bug

@yangqingming
Copy link
Author

gson也试了 虽然没有报错但是 枚举字段是反序列化不出来的

@davyxu
Copy link
Owner

davyxu commented Jul 19, 2021

先换整形字段吧, java限制很大

@davyxu
Copy link
Owner

davyxu commented Jul 19, 2021

我看了下fastjson底层枚举实现,用的数组。 绕不过去。改用整形吧, 要不然就找一个或者自己实现的json读取

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants