Binding Into Map With KClass TypeAnswer #1 100 %
KClass in an annotation, it actually gets compiled to Java's
Class. But the actual issue is the wildcard in
java.util.Map that the Kotlin compiler is generating.
@ViewModelKey is defined as
@MapKey annotation class ViewModelKey(val value: KClass
You'll need to define your injection site as
, @JvmSuppressWildcards Provider >
@JvmSuppressWildcards will prevent the compiler from generating wildcards.
I don't actually know, why wildcards are not supported by the Dagger compiler. You can see a similar issue here: Dagger 2: How to inject Map