Add serializers for unmodifiable and synchronized collections
This PR adds serializers for JDK unmodifiable and synchronized collections.
This has been one of the most requested features for Kryo, but I have so far rejected all requests and redirected users to the kryo-serializers project because it is not possible to implement these serializers without reflection. Since this comes up again and again an we already have the same issue with the ClosureSerializer that has been part of Kryo for many years, I decided to give up my opposition.
The serializers need to be registered manually for now to maintain backwards compatibility, but will be added as default serializers in Kryo 6.
Note: The unsafe logic will probably have to be replaced with Varhandles for JDK24+.
#689 #885 #909 #913 #997 #1022
@theigl thanks for working on this. Do you already know which version might be shipped with this feature?
Hi @nastra. I'm still unhappy about merging this because it uses terminally deprecated code in Unsafe, but I think I will include it in Kryo 5.7.0. The release will probably happen in June or July.