Skip to content
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

@Async does not support Unit? return type #31881

Closed
HappyHepo opened this issue Dec 21, 2023 · 3 comments
Closed

@Async does not support Unit? return type #31881

HappyHepo opened this issue Dec 21, 2023 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) 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

@HappyHepo
Copy link

HappyHepo commented Dec 21, 2023

Affects: 6.0.13


When using @Async with Kotlin functions, it is not possible to use Unit?-returning functions.
kotlin.Unit corresponds to void in Java (https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/), but the nullable version is not recognized when submitting the task: https://github.com/spring-projects/spring-framework/blob/main/spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionAspectSupport.java#L295

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 21, 2023
@sdeleuze
Copy link
Contributor

Could you please provide a reproducer as an attached archive or a link to a repository?

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Dec 21, 2023
@sdeleuze sdeleuze self-assigned this Dec 21, 2023
@sdeleuze sdeleuze added the theme: kotlin An issue related to Kotlin support label Dec 21, 2023
@HappyHepo
Copy link
Author

While creating a reproduction, I narrowed the issue down. It actually does only occur when returning Unit?, I updated the original issue accordingly.
minimal reproduction

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 21, 2023
@sdeleuze
Copy link
Contributor

Interesting, thanks for sharing, I will have a deeper look.

@sdeleuze sdeleuze added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Dec 22, 2023
@sdeleuze sdeleuze added this to the 6.1.3 milestone Dec 22, 2023
@sdeleuze sdeleuze added the for: backport-to-6.0.x Marks an issue as a candidate for backport to 6.0.x label Dec 22, 2023
@github-actions github-actions bot added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-6.0.x Marks an issue as a candidate for backport to 6.0.x labels Dec 22, 2023
@sdeleuze sdeleuze changed the title @Async does not support kotlin.Unit as return type @Async does not support Unit? return type Dec 22, 2023
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Dec 22, 2023
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) 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

3 participants