Pass dynamic serializer for Iterable content filtering by dlwldnjs1009 · Pull Request #5925 · FasterXML/jackson-databind (original) (raw)

@dlwldnjs1009

…iltering

IterableSerializer.serializeContents() passed _elementSerializer to _shouldSerializeElement(), but that field is null when element serializers are resolved dynamically (for example Iterable<Object>).

Sibling serializers such as CollectionSerializer and IteratorSerializer pass the locally resolved serializer instead. Align IterableSerializer with that behavior so serializer.isEmpty(ctxt, elem) is consulted for NON_EMPTY content inclusion.

Add regression test: JsonIncludeCollectionTest#testIterableNonEmptyWithWildcardElementType.

cowtowncoder

approved these changes Apr 17, 2026

@cowtowncoder

@cowtowncoder cowtowncoder changed the titleFollow-up to #5370: pass dynamic serializer for Iterable content filtering Pass dynamic serializer for Iterable content filtering

Apr 17, 2026

@cowtowncoder

@dlwldnjs1009 dlwldnjs1009 deleted the fix/iterable-serializer-filtering-3.1 branch

April 18, 2026 00:04

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})