You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion! I think this Lint check is a good idea and I think it would make sense for something like this to be in Hilt. However, due to our current priorities, I'm not sure we're going to have time to take this PR right now, so I think maybe the best thing to do would be to put this rule into your project first and then we can look at upstreaming it into Hilt later in the future?
I'll leave this open as a feature request until then, but just wanted to be upfront about what we're able to take on right now. Thanks!
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 akotlin.UninitializedPropertyAccessException
or an NRE in Java. https://dagger.dev/hilt/components#component-lifetimesFor 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.
The text was updated successfully, but these errors were encountered: