Skip to content

Make Optional annotation repeatable#1253

Merged
theigl merged 2 commits intoEsotericSoftware:masterfrom
www84:feature/repeatable-optional
Jan 29, 2026
Merged

Make Optional annotation repeatable#1253
theigl merged 2 commits intoEsotericSoftware:masterfrom
www84:feature/repeatable-optional

Conversation

@www84
Copy link
Contributor

@www84 www84 commented Jan 28, 2026

Currently, the Optional annotation is not repeatable. This pull request makes it repeatable with or-semantics. That is, if multiple Optional annotations exist for the same field, then the field is serialized if and only if at least one of the specified keys is in the kryo context.

This enables use cases where more than two serialization configurations are needed where we can use the Optional annotation without the necessity to use a FieldSerializer.

@www84 www84 force-pushed the feature/repeatable-optional branch from 680bda7 to ee2727d Compare January 28, 2026 18:58
Copy link
Collaborator

@theigl theigl left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @www84.

@theigl theigl merged commit 0ee0dab into EsotericSoftware:master Jan 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants