You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the process of switching from KAPT to KSP, using Dagger 2.50. I have a top-level app component for my Android app which contains a @Named field, like this:
@AppScope
@Component(modules = [...])
interfaceAppComponent {
val someInjectedString:String
@Named("Something") get
}
The compile failed with: DaggerAppComponent.java:109: error: AppComponentImpl is not abstract and does not override abstract method getSomeInjectedString() in AppComponent private static final class AppComponentImpl implements AppComponent {
The generated code in DaggerAppComponent.java is missing the getter for the named field. All other fields and functions have implementations. This works correctly under KAPT.
The text was updated successfully, but these errors were encountered:
I have a similar issue with injecting a named parameter
class DefaultClient @Inject constructor(
...,
@Named(BuildConfig.LIBRARY_PACKAGE_NAME) private val loggingInterceptor: LoggingInterceptor
) : HttpClient {
causes
[ksp] dagger.internal.codegen.base.DaggerSuperficialValidation$ValidationException$UnexpectedException:
Validation trace:
=> element (CLASS): ...DefaultClient
=> element (CONSTRUCTOR): DefaultClient(...,com.optomany.axept.pro.log.LoggingInterceptor)
=> element (PARAMETER): loggingInterceptor
=> annotation type: javax.inject.Named
at dagger.internal.codegen.base.DaggerSuperficialValidation$ValidationException.from(DaggerSuperficialValidation.java:527)
...
Caused by: java.lang.ClassCastException: class dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.DefaultKspType cannot be cast to class java.lang.String (dagger.spi.internal.shaded.androidx.room.compiler.processing.ksp.DefaultKspType is in unnamed module of loader java.net.URLClassLoader @58c23d18; java.lang.String is in module java.base of loader 'bootstrap')
@ggrell thanks for reporting, we'll try to take a look at this and figure out why the getter method is missing in KSP.
In the meantime, you should be able to just swap this over to a normal function, which I would recommend anyway since it's cleaner and more intuitive. For example
@henrik-klev that is a different issue -- it's a duplicate of #4051. You can see that issue for the current workaround, or the more general workaround here #4049 (comment)
In the process of switching from KAPT to KSP, using Dagger 2.50. I have a top-level app component for my Android app which contains a
@Named
field, like this:The compile failed with:
DaggerAppComponent.java:109: error: AppComponentImpl is not abstract and does not override abstract method getSomeInjectedString() in AppComponent private static final class AppComponentImpl implements AppComponent {
The generated code in
DaggerAppComponent.java
is missing the getter for the named field. All other fields and functions have implementations. This works correctly under KAPT.The text was updated successfully, but these errors were encountered: