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

Incorrect return type of Kotlin suspending functions [SPR-16515] #21058

Closed
spring-issuemaster opened this issue Feb 19, 2018 · 2 comments
Closed

Incorrect return type of Kotlin suspending functions [SPR-16515] #21058

spring-issuemaster opened this issue Feb 19, 2018 · 2 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Feb 19, 2018

Konrad Kamiński opened SPR-16515 and commented

The return type of Kotlin suspending functions (as returned via getParameterType() and getGenericParameterType() methods of MethodParameter) is incorrect. The true return type is actually a generic type of the last parameter of the method.

This issue affects spring-kotlin-coroutine library, specifically issues #10 and #14.

This issue is related to #19975.


Affects: 5.0.3

Issue Links:

  • #19975 Add support for Kotlin coroutines
  • #21073 Cache, allow custom wrapper types other than java.util.Optional

Referenced from: pull request #1694

2 votes, 6 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 17, 2018

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 7, 2018

Sébastien Deleuze commented

Since we have not been able to progress on the question raised on the PR, and given the fact I would like to propose supporting Coroutines for 5.2, I think it is better to target 5.2 as well for that one.

@spring-issuemaster spring-issuemaster added this to the 5.2 RC1 milestone Jan 11, 2019
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Feb 18, 2019
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in ReactiveAdapterRegistry
 - Support Coroutines for `WebFlux` annotated controllers
 - Fix return type of Kotlin suspending functions (spring-projectsgh-21058)

See spring-projectsgh-19975
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Feb 18, 2019
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in ReactiveAdapterRegistry
 - Support Coroutines for `WebFlux` annotated controllers
 - Fix return type of Kotlin suspending functions (spring-projectsgh-21058)

See spring-projectsgh-19975
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Feb 18, 2019
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in ReactiveAdapterRegistry
 - Support Coroutines for `WebFlux` annotated controllers
 - Fix return type of Kotlin suspending functions (spring-projectsgh-21058)

See spring-projectsgh-19975
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Feb 18, 2019
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in ReactiveAdapterRegistry
 - Support Coroutines for `WebFlux` annotated controllers
 - Fix return type of Kotlin suspending functions (spring-projectsgh-21058)

See spring-projectsgh-19975
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Feb 18, 2019
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in ReactiveAdapterRegistry
 - Support Coroutines for `WebFlux` annotated controllers
 - Fix return type of Kotlin suspending functions (spring-projectsgh-21058)

See spring-projectsgh-19975
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Feb 18, 2019
This commit is the first part of a more complete Coroutines
support coming in Spring Framework 5.2. It introduces suspendable
Kotlin extensions for Mono based methods in WebFlux classes like
WebClient, ServerRequest, ServerResponse as well as a Coroutines
router usable via `coRouter { }`.

Coroutines extensions use `await` prefix or `AndAwait` suffix,
and most are using names close to their Reactive counterparts,
except `exchange` in `WebClient.RequestHeadersSpec`
which translates to `awaitResponse`.

Upcoming expected changes are:
 - Leverage `Dispatchers.Unconfined` (Kotlin/kotlinx.coroutines#972)
 - Expose extensions for `Flux` based API (Kotlin/kotlinx.coroutines#254)
 - Introduce interop with `CoroutineContext` (Kotlin/kotlinx.coroutines#284)
 - Support Coroutines in `ReactiveAdapterRegistry`
 - Support Coroutines for WebFlux annotated controllers
 - Fix return type of Kotlin suspending functions (spring-projectsgh-21058)

See spring-projectsgh-19975
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Mar 6, 2019
Before this commit, the return type for Kotlin suspending functions
(as returned by MethodParameter#getParameterType and
MethodParameter#getGenericReturnType methods) was incorrect.

This change leverages Kotlin reflection instead of Java one
to return the correct type.

Closes spring-projectsgh-21058
@sdeleuze sdeleuze closed this in 9302cb2 Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.