Skip to content

Commit

Permalink
Fix #2486
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 4, 2020
1 parent c994ede commit db1401a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 3 additions & 1 deletion release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -1053,11 +1053,13 @@ Endre Stølsvik (stolsvik@github)

Máté Rédecsi (rmatesz@github)
* Reported #953: i-I case convertion problem in Turkish locale with case-insensitive deserialization
(2.11.0)
(2.11.0)

Ville Koskela (vjkoskela@github)
* Contributed #2487: BeanDeserializerBuilder Protected Factory Method for Extension
(2.11.0)
* Reported #2486: Builder Deserialization with JsonCreator Value vs Array
(2.11.1)

Fitz (Joongsoo.Park) (joongsoo@github)
* Contributed #2511: Add `SerializationFeature.WRITE_SELF_REFERENCES_AS_NULL`
Expand Down
5 changes: 5 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Project: jackson-databind
=== Releases ===
------------------------------------------------------------------------

2.11.1 (not yet released)

#2486: Builder Deserialization with JsonCreator Value vs Array
(reported by Ville K)

2.11.0 (26-Apr-2020)

#953: i-I case conversion problem in Turkish locale with case-insensitive deserialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ public abstract class BeanDeserializerBase
protected PropertyBasedCreator _propertyBasedCreator;

/**
* Flag that is set to mark "non-standard" cases; where either
* we use one of non-default creators, or there are unwrapped
* values to consider.
* Flag that is set to mark cases where deserialization from Object value
* using otherwise "standard" property binding will need to use non-default
* creation method: namely, either "full" delegation (array-delegation does
* not apply), or properties-based Creator method is used.
*<p>
* Note that flag is somewhat mis-named as it is not affected by scalar-delegating
* creators; it only has effect on Object Value binding.
*/
protected boolean _nonStandardCreation;

Expand Down Expand Up @@ -213,13 +217,16 @@ protected BeanDeserializerBase(BeanDeserializerBuilder builder,
: injectables.toArray(new ValueInjector[injectables.size()]);
_objectIdReader = builder.getObjectIdReader();

// 02-May-2020, tatu (from @vjkoskela's comment): [databind#2486] is due to
// determination that existence of array-delegate alone means that use of
// "default creator + POJO" -- is not available. But this is not actually
// known before seeing Array value (unlike with more general "any" delegate).
// 02-May-2020, tatu: This boolean setting is only used when binding from
// Object value, and hence does not consider "array-delegating" or various
// scalar-delegation cases. It is set when default (0-argument) constructor
// is NOT to be used when binding an Object value (or in case of
// POJO-as-array, Array value).
_nonStandardCreation = (_unwrappedPropertyHandler != null)
|| _valueInstantiator.canCreateUsingDelegate()
|| _valueInstantiator.canCreateUsingArrayDelegate()
// [databind#2486]: as per above, array-delegating creator should not be considered
// as doing so will prevent use of Array-or-standard-Object deserialization
// || _valueInstantiator.canCreateUsingArrayDelegate()
|| _valueInstantiator.canCreateFromObjectWith()
|| !_valueInstantiator.canCreateUsingDefault()
;
Expand Down

2 comments on commit db1401a

@vjkoskela
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the tests be moved out of failing and into the main test codebase?

@cowtowncoder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vjkoskela Good point, yes. Forgot to do that.

Please sign in to comment.