Open jpicklyk opened 2 months ago
When accessing the map you will need to use Class
instead of KClass
:
@Component(modules = [MyModule::class])
interface MyComponent {
fun myEnumStringMap() : Map<MyEnum, String>
fun stringsByNumberClassMap() : Map<Class<out Number>, String>
}
This is for backwards compatibility with KAPT, which will generate a Java stub for your map key like below:
@MapKey
@interface MyNumberClassKey {
Class<? extends Number> value();
}
I think we could add a better error message for users in this case though.
Reference: https://dagger.dev/dev-guide/multibindings.html
Kotlin - 2.0 KSP - 2.0.0-1.0.21 Hilt - 2.51.1
In an attempt to troubleshoot my multi-binding issues within my application, I am attempting to get a very simplistic example working from the Dagger documentation however I can not figure out how to get it to compile correctly. The usage of @JvmSuppressWildcards doesn't seem to fix the error:
The test code: