Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect @Inject constructors on framework components #21

Open
jzbrooks opened this issue Feb 20, 2023 · 1 comment
Open

Detect @Inject constructors on framework components #21

jzbrooks opened this issue Feb 20, 2023 · 1 comment

Comments

@jzbrooks
Copy link
Contributor

Fragments, Activities, etc should use @AndroidEntryPoint to perform member injection. @Inject constructs won't work here since the framework instantiates the components and dagger has no opportunity to provide constructor parameters.

The main value of this check is an explanation to engineers new to dagger why this is wrong. A quick fix should be doable for this. The detector and fix should work for both Java and Kotlin source.

@jzbrooks
Copy link
Contributor Author

Ideally, this would be in the hilt library jar, because this rule (specifically the error description and quick fix) are only applicable if hilt is on the classpath.

google/dagger#3749

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant