nowinandroid
nowinandroid copied to clipboard
Restrict @Dispatcher qualifier to constructor parameters
Description
This change would adds @Target(AnnotationTarget.VALUE_PARAMETER) to the @Dispatcher qualifier to explicitly limit its usage to constructor/function parameters. This removes Kotlin’s use-site target warnings, improves clarity. I believe Kotlin 2.2 uses param by default it makes it more predictable in Hilt. (Alternatively, we can add @param e.g @param:Dispatcher(IO), but having @Target reduces boilerplate)
Any suggestion for writing a test for this?
@Target(AnnotationTarget.PROPERTY_SETTER)
@Qualifier
@Retention(RUNTIME)
annotation class Dispatcher(val niaDispatcher: NiaDispatchers)
enum class NiaDispatchers {
Default,
IO,
}