Skip to content

Kotlin suspend functions return type is incorrect #2638

Closed
@abelmulq

Description

@abelmulq

In what version(s) of Spring AMQP are you seeing this issue?

3.0.9(for my project) & 3.2.3(latest version for demo)

Describe the bug

It is known in #1210 this library added a kotlin coroutine support. This is fine as long as the function doesn't return a value. But as soon as our function returns a value the return value type resolver in AbstractAdaptableMessageListener.asyncSuccess throws an error because it gets the invocation result type of java.lang.Object which can't be cast to ParameterizedType.

To Reproduce

A kotlin coroutine with a return value of String? annotated with @RabbitListener

Expected behavior

The return type must be correctly set in InvocationResult

Sample
https://github.com/abelmulq/spring-amqp-2638-sample

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions