@@ -314,6 +314,9 @@ protected void collectAll()
314
314
}
315
315
_addInjectables (props );
316
316
317
+ // 27-Dec-2019, tatu: [databind#2527] initial re-linking by Field needs to
318
+ // be applied before other processing
319
+
317
320
// Remove ignored properties, first; this MUST precede annotation merging
318
321
// since logic relies on knowing exactly which accessor has which annotation
319
322
_removeUnwantedProperties (props );
@@ -372,9 +375,8 @@ protected void _addFields(Map<String, POJOPropertyBuilder> props)
372
375
*/
373
376
final boolean pruneFinalFields = !_forSerialization && !_config .isEnabled (MapperFeature .ALLOW_FINAL_FIELDS_AS_MUTATORS );
374
377
final boolean transientAsIgnoral = _config .isEnabled (MapperFeature .PROPAGATE_TRANSIENT_MARKER );
375
-
378
+
376
379
for (AnnotatedField f : _classDef .fields ()) {
377
- String implName = ai .findImplicitPropertyName (f );
378
380
// @JsonValue?
379
381
if (Boolean .TRUE .equals (ai .hasAsValue (f ))) {
380
382
if (_jsonValueAccessors == null ) {
@@ -391,17 +393,26 @@ protected void _addFields(Map<String, POJOPropertyBuilder> props)
391
393
_anySetterField .add (f );
392
394
continue ;
393
395
}
396
+ String implName = ai .findImplicitPropertyName (f );
394
397
if (implName == null ) {
395
398
implName = f .getName ();
396
399
}
400
+
401
+ // [databind#2527: Field-based renaming can be applied early (here),
402
+ // or at a later point, but probably must be done before pruning
403
+ // final fields. So let's do it early here
404
+ final PropertyName rename = ai .findRenameByField (_config , f , _propNameFromSimple (implName ));
405
+ if (rename != null ) {
406
+ // todo
407
+ }
408
+
397
409
PropertyName pn ;
398
410
399
411
if (_forSerialization ) {
400
- /* 18-Aug-2011, tatu: As per existing unit tests, we should only
401
- * use serialization annotation (@JsonSerialize) when serializing
402
- * fields, and similarly for deserialize-only annotations... so
403
- * no fallbacks in this particular case.
404
- */
412
+ // 18-Aug-2011, tatu: As per existing unit tests, we should only
413
+ // use serialization annotation (@JsonSerialize) when serializing
414
+ // fields, and similarly for deserialize-only annotations... so
415
+ // no fallbacks in this particular case.
405
416
pn = ai .findNameForSerialization (f );
406
417
} else {
407
418
pn = ai .findNameForDeserialization (f );
@@ -434,7 +445,7 @@ protected void _addFields(Map<String, POJOPropertyBuilder> props)
434
445
}
435
446
/* [databind#190]: this is the place to prune final fields, if they are not
436
447
* to be used as mutators. Must verify they are not explicitly included.
437
- * Also: if 'ignored' is set, need to included until a later point, to
448
+ * Also: if 'ignored' is set, need to include until a later point, to
438
449
* avoid losing ignoral information.
439
450
*/
440
451
if (pruneFinalFields && (pn == null ) && !ignored
0 commit comments