@@ -441,9 +441,11 @@ protected void addBeanProps(DeserializationContext ctxt,
441
441
BeanDescription beanDesc , BeanDeserializerBuilder builder )
442
442
throws JsonMappingException
443
443
{
444
- final SettableBeanProperty [] creatorProps =
445
- builder .getValueInstantiator ().getFromObjectArguments (ctxt .getConfig ());
446
444
final boolean isConcrete = !beanDesc .getType ().isAbstract ();
445
+ final SettableBeanProperty [] creatorProps = isConcrete
446
+ ? builder .getValueInstantiator ().getFromObjectArguments (ctxt .getConfig ())
447
+ : null ;
448
+ final boolean hasCreatorProps = (creatorProps != null );
447
449
448
450
// 01-May-2016, tatu: Which base type to use here gets tricky, since
449
451
// it may often make most sense to use general type for overrides,
@@ -490,8 +492,8 @@ protected void addBeanProps(DeserializationContext ctxt,
490
492
}
491
493
}
492
494
}
493
- final boolean useGettersAsSetters = ( ctxt .isEnabled (MapperFeature .USE_GETTERS_AS_SETTERS )
494
- && ctxt .isEnabled (MapperFeature .AUTO_DETECT_GETTERS )) ;
495
+ final boolean useGettersAsSetters = ctxt .isEnabled (MapperFeature .USE_GETTERS_AS_SETTERS )
496
+ && ctxt .isEnabled (MapperFeature .AUTO_DETECT_GETTERS );
495
497
496
498
// Ok: let's then filter out property definitions
497
499
List <BeanPropertyDefinition > propDefs = filterBeanProps (ctxt ,
@@ -531,7 +533,7 @@ protected void addBeanProps(DeserializationContext ctxt,
531
533
}
532
534
// 25-Sep-2014, tatu: No point in finding constructor parameters for abstract types
533
535
// (since they are never used anyway)
534
- if (isConcrete && propDef .hasConstructorParameter ()) {
536
+ if (hasCreatorProps && propDef .hasConstructorParameter ()) {
535
537
/* If property is passed via constructor parameter, we must
536
538
* handle things in special way. Not sure what is the most optimal way...
537
539
* for now, let's just call a (new) method in builder, which does nothing.
@@ -548,8 +550,13 @@ protected void addBeanProps(DeserializationContext ctxt,
548
550
}
549
551
}
550
552
if (cprop == null ) {
551
- ctxt .reportMappingException ("Could not find creator property with name '%s' (in class %s)" ,
552
- name , beanDesc .getBeanClass ().getName ());
553
+ List <String > n = new ArrayList <>();
554
+ for (SettableBeanProperty cp : creatorProps ) {
555
+ n .add (cp .getName ());
556
+ }
557
+ ctxt .reportBadPropertyDefinition (beanDesc , propDef ,
558
+ "Could not find creator property with name '%s' (known Creator properties: %s)" ,
559
+ name , n );
553
560
continue ;
554
561
}
555
562
if (prop != null ) {
0 commit comments