Skip to content

Remove @JsonCreator annotation from Kotlin types#917

Merged
jiholee17 merged 1 commit intomasterfrom
fix/jsoncreator-jackson-2.21
Jan 28, 2026
Merged

Remove @JsonCreator annotation from Kotlin types#917
jiholee17 merged 1 commit intomasterfrom
fix/jsoncreator-jackson-2.21

Conversation

@jiholee17
Copy link
Collaborator

@jiholee17 jiholee17 commented Jan 27, 2026

Jackson 2.21 introduced stricter detection for constructors and now flags the generated Kotlin 0-arg constructor as being annotated with @JsonCreator in addition to the constructor defined in the data class, leading to a Conflicting property-based creators JsonMappingException when the object mapper is used at runtime.

This PR removes the @JsonCreator annotation entirely from generated Kotlin data classes. @JsonProperty is kept for each field to maintain the mapping from JSON field to parameters. With this change, Jackson uses the explicitly defined non-0-arg constructor as the creator and avoids the conflicting creators exception.

@jiholee17 jiholee17 merged commit 3fe305a into master Jan 28, 2026
3 checks passed
@jiholee17 jiholee17 deleted the fix/jsoncreator-jackson-2.21 branch January 28, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants