evant / kotlin-inject

Dependency injection lib for kotlin
Apache License 2.0
1.14k stars 51 forks source link

Support qualifieres in multibinds map keys and set elements. #409

Open evant opened 6 days ago

evant commented 6 days ago

As part of https://github.com/evant/kotlin-inject/issues/253 we expect to support placing a qualifier on a typealias as a replacement to using the typealias is a qualifier directly, ex: typealias MyString = @Named("name") String. Right now this causes and issue with multibinds as you can't use in the Map or Set type.

abstract val myStringMap: Map<MyString, String>

runs into

e: [ksp] Qualifier: @Named(value=MyString) can only be applied to the outer type

Since we treat these Map and Set here specially we can support the nested qualifier in these cases

sergeshustoff commented 4 days ago

Should it be applicable to both key and value?

evant commented 3 days ago

Good question, I don't actually know that the current behavior is for map multibinds with the same key type but different value types.