Skip to content

Commit

Permalink
Minor streamlining
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 20, 2024
1 parent 8976fef commit e80b337
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,32 +218,30 @@ public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
boolean preventMerge = (property == null)
&& Boolean.FALSE.equals(ctxt.getConfig().getDefaultMergeable(Object.class));
// 31-Aug-2024: [databind#4680] Allow custom key deserializer for Object.class deserialization
KeyDeserializer keyDeser = ctxt.findKeyDeserializer(ctxt.constructType(Object.class), property);
boolean isStdKeyDeserImpl = ClassUtil.isJacksonStdImpl(keyDeser);
KeyDeserializer customKeyDeser = ctxt.findKeyDeserializer(ctxt.constructType(Object.class), property);
// but make sure to ignore standard/default key deserializer (perf optimization)
if (customKeyDeser != null) {
if (ClassUtil.isJacksonStdImpl(customKeyDeser)) {
customKeyDeser = null;
}
}
// 20-Apr-2014, tatu: If nothing custom, let's use "vanilla" instance,
// simpler and can avoid some of delegation
if ((_stringDeserializer == null) && (_numberDeserializer == null)
&& (_mapDeserializer == null) && (_listDeserializer == null)
&& getClass() == UntypedObjectDeserializer.class
&& isStdKeyDeserImpl) {
&& (customKeyDeser == null)
&& getClass() == UntypedObjectDeserializer.class) {
return UntypedObjectDeserializerNR.instance(preventMerge);
}

UntypedObjectDeserializer untyped = null;
UntypedObjectDeserializer deser = this;
if (preventMerge != _nonMerging) {
untyped = new UntypedObjectDeserializer(this, preventMerge);
}
if (!isStdKeyDeserImpl) {
if (untyped == null) {
untyped = new UntypedObjectDeserializer(this, keyDeser);
} else {
untyped = new UntypedObjectDeserializer(untyped, keyDeser);
}
deser = new UntypedObjectDeserializer(deser, preventMerge);
}
if (untyped != null) {
return untyped;
if (customKeyDeser != null) {
deser = new UntypedObjectDeserializer(deser, customKeyDeser);
}
return this;
return deser;
}

/*
Expand Down

0 comments on commit e80b337

Please sign in to comment.