-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Return correct return type for Kotlin suspending functions in MethodParameter. #1694
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
Conversation
5e796c8 to
f95759d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary, already the default via package level @NonNullApi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessary, already the default via package level @NonNullApi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolve() can return null but Class<?> getReturnType(Method method) is expected to return non null values. Maybe we should use resolve(Class<?> fallback) variant or assert the returned class is not null before returning it if we are sure that will be the case here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assertion added. This should never be null.
f95759d to
089e495
Compare
…arameter.
Return type for Kotlin suspending functions (as returned by
MethodParameter#getParameterType and MethodParameter#getgenericReturnType
methods) is incorrect. The true return type is the generic parameter
of the last parameter of the method.
This change modifies the behaviour of the aforementioned
methods so that they work correctly for all cases.
Issue: SPR-16515
089e495 to
821481a
Compare
|
After reviewing more in detail this PR, I am not sure yet Coroutines should be managed at But I am not sure this is the right way to support that, because Coroutines are more high-level than just a wrapper. As described here, So what are the alternatives? Coroutines are more related to Any thoughts @jhoeller @rstoyanchev @konrad-kaminski ? |
|
Merged via this revised commit which leverages Kotlin reflection that now supports Coroutines. Thanks @konrad-kaminski for this contribution. |
Return type for Kotlin suspending functions (as returned by
MethodParameter#getParameterTypeandMethodParameter#getgenericReturnTypemethods) is incorrect. The true return type is the generic parameter of the last parameter of the method.This change modifies the behaviour of the aforementioned methods so that they work correctly for all cases.
Issue: SPR-16515