From 90aeb43a32f57a7375a2706f86e96e35ac6f1804 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 30 Sep 2022 20:58:12 -0700 Subject: [PATCH] Update release notes wrt #3505 --- release-notes/CREDITS-2.x | 5 +++++ release-notes/VERSION-2.x | 2 ++ .../deftyping/DefaultTypeResolver3505Test.java} | 17 ++++++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) rename src/test/java/com/fasterxml/jackson/databind/{deser/TestDeserializerFactoryWithDefaultTypeResolverBuilder.java => jsontype/deftyping/DefaultTypeResolver3505Test.java} (89%) diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index f690aa8ef0..391e87338b 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -1487,3 +1487,8 @@ Igor Shymko (ancane@github) Jordi Ortolá Ankum (Tomasito665@github) * Contributed #3503: `StdDeserializer` coerces ints to floats even if configured to fail (2.14.0) + +Arnaud Solé (Bluexin@github) + * Contributed #3505: Fix deduction deserializer with DefaultTypeResolverBuilder + (2.14.0) + diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 0a8bd84c3d..4a6eaf244e 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -47,6 +47,8 @@ Project: jackson-databind (contributed by Igor S) #3503: `StdDeserializer` coerces ints to floats even if configured to fail (contributed by Jordi O-A) +#3505: Fix deduction deserializer with DefaultTypeResolverBuilder + (contributed by Arnaud S) #3528: `TokenBuffer` defaults for parser/stream-read features neither passed from parser nor use real defaults #3530: Change LRUMap to just evict one entry when maxEntries reached diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestDeserializerFactoryWithDefaultTypeResolverBuilder.java b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolver3505Test.java similarity index 89% rename from src/test/java/com/fasterxml/jackson/databind/deser/TestDeserializerFactoryWithDefaultTypeResolverBuilder.java rename to src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolver3505Test.java index b9b152469d..4d870b3279 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestDeserializerFactoryWithDefaultTypeResolverBuilder.java +++ b/src/test/java/com/fasterxml/jackson/databind/jsontype/deftyping/DefaultTypeResolver3505Test.java @@ -1,4 +1,4 @@ -package com.fasterxml.jackson.databind.deser; +package com.fasterxml.jackson.databind.jsontype.deftyping; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.databind.BaseMapTest; @@ -13,11 +13,12 @@ import java.util.Collection; import java.util.List; -// Tests for [databind#pending] causing a NPE when setting a DefaultTypeResolverBuilder +// Tests for [databind#3505] causing a NPE when setting a DefaultTypeResolverBuilder // and registering subtypes through ObjectMapper (no annotations) -public class TestDeserializerFactoryWithDefaultTypeResolverBuilder extends BaseMapTest { - - private interface Parent { +public class DefaultTypeResolver3505Test + extends BaseMapTest +{ + interface Parent { class ChildOne implements Parent { public String one; } @@ -30,8 +31,10 @@ class ChildTwo implements Parent { // This class is technically not needed for the test to fail without the fix // (AsDeductionTypeDeserializer will crash in #buildFingerprints), but was // added to have more assertions on the subtypes values - private static final class AssertingTypeResolverBuilder extends ObjectMapper.DefaultTypeResolverBuilder { - + @SuppressWarnings("serial") + static final class AssertingTypeResolverBuilder + extends ObjectMapper.DefaultTypeResolverBuilder + { public AssertingTypeResolverBuilder() { super(ObjectMapper.DefaultTyping.NON_CONCRETE_AND_ARRAYS, BasicPolymorphicTypeValidator.builder().allowIfSubType(Parent.class).build());