diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index c43e028aa7..f70f9e0875 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -18,6 +18,8 @@ Project: jackson-databind to `handleUnknownVanilla()` (proposed by Vladimir T, follow up to #822) #2416: Optimize `ValueInstantiator` construction for default `Collection`, `Map` types +#2422: `scala.collection.immutable.ListMap` fails to serialize since 2.9.3 + (reported by dejanlokar1@github) #2425: Add global config override setting for `@JsonFormat.lenient()` 2.10.0.pr1 (19-Jul-2019) diff --git a/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java b/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java index 47983423bc..00d9e5df8a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java @@ -487,8 +487,11 @@ private String _resolveTypePlaceholders(JavaType sourceType, JavaType actualType // 19-Apr-2018, tatu: Hack for [databind#1964] -- allow type demotion // for `java.util.Map` key type if (and only if) target type is // `java.lang.Object` + // 19-Aug-2019, tatu: Further, allow for all Map-like types, with assumption + // first argument would be key; initially just because Scala Maps have + // some issues (see [databind#2422]) if (i == 0) { - if (sourceType.hasRawClass(Map.class) + if (sourceType.isMapLikeType() && act.hasRawClass(Object.class)) { continue; }