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

[KSP] Missing value class in generics support for bindings #4096

Closed
VincentMasselis opened this issue Oct 12, 2023 · 6 comments
Closed

[KSP] Missing value class in generics support for bindings #4096

VincentMasselis opened this issue Oct 12, 2023 · 6 comments

Comments

@VincentMasselis
Copy link

VincentMasselis commented Oct 12, 2023

I used to work with kapt, I recently switched to 2.48.x with KSP which fired some issue on my build, thanks to your efforts 2 of them were fixed with recent releases.

Now I'm facing a new one, I suppose the new KSP compiler doesn't support value class when used with generics because I'm creating a binding which uses a UShort as one of the generics but the created .java class from KSP replaces the type UShort by the classic Short.
There is the exception:

error: incompatible types: ColumnAdapter<Short,Long> cannot be converted to ColumnAdapter<UShort,Long>
    return Preconditions.checkNotNullFromProvides(Module.INSTANCE.database(driver, uuidAdapter, sensorLocationAdapter, pressureAdapter, temperatureAdapter, uShortAdapter));

You can consult the complete code used on my repo here
The binding which fails here
And an example of a failed github action build.

If your confident enough, you can directly try to build the app by yourself by fetching the sources and by simply running a ./gradlew bundleDemo or any command you consider useful in this case, no environnement variable or plugin is required to run gradle command on this repo.

@VincentMasselis VincentMasselis changed the title [KSP] value class in generics support for bindings [KSP] Missing value class in generics support for bindings Oct 12, 2023
@kuanyingchou
Copy link
Collaborator

Hi, @VincentMasselis , thanks for reporting. I can reproduce it on my side. This looks like something we should fix as it was working with kapt. I'll look into this.

copybara-service bot pushed a commit to androidx/androidx that referenced this issue Oct 17, 2023
For inline value types used as type arguments we should generate boxed type names. For example:

For type `kotlin.collections.List<kotlin.UInt>`, we should generate `java.util.List<kotlin.UInt>` instead of `java.util.List<java.lang.Integer>`.

This also applies to generic value types. So for type `kotlin.collections.List<kotlin.Result<kotlin.Int>>`, we should generate `java.util.List<kotlin.Result<java.lang.Integer>>` instead of `java.util.List<java.lang.Object>`.

Bug: google/dagger#4096
Test: XTypeTest
Change-Id: I3fcd8cb8e5b8f81bb503eb278cd2b8d39b1e991e
@kuanyingchou
Copy link
Collaborator

Hi, @VincentMasselis , this should be fixed now. Could you give HEAD-SNAPSHOT a try?

@VincentMasselis
Copy link
Author

VincentMasselis commented Oct 24, 2023

Hello @kuanyingchou, the build seems to be OK ! I'll will try to run on my phone to check if it run as excepted

@VincentMasselis
Copy link
Author

Okay, I've run the app on my phone, everything works fine ! Thanks !

@mobilekosmos
Copy link

Any release date where this fix is coming?

@bcorso
Copy link

bcorso commented Nov 22, 2023

We're preparing for a release now. It may come out today if we get it done in time, otherwise it'll be out early next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants