Closed tweimer closed 4 years ago
Hi Tobias, thanks for the changes. My review comments follows. Please let me know if you want to change anything or you're happy for your code to be merged.
Thamks. I fixed/added all your remarks and added even more JUnit. :) Ready to be merged!
Thank you! Could you make a new release soon? I really need that fix and I wouldn't want to use my own workaround.
Hi, just deployed 1.10.2 with the fixes
Hi Konstantinos, I am using your Cloning library, and I found a bug with cloning of EnumMaps. If any key of an EnumMap is being mapped to
null
, the cloned EnumMap will not map it tonull
, but to a random instance ofObject
.I tracked down that problem and the cause of the problem is that
EnumMap
is using a marker objectjava.util.EnumMap.NULL
to distinguish enums mapped tonull
from objects not contained in the map at all.java.util.EnumMap.NULL
is used inmaskNull
andunmaskNull
by reference comparision, so afterNULL
is cloned, the reference comparision goes wrong.You are able to reproduce that problem with the JUnit test included in my Pull Request.
In order to solve the problem, I have introduced
FastClonerEnumMap
. It is basically taken fromFastClonerHashMap
, with some modification forEnumMap
. It is registered incom.rits.cloning.Cloner.registerFastCloners()
.After that, the JUnit tests I added are working fine. Feel free to add additional ones.
I also added FastClonerLinkedhashSet, which will fix #46 (JUnit tests are included too).
I also updated pom.xml (fixes #66)
I hope you will merge this PR. If you have any objections, please let me know!