FasterXML / jackson-module-scala

Add-on module for Jackson (https://github.com/FasterXML/jackson) to support Scala-specific datatypes
Apache License 2.0
502 stars 142 forks source link

Fix regression in Map deserialization in Scala 2.13 when default typing is enabled #658

Closed retronym closed 11 months ago

retronym commented 11 months ago

This Map serializer is implemented in terms of the Java version and is somewhat fragile, as discussed in #643 / #470.

This commit ensures that the wrapper class is a member class in both Scala and Java.

That results in this JSON as the serializer code chooses not to put the inner class name in the type annotation.

{"m":["scala.collection.immutable.Map",{"one":"one","two":"two"}]}

Fixes #643

pjfanning commented 11 months ago

Thanks @retronym - I think this is safe to include in the 2.16.1 release, so I've backported it back to the 2.16 branch.

I'm surprised that the core jackson-databind writes the pre-conversion class name with this change but it obviously works based on your test case. The test case should help us spot if the core jackson-databind library modifies this behaviour.