``` @Module abstract Bar { @Module compan...
# dagger
y
Copy code
@Module
abstract Bar {

    @Module
    companion object {
        @Provides @Named("foo") @JvmStatic
        fun providesFoo(): Foo { ... }
    }
}
When trying to inject
Foo
in a field (with
@field:Named("foo")
), it’s not working, I have to create another class and put the
providesFoo
method outside the companion (working fine in an
object
class)