You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
如标题所述。我想把一个使用fastjson1运行正常的代码升级到fastjson2,发现会导致类型丢失。
代码如下: .map(y => { val gear:Int = 0 y.put("gear", gear) y })
会报出 the result type of an implicit conversion must be more specific than Object type mismatch; found : Int required: Object x.put("gear", gear)
观察源码后发现是因为升级后的JSONObject使用的put方法产生了变化,从重写的put方法变成了完全继承HashMap的put方法,中间有一些变化导致了类型丢失的问题。本人技术有限,没有发现更深层次的问题所在。但是似乎还是采用fastjson1那种重写Map的put方法对scala的用户更友好一些。
The text was updated successfully, but these errors were encountered:
如标题所述。我想把一个使用fastjson1运行正常的代码升级到fastjson2,发现会导致类型丢失。
代码如下:
.map(y => { val gear:Int = 0 y.put("gear", gear) y })
会报出
the result type of an implicit conversion must be more specific than Object type mismatch; found : Int required: Object x.put("gear", gear)
观察源码后发现是因为升级后的JSONObject使用的put方法产生了变化,从重写的put方法变成了完全继承HashMap的put方法,中间有一些变化导致了类型丢失的问题。本人技术有限,没有发现更深层次的问题所在。但是似乎还是采用fastjson1那种重写Map的put方法对scala的用户更友好一些。
The text was updated successfully, but these errors were encountered: