jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

`Arrays.asList()` value deserialization has changed from mutable to immutable in 2.13

Open JonasWilms opened this issue 1 year ago • 1 comments

During the restructuring of the JavaUtilCollectionsDeserializers (#2900) class the type for Arrays#ArrayList was changed from modifiable to unmodifiable.

This means you can no longer call methods like List#set on the deserialized List.

Since 2.13 https://github.com/FasterXML/jackson-databind/blame/0016185419e35dc903d0098689cb00326500f054/src/main/java/com/fasterxml/jackson/databind/deser/impl/JavaUtilCollectionsDeserializers.java#L86

Before 2.13 https://github.com/FasterXML/jackson-databind/blob/2e494a9acdadb485076a3bf67b14639bcc1df9b1/src/main/java/com/fasterxml/jackson/databind/deser/impl/JavaUtilCollectionsDeserializers.java#L74

JonasWilms avatar Aug 04 '22 14:08 JonasWilms

I think this would be best expressed in form of unit test, showing how mutability changed. Would it be possible to add it here -- even just couple of lines if not full test class.

Should be possible to change back in 2.14.0; looks like check is bit more general right now (anything ending with "List").

cowtowncoder avatar Aug 05 '22 01:08 cowtowncoder

Ok, fixed. Due to low risk backported in 2.13 for 2.13.4 release.

cowtowncoder avatar Aug 22 '22 02:08 cowtowncoder