Skip to content

Commit a546263

Browse files
committed
Improve error message for #1516, for 2.8.8: can not quite fix but hope to help with troubleshooting
1 parent ee265db commit a546263

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,16 @@ protected void addReferenceProperties(DeserializationContext ctxt,
636636
type = ((AnnotatedMethod) m).getParameterType(0);
637637
} else {
638638
type = m.getType();
639+
// 30-Mar-2017, tatu: Unfortunately it is not yet possible to make back-refs
640+
// work through constructors; but let's at least indicate the issue for now
641+
if (m instanceof AnnotatedParameter) {
642+
ctxt.reportBadTypeDefinition(beanDesc,
643+
"Can not bind back references as Creator parameters: type %s (reference '%s', parameter index #%d)",
644+
beanDesc.getBeanClass().getName(), name, ((AnnotatedParameter) m).getIndex());
645+
}
639646
}
640647
SimpleBeanPropertyDefinition propDef = SimpleBeanPropertyDefinition.construct(
641-
ctxt.getConfig(), m);
648+
ctxt.getConfig(), m, PropertyName.construct(name));
642649
builder.addBackReferenceProperty(name, constructSettableProperty(ctxt,
643650
beanDesc, propDef, type));
644651
}

src/main/java/com/fasterxml/jackson/databind/introspect/BasicBeanDescription.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public Map<String,AnnotatedMember> findBackReferenceProperties()
444444
// boolean hasIgnored = (_ignoredPropertyNames != null);
445445

446446
for (BeanPropertyDefinition property : _properties()) {
447-
/* 23-Sep-2014, tatu: As per [Databind#426], we _should_ try to avoid
447+
/* 23-Sep-2014, tatu: As per [databind#426], we _should_ try to avoid
448448
* calling accessor, as it triggers exception from seeming conflict.
449449
* But the problem is that _ignoredPropertyNames here only contains
450450
* ones ignored on per-property annotations, but NOT class annotations...

0 commit comments

Comments
 (0)