@@ -482,6 +482,8 @@ protected void addBeanProps(DeserializationContext ctxt,
482
482
if (anySetter != null ) {
483
483
builder .setAnySetter (constructAnySetter (ctxt , beanDesc , anySetter ));
484
484
} else {
485
+ // 23-Jan-2018, tatu: although [databind#1805] would suggest we should block
486
+ // properties regardless, for now only consider unless there's any setter...
485
487
Collection <String > ignored2 = beanDesc .getIgnoredPropertyNames ();
486
488
if (ignored2 != null ) {
487
489
for (String propName : ignored2 ) {
@@ -509,10 +511,9 @@ protected void addBeanProps(DeserializationContext ctxt,
509
511
for (BeanPropertyDefinition propDef : propDefs ) {
510
512
SettableBeanProperty prop = null ;
511
513
512
- /* 18-Oct-2013, tatu: Although constructor parameters have highest precedence,
513
- * we need to do linkage (as per [databind#318]), and so need to start with
514
- * other types, and only then create constructor parameter, if any.
515
- */
514
+ // 18-Oct-2013, tatu: Although constructor parameters have highest precedence,
515
+ // we need to do linkage (as per [databind#318]), and so need to start with
516
+ // other types, and only then create constructor parameter, if any.
516
517
if (propDef .hasSetter ()) {
517
518
AnnotatedMethod setter = propDef .getSetter ();
518
519
JavaType propertyType = setter .getParameterType (0 );
@@ -526,7 +527,13 @@ protected void addBeanProps(DeserializationContext ctxt,
526
527
AnnotatedMethod getter = propDef .getGetter ();
527
528
if (getter != null ) {
528
529
if (useGettersAsSetters && _isSetterlessType (getter .getRawType ())) {
529
- prop = constructSetterlessProperty (ctxt , beanDesc , propDef );
530
+ // 23-Jan-2018, tatu: As per [databind#1805], need to ensure we don't
531
+ // accidentally sneak in getter-as-setter for `READ_ONLY` properties
532
+ if (builder .hasIgnorable (propDef .getName ())) {
533
+ ;
534
+ } else {
535
+ prop = constructSetterlessProperty (ctxt , beanDesc , propDef );
536
+ }
530
537
} else if (!propDef .hasConstructorParameter ()) {
531
538
PropertyMetadata md = propDef .getMetadata ();
532
539
// 25-Oct-2016, tatu: If merging enabled, might not need setter.
0 commit comments