Skip to content

Commit da390a5

Browse files
committed
Merge branch '2.11' into 2.12
2 parents ca3005a + 3e964e2 commit da390a5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

release-notes/VERSION-2.x

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Project: jackson-databind
7676
#2840: `ObjectMapper.activateDefaultTypingAsProperty()` is not using
7777
parameter `PolymorphicTypeValidator`
7878
(reported by Daniel W)
79+
#2846: Problem deserialization "raw generic" fields (like `Map`) in 2.11.2
7980
- Fix issues with `MapLikeType.isTrueMapType()`,
8081
`CollectionLikeType.isTrueCollectionType()`
8182

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedClass.java

+6
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ public static AnnotatedClass constructWithoutSuperTypes(Class<?> raw, MapperConf
226226

227227
@Override
228228
public JavaType resolveType(Type type) {
229+
// 05-Sep-2020, tatu: [databind#2846][databind#2821] avoid
230+
// passing context in case of Raw class (generic type declared
231+
// without type parametrers) as that can lead to mismatch
232+
if (type instanceof Class<?>) {
233+
return _typeFactory.constructType(type);
234+
}
229235
return _typeFactory.constructType(type, _bindings);
230236
}
231237

src/test/java/com/fasterxml/jackson/failing/GenericTypeDeserialization2846Test.java renamed to src/test/java/com/fasterxml/jackson/databind/deser/jdk/MapRawWithGeneric2846Test.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package com.fasterxml.jackson.failing;
1+
package com.fasterxml.jackson.databind.deser.jdk;
22

33
import java.util.Map;
44

55
import com.fasterxml.jackson.core.type.TypeReference;
66

77
import com.fasterxml.jackson.databind.*;
88

9-
public class GenericTypeDeserialization2846Test extends BaseMapTest
9+
public class MapRawWithGeneric2846Test extends BaseMapTest
1010
{
1111
@SuppressWarnings("rawtypes")
1212
static class GenericEntity<T> {

0 commit comments

Comments
 (0)