Skip to content

Detect premature use of @Inject properties #18

@jzbrooks

Description

@jzbrooks

Hilt rewrites methods to inject android components at a certain point (early) in their lifecycles, so premature access of @Inject properties will usually result in a kotlin.UninitializedPropertyAccessException or an NRE in Java. https://dagger.dev/hilt/components#component-lifetimes

For example, if a Fragment references an @Inject property in its initializer (or implicitly does so by using it to initialize another property), the app will crash.

We should detect premature use of @Inject properties. The detector should be compatible with Java and Kotlin.

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