Skip to content

Refine generic type management in AbstractMessageWriterResultHandler #30214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kantis opened this issue Mar 28, 2023 · 0 comments
Closed

Refine generic type management in AbstractMessageWriterResultHandler #30214

Kantis opened this issue Mar 28, 2023 · 0 comments
Assignees
Labels
status: backported An issue that has been backported to maintenance branches theme: kotlin An issue related to Kotlin support type: bug A general bug
Milestone

Comments

@Kantis
Copy link

Kantis commented Mar 28, 2023

From @sdeleuze on slack:

Looks like there is a bug in AbstractMessageWriterResultHandler#writeBody for those use cases with a confusion between leveraging bodyParameter versus actualParam. Could you please create an issue in https://github.com/spring-projects/spring-framework/issues pinging me (@sdeleuze) and linking your repro?

Reproduction repository at https://github.com/Kantis/kxs-repro

The bug

When using KotlinX serialization with Webflux, we expect that any combination of presence/absence of suspend functions and ResponseEntity to play nicely together.

As the repro demonstrates, that is not the case. KotlinX serialization is only used in one of the 4 possible setups:

Suspend with ResponseEntity ❌
Suspend without ResponseEntity ✅
No suspend with ResponseEntity ❌
No suspend without ResponseEntity ❌

@sdeleuze sdeleuze self-assigned this Mar 28, 2023
@sdeleuze sdeleuze added the theme: kotlin An issue related to Kotlin support label Mar 28, 2023
@sdeleuze sdeleuze added this to the 6.0.8 milestone Mar 28, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.3.x labels Mar 28, 2023
@sdeleuze sdeleuze changed the title KotlinX Serialization not properly used for serializing HTTP response with certain combination of suspend/non-suspend and ResponseEntity Refine generic type management in AbstractMessageWriterResultHandler Mar 29, 2023
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 29, 2023
This commit updates AbstractMessageWriterResultHandler#writeBody in
order to use the declared bodyParameter instead of
ResolvableType.forInstance(body) when the former has unresolvable
generics.

Closes spring-projectsgh-30214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: backported An issue that has been backported to maintenance branches theme: kotlin An issue related to Kotlin support type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants