Skip to content

Commit 4216a53

Browse files
committed
Minor change to ReferenceTypeSerializer wrt reference serializer (primary vs secondary)
1 parent 09f3858 commit 4216a53

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/com/fasterxml/jackson/databind/ser/std/ReferenceTypeSerializer.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Base implementation for values of {@link ReferenceType}.
2121
* Implements most of functionality, only leaving couple of abstract
22-
* methods for sub-classes to implement
22+
* methods for sub-classes to implement.
2323
*
2424
* @since 2.8
2525
*/
@@ -454,9 +454,12 @@ private final JsonSerializer<Object> _findCachedSerializer(SerializerProvider pr
454454
// [databind#1673] Must ensure we will resolve all available type information
455455
// so as not to miss generic declaration of, say, `List<GenericPojo>`...
456456
JavaType fullType = provider.constructSpecializedType(_referredType, rawType);
457-
ser = provider.findContentValueSerializer(fullType, _property);
457+
// 23-Oct-2019, tatu: I _think_ we actually need to consider referenced
458+
// type as "primary" to allow applying various handlers -- done since 2.11
459+
460+
ser = provider.findPrimaryPropertySerializer(fullType, _property);
458461
} else {
459-
ser = provider.findContentValueSerializer(rawType, _property);
462+
ser = provider.findPrimaryPropertySerializer(rawType, _property);
460463
}
461464
if (_unwrapper != null) {
462465
ser = ser.unwrappingSerializer(_unwrapper);
@@ -474,6 +477,6 @@ private final JsonSerializer<Object> _findSerializer(SerializerProvider provider
474477
// 15-Jan-2017, tatu: ... possibly because we need to access "secondary" serializer,
475478
// not primary (primary being one for Reference type itself, not value)
476479
// return provider.findTypedValueSerializer(type, true, prop);
477-
return provider.findContentValueSerializer(type, prop);
480+
return provider.findPrimaryPropertySerializer(type, prop);
478481
}
479482
}

0 commit comments

Comments
 (0)