Skip to content

Restrict @Dispatcher qualifier to constructor parameters #2001

@pitoszud

Description

@pitoszud

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,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions