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 170ab04dcc..2d9af4571c 100644 --- a/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializer.java +++ b/src/main/java/tools/jackson/databind/deser/bean/BeanDeserializer.java @@ -498,8 +498,6 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t return bean; } final Object bean = _valueInstantiator.createUsingDefault(ctxt); - // [databind#631]: Assign current value, to be accessible by custom deserializers - p.assignCurrentValue(bean); // First: do we have native Object Ids (like YAML)? if (p.canReadObjectId()) { @@ -524,6 +522,9 @@ else if (_objectIdReader != null && p.hasTokenId(JsonTokenId.ID_END_OBJECT)) { // should we check what exactly it is... ? return bean; } + // [databind#631]: Assign current value, to be accessible by custom serializers + // [databind#4184]: but only if we have at least one property + p.assignCurrentValue(bean); if (_needViewProcesing) { Class view = ctxt.getActiveView(); if (view != null) {