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

gabrielfv

07/23/2020, 5:32 PM
If I have an interface like so
Copy code
interface Foo<A : Bar, B : Baz>
And a series of implementations which I want to bind into a dagger map, is it possible to bind them like so?
Copy code
@Binds
@IntoMap
@FooKey(ExampleFoo::class)
fun bindExampleFoo(exampleFoo: ExampleFoo): Foo<*, *>
To me, if I have a key like this:
Copy code
@MapKey
annotation class FooKey(val value: KClass<out Foo<*, *>>)
It will fail me with a weird error message:
Copy code
error: incompatible types: Class<ExampleFoo> cannot be converted to Class<? extends Foo<?,?>>
I find that somewhat odd, because to me it looks like
ExampleFoo
“is a”
? extends Foo<?, ?>
.
4 Views