Replies: 2 comments
-
确实是个非常大的问题! 5.7.23修复此问题,十分感谢!! |
Beta Was this translation helpful? Give feedback.
0 replies
-
我复制问题内容改成issue了~~ 见:#2175 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
日常使用中,A方法把 HashMap类转成了CamelCaseMap类,并返回了
调用A方法的地方,获取的值是Map接口类型的。所以觉得没什么要注意的。
然后调用方 B ,方法内使用了MapUtil.filter(),这时会把map的内容全部清空。
看了一下,应该是CamelCaseMap 浅克隆引起的。
CamelCaseMap类是继承MapWrapper。MapWrapper实现了Serializable, Cloneable接口。
在MapUtil.filter中有ObjectUtil.clone(map),因为带有Cloneable接口,所以判断为浅克隆。
MapWrapper 的raw字段浅克隆, 在MapUtil.filter clear一下,map和map2的值都没了。
Beta Was this translation helpful? Give feedback.
All reactions