Status Update
Comments
za...@gmail.com <za...@gmail.com> #2
Sorry the check is Instantiatable
, not Instantiated
jo...@google.com <jo...@google.com>
za...@gmail.com <za...@gmail.com> #4
Another related issue is ViewConstructor lint checks, which fail similarly when using assisted injection
gh...@google.com <gh...@google.com>
gh...@google.com <gh...@google.com> #5
I submitted Change I9d6ba5bb9 to suppress this Lint warning when some constructor has the @Inject
annotation.
For more niche usages of AppComponentFactory
, I think disabling the Instantiatable
check is the right solution.
Thanks for the report!
za...@gmail.com <za...@gmail.com> #6
Awesome! Should I file a separate request for doing the same (with @AssistedInject) in View constructors?
gh...@google.com <gh...@google.com> #7
Are you referring to the ViewConstructor
If I misunderstood, please file a bug and link it here; thanks!
za...@gmail.com <za...@gmail.com> #8
zs...@salesforce.com <zs...@salesforce.com> #9
@matthew is there a way to see which AGP/lint version this landed in?
gh...@google.com <gh...@google.com> #10
This should be in Studio Hedgehog Canary 1
(We have an internal tool that maps the ChangeId to a release version. I don't think this is easy to compute externally.)
za...@gmail.com <za...@gmail.com> #11
@Matthew this sorted stalled halfway (the viewconstructor lint is still missing this support). Can you help route that issue I linked above?
Description
When using minSdk 28+ and
AppComponentFactory
, we can set up activities to use DI + constructor injection. However, theInstantiated
lint check does not properly handle this well and is ultimately going to force us to disable it entirely.It would be nice if this lint was more configurable or intelligent, such as recognizing
@Inject
-annotated constructors.Note that this exists in the latest AGP alpha too (
7.4.0-alpha09
at the time of writing)