-
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] Crash with primitive-named assisted parameters #3995
Comments
Thanks for reporting this! In theory, I think this is likely an issue for any parameter name in a user's sources that Dagger ends up using in generated sources, though it may be the case that AssistedInject is where this is easiest to hit. It mostly works for KAPT today because KAPT either completely elides elements that have java keywords as names, or it just renames them. However, given that Dagger is still generating Java source, I'm leaning towards just reporting an error in these cases (i.e. it wouldn't be allowed in KAPT or KSP). I'll talk it over with the team, but also if you have concerns with this feel free to state them. |
Interesting! Good to know this is easy to fix on the consumer side, I completely missed that this was the parameter name and thought it was about the parameter type at first. |
Using keywords as parameter names has been working with KAPT because KAPT just renames the parameters to something that is valid Java in the generated Java stubs. However, in order to support this in KSP we need to switch over to use `XExecutableParameterElement#jvmName` rather than `XExecutableParameterElement#name`. This CL also requires updates from XProcessing, so I've updated Dagger's XProcessing jars as well. Fixes #3995: Allow kotlin source to use java keywords as parameter names in KSP RELNOTES=Fixed #3995: Allow kotlin source to use java keywords as parameter names in KSP PiperOrigin-RevId: 553376843
Using keywords as parameter names has been working with KAPT because KAPT just renames the parameters to something that is valid Java in the generated Java stubs. However, in order to support this in KSP we need to switch over to use `XExecutableParameterElement#jvmName` rather than `XExecutableParameterElement#name`. This CL also requires updates from XProcessing, so I've updated Dagger's XProcessing jars as well. Fixes #3995: Allow kotlin source to use java keywords as parameter names in KSP RELNOTES=Fixed #3995: Allow kotlin source to use java keywords as parameter names in KSP PiperOrigin-RevId: 553376843
Using keywords as parameter names has been working with KAPT because KAPT just renames the parameters to something that is valid Java in the generated Java stubs. However, in order to support this in KSP we need to switch over to use `XExecutableParameterElement#jvmName` rather than `XExecutableParameterElement#name`. This CL also requires updates from XProcessing, so I've updated Dagger's XProcessing jars as well. Fixes #3995: Allow kotlin source to use java keywords as parameter names in KSP RELNOTES=Fixed #3995: Allow kotlin source to use java keywords as parameter names in KSP PiperOrigin-RevId: 553376843
The following code snippet crashes the KSP processor with Dagger version 2.47
Trace
The text was updated successfully, but these errors were encountered: