forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[KSP] Intersection type bounds are not ordered correctly in generated factories #4345
Comments
copybara-service bot
pushed a commit
to androidx/androidx
that referenced
this issue
Jul 10, 2024
In Java a class type parameter bound should go before interface bounds. Here we make an extra sorting in KspTypeParameterElement.bounds to ensure that. Though this ordering could be different from the declaration order in Kotlin, it makes codegen easier and also makes the behavior a bit more consistent with KAPT. Test: XTypeParameterElementTest Bug: google/dagger#4345 Change-Id: Ifd766607dab08235df2565dc1b964d4293289af9
Thanks for the report! The fix is now merged to a library Dagger uses and should be included in the next Dagger release. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given this snippet in Kotlin
Dagger generates a factory in KSP like so
This code however doesn't compile, because while Kotlin allows for the class bound to be in any order, Java requires it to be the first type. That is to say, the generated code should actually be.
The text was updated successfully, but these errors were encountered: