[KSP] KSP mode does not check for `@Provides` on interface methods
Opened this issue · 1 comments
ZacSweers commented
This is a slight behavior change from apt to KSP. The following snippet is an error in apt but has no error in KSP
@Module
interface DaggerModule1 {
@Provides fun provideString(): String = ""
}
It may be intentional if the intention is to support the default value, but I can't find any docs that confirm this.
bcorso commented
Thanks for reporting! No, this was not intentional.
In KAPT, this would turn into an abstract method + static DefaultImpls
implementation in the Java stub, so I think things just happened to fail since we don't allow @Provides
on an abstract method. My guess is that KSP represents this case more accurately and the method isn't considered abstract due to the default implementation.
In any case, I think the "fix" for this to make it behave the same as KAPT (i.e. fail the build).