diff --git a/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializer.java b/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializer.java index 6741aa5a1d..5c68e687c2 100644 --- a/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializer.java +++ b/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializer.java @@ -79,9 +79,9 @@ protected BeanDeserializer(BeanDeserializer src, boolean ignoreAllUnknown) { } protected BeanDeserializer(BeanDeserializer src, - UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties, - boolean ignoreAllUnknown) { - super(src, unwrapHandler, renamedProperties, ignoreAllUnknown); + UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator propertyBasedCreator, + BeanPropertyMap renamedProperties, boolean ignoreAllUnknown) { + super(src, unwrapHandler, propertyBasedCreator, renamedProperties, ignoreAllUnknown); _propNameMatcher = _beanProperties.getNameMatcher(); _propsByIndex = _beanProperties.getNameMatcherProperties(); } @@ -131,8 +131,12 @@ public ValueDeserializer unwrappingDeserializer(DeserializationContext c if (uwHandler != null) { // delegate further unwraps, if any uwHandler = uwHandler.renameAll(ctxt, transformer); } + PropertyBasedCreator pbCreator = _propertyBasedCreator; + if (pbCreator != null) { + pbCreator = pbCreator.renameAll(ctxt, transformer); + } // and handle direct unwrapping as well: - return new BeanDeserializer(this, uwHandler, + return new BeanDeserializer(this, uwHandler, pbCreator, _beanProperties.renameAll(ctxt, transformer), true); } finally { _currentlyTransforming = null; } } @@ -446,7 +450,7 @@ private final Object _vanillaDeserializeWithUnknown(JsonParser p, return bean; } if (ix != PropertyNameMatcher.MATCH_UNKNOWN_NAME) { - return _handleUnexpectedWithin(p, ctxt, bean); + return bean; } p.nextToken(); handleUnknownVanilla(p, ctxt, bean, p.currentName()); diff --git a/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializerBase.java b/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializerBase.java index e7714f5c20..a144c8a003 100644 --- a/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializerBase.java +++ b/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializerBase.java @@ -298,8 +298,8 @@ protected BeanDeserializerBase(BeanDeserializerBase src, boolean ignoreAllUnknow * invoked and lookup indices need to be updated. */ protected BeanDeserializerBase(BeanDeserializerBase src, - UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties, - boolean ignoreAllUnknown) + UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator propertyBasedCreator, + BeanPropertyMap renamedProperties, boolean ignoreAllUnknown) { super(src._beanType); @@ -308,7 +308,6 @@ protected BeanDeserializerBase(BeanDeserializerBase src, _valueInstantiator = src._valueInstantiator; _delegateDeserializer = src._delegateDeserializer; _arrayDelegateDeserializer = src._arrayDelegateDeserializer; - _propertyBasedCreator = src._propertyBasedCreator; _backRefs = src._backRefs; _ignorableProps = src._ignorableProps; @@ -321,6 +320,7 @@ protected BeanDeserializerBase(BeanDeserializerBase src, _nonStandardCreation = src._nonStandardCreation; _unwrappedPropertyHandler = unwrapHandler; + _propertyBasedCreator = propertyBasedCreator; _beanProperties = renamedProperties; _needViewProcesing = src._needViewProcesing; diff --git a/src/main/java/tools/jackson/databind/deser/bean/BuilderBasedDeserializer.java b/src/main/java/tools/jackson/databind/deser/bean/BuilderBasedDeserializer.java index f672e59712..12e15aa98e 100644 --- a/src/main/java/tools/jackson/databind/deser/bean/BuilderBasedDeserializer.java +++ b/src/main/java/tools/jackson/databind/deser/bean/BuilderBasedDeserializer.java @@ -107,9 +107,10 @@ protected BuilderBasedDeserializer(BuilderBasedDeserializer src, boolean ignoreA } protected BuilderBasedDeserializer(BuilderBasedDeserializer src, - UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties, - boolean ignoreAllUnknown) { - super(src, unwrapHandler, renamedProperties, ignoreAllUnknown); + UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator pbCreator, + BeanPropertyMap renamedProperties, boolean ignoreAllUnknown + ) { + super(src, unwrapHandler, pbCreator, renamedProperties, ignoreAllUnknown); _buildMethod = src._buildMethod; _targetType = src._targetType; _propertyNameMatcher = _beanProperties.getNameMatcher(); @@ -167,9 +168,13 @@ public ValueDeserializer unwrappingDeserializer(DeserializationContext c if (uwHandler != null) { uwHandler = uwHandler.renameAll(ctxt, transformer); } + PropertyBasedCreator pbCreator = _propertyBasedCreator; + if (pbCreator != null) { + pbCreator = pbCreator.renameAll(ctxt, transformer); + } // and handle direct unwrapping as well: BeanPropertyMap props = _beanProperties.renameAll(ctxt, transformer); - return new BuilderBasedDeserializer(this, uwHandler, props, true); + return new BuilderBasedDeserializer(this, uwHandler, pbCreator, props, true); } finally { _currentlyTransforming = null; } } diff --git a/src/main/java/tools/jackson/databind/deser/jdk/ThrowableDeserializer.java b/src/main/java/tools/jackson/databind/deser/jdk/ThrowableDeserializer.java index 37df1af185..4dd5bc09c7 100644 --- a/src/main/java/tools/jackson/databind/deser/jdk/ThrowableDeserializer.java +++ b/src/main/java/tools/jackson/databind/deser/jdk/ThrowableDeserializer.java @@ -8,6 +8,7 @@ import tools.jackson.databind.deser.SettableBeanProperty; import tools.jackson.databind.deser.bean.BeanDeserializer; import tools.jackson.databind.deser.bean.BeanPropertyMap; +import tools.jackson.databind.deser.bean.PropertyBasedCreator; import tools.jackson.databind.deser.impl.UnwrappedPropertyHandler; import tools.jackson.databind.util.NameTransformer; @@ -53,9 +54,10 @@ public static ThrowableDeserializer construct(DeserializationContext ctxt, * Alternative constructor used when creating "unwrapping" deserializers */ protected ThrowableDeserializer(BeanDeserializer src, - UnwrappedPropertyHandler unwrapHandler, BeanPropertyMap renamedProperties, + UnwrappedPropertyHandler unwrapHandler, PropertyBasedCreator pbCreator, + BeanPropertyMap renamedProperties, boolean ignoreAllUnknown) { - super(src, unwrapHandler, renamedProperties, ignoreAllUnknown); + super(src, unwrapHandler, pbCreator, renamedProperties, ignoreAllUnknown); } @Override @@ -72,8 +74,12 @@ public ValueDeserializer unwrappingDeserializer(DeserializationContext c if (uwHandler != null) { uwHandler = uwHandler.renameAll(ctxt, transformer); } + PropertyBasedCreator pbCreator = _propertyBasedCreator; + if (pbCreator != null) { + pbCreator = pbCreator.renameAll(ctxt, transformer); + } // and handle direct unwrapping as well: - return new ThrowableDeserializer(this, uwHandler, + return new ThrowableDeserializer(this, uwHandler, pbCreator, _beanProperties.renameAll(ctxt, transformer), true); } diff --git a/src/test/java/tools/jackson/databind/tofix/UnwrappedWithCreator1467Test.java b/src/test/java/tools/jackson/databind/tofix/UnwrappedWithCreator1467Test.java index baa7004f98..f276694677 100644 --- a/src/test/java/tools/jackson/databind/tofix/UnwrappedWithCreator1467Test.java +++ b/src/test/java/tools/jackson/databind/tofix/UnwrappedWithCreator1467Test.java @@ -155,8 +155,6 @@ public void testUnwrappedWithJsonCreatorImplicitWithName() throws Exception assertEquals("value2", outer.getInner().getProperty2()); } - // [databind#1467]: works for 2.19+, fails for 3.0 for some reason - @JacksonTestFailureExpected @Test public void testUnwrappedWithTwoUnwrappedProperties() throws Exception { diff --git a/src/test/java/tools/jackson/databind/tofix/UnwrappedWithPrefixCreator1467Test.java b/src/test/java/tools/jackson/databind/tofix/UnwrappedWithPrefixCreator1467Test.java index 2fe43baf4c..5b59e274dc 100644 --- a/src/test/java/tools/jackson/databind/tofix/UnwrappedWithPrefixCreator1467Test.java +++ b/src/test/java/tools/jackson/databind/tofix/UnwrappedWithPrefixCreator1467Test.java @@ -10,7 +10,6 @@ import static org.junit.jupiter.api.Assertions.*; -// [databind#1467]: works for 2.19+, fails for 3.0 for some reason public class UnwrappedWithPrefixCreator1467Test extends DatabindTestUtil { static class Outer { @@ -32,7 +31,6 @@ public String getProperty() { private final ObjectMapper MAPPER = newJsonMapper(); - @JacksonTestFailureExpected @Test public void testUnwrappedWithJsonCreatorWithExplicitWithoutName() throws Exception {