I have the following snippet in my dagger 2 module
@Singleton
@Provides
@ElementsIntoSet
fun providesQueries(foo: Foo): Set<Foo>{
val queries = LinkedHashSet<Foo>()
queries.add(foo)
return queries
}
I try to inject into in this way
@Inject lateinit var foo: Set<Foo>
But dagger shows an error which says that Dagger cannot provides java.util.Set without @Provides or @Produces method.
I did the same in java and it worked. Does somebody know why is it failing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…