I have a KeyMap like this:
@Target(AnnotationTarget.FUNCTION)
@MapKey
annotation class JsonSerializerKey(val value: KClass<*>)
and want to provide them as:
// #1 doesn't work
Map<KClass<*>, @JvmSuppressWildcards KSerializer<*>>
// #2 works
Map<Class<*>, @JvmSuppressWildcards KSerializer<*>>
Dagger can't find and collect provided items when requesting KClass
(with below error) but it works with Class
.
error: [Dagger/MissingBinding] java.util.Map<kotlin.reflect.KClass<?>,kotlinx.serialization.KSerializer<?>> cannot be provided without an @Provides-annotated method.
How can I achieve map of KClass
in dagger multibinding?
P.S: All provided JsonSerializerKey
items are written in Kotlin.