Skip to content

Add tests for kotlin interop#92

Merged
malczuuu merged 2 commits intomainfrom
malformed-primitives
Mar 14, 2026
Merged

Add tests for kotlin interop#92
malczuuu merged 2 commits intomainfrom
malformed-primitives

Conversation

@malczuuu
Copy link
Collaborator

@malczuuu malczuuu commented Mar 14, 2026

For better Kotlin interop, it would be good to allow returning proper deserialization/binding errors, while trying to use non-nullable fields. Because simple (Int, Long etc.) non-nullable fields are represented in bytecode as primitives, following exceptions were identified at the moment.

  • Jackson will throw KotlinInvalidNullException (subclass of InvalidNullException) if trying to deserialize to non-nullable field.
  • Jackson will throw MismatchedInputException if trying to use invalid value for a primitive (like a "text" for an int).

Decided to use Type mismatch error instead of Validation failed as it is better suited and in fact does not involve validation - this is a deserialization failure.

Note that all of these can also occur in normal Java application, so the benefits of this change are not limited to Kotlin apps only.

Edit: changes were applied to #93, so primitive deserialization errors are fixed in 1.2.x version as well. This PR includes only tests for Kotlin interop.

@malczuuu malczuuu force-pushed the malformed-primitives branch 3 times, most recently from 3aaa537 to 25238be Compare March 14, 2026 17:58
@malczuuu malczuuu added the target: latest Pull request to latest version label Mar 14, 2026
@malczuuu malczuuu force-pushed the malformed-primitives branch from 25238be to b180ed6 Compare March 14, 2026 21:03
@malczuuu malczuuu changed the title Return error details for primitive type bindings Add tests for kotlin interop Mar 14, 2026
@malczuuu malczuuu marked this pull request as ready for review March 14, 2026 22:19
@malczuuu malczuuu merged commit 693327d into main Mar 14, 2026
3 of 4 checks passed
@malczuuu malczuuu deleted the malformed-primitives branch March 14, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target: latest Pull request to latest version

Development

Successfully merging this pull request may close these issues.

1 participant