Open deqingLv opened 6 years ago
在bug fix #1458,之后出现的问题。
在解析完JsonCreator之后,这里通过注释,不返回JsonBean,走到后面的method的逻辑,会添加新的filed。这里会存在filed的冲突,通过compareTo没能很好的解决冲突,导致反序列化失败。
引发问题的代码:
@ToString @Getter @Setter class Test { private List<Long> ids; @JSONCreator public Test(@JSONField(name = ids) String ids) { ids = new ArrayList(); for(String id : ids.split(",")) { ids.add(Long.valueOf(id)); } } }
序列化字符串:
{ "ids" : "1,2,3" }
由于JSONField定义的类型:String与成员变量的类型 List冲突, 最终反序列化时,会将ids当作List数组去解析,导致反序列化失败
什么版本?
原版本1.2.32是没有问题的,更新到1.2.48发现的问题
在bug fix #1458,之后出现的问题。
在解析完JsonCreator之后,这里通过注释,不返回JsonBean,走到后面的method的逻辑,会添加新的filed。这里会存在filed的冲突,通过compareTo没能很好的解决冲突,导致反序列化失败。
引发问题的代码:
序列化字符串:
由于JSONField定义的类型:String与成员变量的类型 List冲突, 最终反序列化时,会将ids当作List数组去解析,导致反序列化失败