Skip to content

Decode kotlin.Unit suspend return values to Unit.INSTANCE instead of null - #3558

Merged
velo merged 1 commit into
masterfrom
fix/kotlin-unit-decode
Sep 4, 2026
Merged

Decode kotlin.Unit suspend return values to Unit.INSTANCE instead of null#3558
velo merged 1 commit into
masterfrom
fix/kotlin-unit-decode

Conversation

@velo

@velo velo commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

  • `feign-kotlin`'s `CoroutineFeignTest` never actually ran under surefire 3.5.6 (confirmed on a pristine clone of master: `Tests run: 0` for that module). Surefire 3.6.0 (see build(deps): Bump maven-surefire-plugin.version from 3.5.6 to 3.6.0 #3556) fixes JUnit Platform test discovery for this class and in doing so exposed a real bug.
  • `InvocationContext.isVoidType()` treats `kotlin.Unit` the same as Java `void`/`Void` and returns `null` for it. But Kotlin's `Unit` is non-nullable, so a suspend function declared to return `Unit` needs the singleton `Unit.INSTANCE`, not `null`.
  • Adds a reflective resolution (feign-core has no compile-time dependency on kotlin-stdlib) that returns `Unit.INSTANCE` specifically for `kotlin.Unit` return types, leaving `void`/`Void` behavior unchanged.

Test plan

  • `CoroutineFeignTest` (6/6) passes with surefire 3.6.0
  • `feign-core`'s full suite (729 tests) unaffected
  • `mvn verify` on `core`,`kotlin` (including japicmp binary-compat check) passes

…null

Signed-off-by: Marvin Froeder <velo.br@gmail.com>
@velo
velo merged commit 7a93ec4 into master Sep 4, 2026
4 checks passed
@velo
velo deleted the fix/kotlin-unit-decode branch September 4, 2026 15:56
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.

1 participant