square / anvil

A Kotlin compiler plugin to make dependency injection with Dagger 2 easier.
Apache License 2.0
1.29k stars 75 forks source link

fix interface based @ContributesSubcomponent.Factory in KSP #931

Closed gabrielittner closed 3 months ago

gabrielittner commented 3 months ago

Currently any @ContributesSubcomponent.Factory that is an interface fails the KSP codegen with "A factory must have exactly one abstract function returning the subcomponent ...". The getAllFunctions() returns non abstract methods like equals/hashCode for interfaces, so we need to filter for interfaces as well.