Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Conversation

@czp3009
Copy link
Contributor

@czp3009 czp3009 commented Jan 9, 2022

If a controller method is kotlin coroutine suspend fun, it's return type will be Continuation<? super Bar>

In this situation, returnType.getActualTypeArguments()[0] will be ? super Bar, it's a WildcardType, and lower bounds is the exact return type Bar.

So we need to dig out the type Bar from the original wrapped Continuation type.

If just skip the WildcardType, suspend fun will be considered as a method which return Object.

Adding a lot of @typehint is very bad for migrating old projects to spring native, I want to analyze directly in spring aot to get the actual return value of suspend fun.

@pivotal-cla
Copy link

@czp3009 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 9, 2022
@pivotal-cla
Copy link

@czp3009 Thank you for signing the Contributor License Agreement!

@sdeleuze sdeleuze self-requested a review January 10, 2022 11:37
@sdeleuze
Copy link
Contributor

Interesting proposal that could maybe fix #769 more easily than originally expected, could you please update webflux-kotlin to remove those manual hints and see if that works?

Also could you please update the PR to perform this type inferience only when this type is a Continuation to avoid side effects and keep an optimal footprint when that's not required?

@sdeleuze sdeleuze added type: compatibility Native image compatibility issue status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 10, 2022
@sdeleuze sdeleuze modified the milestone: 0.11.2 Jan 10, 2022
@sdeleuze
Copy link
Contributor

Merged with additional refinements via #769, thanks a lot for this great PR!

@sdeleuze sdeleuze closed this Jan 10, 2022
@sdeleuze sdeleuze removed the status: waiting-for-feedback We need additional information before we can continue label Jan 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type: compatibility Native image compatibility issue

Development

Successfully merging this pull request may close these issues.

4 participants