https://kotlinlang.org logo
#android
Title
# android
l

leosan

07/17/2017, 9:51 AM
Hi anyone could help me with how to use Kotlin + Dagger2 + Generics? I have a
@Provides Foo<*>
and then
@Provides Presenter(Foo<Bar>)
But this gives me an error
Foo<Bar> cannot be provided without an @Inject or @Provides-annotated method
😞 I've tried this already
@Provides Presenter(Foo<@JvmSupressWildcards Bar>)
but without Success
d

dragas

07/17/2017, 12:36 PM
Dagger doesn't do well with generics. Personally I inject wrappers instead.
class Wrapper : Foo<Bar>
l

leosan

07/17/2017, 12:50 PM
Yeah I ended creating an Interface 😕, thanks
I was just wondering because the same code works in Java
but I understand now