Skip to content

Commit fa689ca

Browse files
committed
Minor additional tweak for #3654
1 parent c084b8a commit fa689ca

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -969,14 +969,18 @@ protected void _addExplicitAnyCreator(DeserializationContext ctxt,
969969
paramName = candidate.explicitParamName(0);
970970

971971
// If there's injection or explicit name, should be properties-based
972-
useProps = (paramName != null) || (injectId != null);
973-
if (!useProps && (paramDef != null)) {
974-
// One more thing: if implicit name matches property with a getter
975-
// or field, we'll consider it property-based as well
976-
977-
// 01-Dec-2022, tatu: [databind#3654] Consider `@JsonValue` to strongly
978-
// hint at delegation-based
979-
if (beanDesc.findJsonValueAccessor() == null) {
972+
useProps = (paramName != null);
973+
if (!useProps) {
974+
// Otherwise, `@JsonValue` suggests delegation
975+
if (beanDesc.findJsonValueAccessor() != null) {
976+
;
977+
} else if (injectId != null) {
978+
// But Injection suggests property-based (for legacy reasons?)
979+
useProps = true;
980+
} else if (paramDef != null) {
981+
// One more thing: if implicit name matches property with a getter
982+
// or field, we'll consider it property-based as well
983+
980984
// 25-May-2018, tatu: as per [databind#2051], looks like we have to get
981985
// not implicit name, but name with possible strategy-based-rename
982986
// paramName = candidate.findImplicitParamName(0);
@@ -1009,9 +1013,8 @@ private boolean _checkIfCreatorPropertyBased(BeanDescription beanDesc,
10091013
AnnotationIntrospector intr,
10101014
AnnotatedWithParams creator, BeanPropertyDefinition propDef)
10111015
{
1012-
// If explicit name, or inject id, property-based
1013-
if (((propDef != null) && propDef.isExplicitlyNamed())
1014-
|| (intr.findInjectableValue(creator.getParameter(0)) != null)) {
1016+
// If explicit name, property-based
1017+
if ((propDef != null) && propDef.isExplicitlyNamed()) {
10151018
return true;
10161019
}
10171020
// 01-Dec-2022, tatu: [databind#3654] Consider `@JsonValue` to strongly
@@ -1020,6 +1023,11 @@ private boolean _checkIfCreatorPropertyBased(BeanDescription beanDesc,
10201023
return false;
10211024
}
10221025

1026+
// Inject id considered property-based
1027+
// 01-Dec-2022, tatu: ... but why?
1028+
if (intr.findInjectableValue(creator.getParameter(0)) != null) {
1029+
return true;
1030+
}
10231031
if (propDef != null) {
10241032
// One more thing: if implicit name matches property with a getter
10251033
// or field, we'll consider it property-based as well

0 commit comments

Comments
 (0)