(#) Redundant 'field:' used for Dagger qualifier annotation !!! WARNING: Redundant 'field:' used for Dagger qualifier annotation This is a warning. Id : `FieldSiteTargetOnQualifierAnnotation` Summary : Redundant 'field:' used for Dagger qualifier annotation Severity : Warning Category : Correctness Platform : Any Vendor : Google Identifier : com.google.dagger:dagger-lint Contact : https://github.com/google/dagger Feedback : https://github.com/google/dagger/issues Min : Lint 7.3 and 7.4 Compiled : Lint 7.1 Artifact : [com.google.dagger:dagger-lint](com_google_dagger_dagger-lint.md.html) Since : 2.40.2 Affects : Kotlin and Java files and test sources Editing : This check runs on the fly in the IDE editor It's redundant to use 'field:' site-targets for qualifier annotations. (##) Including !!! This is not a built-in check. To include it, add the below dependency to your project. ``` // build.gradle.kts implementation("com.google.dagger:dagger-lint:2.56.2") // build.gradle implementation 'com.google.dagger:dagger-lint:2.56.2' // build.gradle.kts with version catalogs: implementation(libs.dagger.lint) # libs.versions.toml [versions] dagger-lint = "2.56.2" [libraries] # For clarity and text wrapping purposes the following declaration is # shown split up across lines, but in TOML it needs to be on a single # line (see https://github.com/toml-lang/toml/issues/516) so adjust # when pasting into libs.versions.toml: dagger-lint = { module = "com.google.dagger:dagger-lint", version.ref = "dagger-lint" } ``` 2.56.2 is the version this documentation was generated from; there may be newer versions available. [Additional details about com.google.dagger:dagger-lint](com_google_dagger_dagger-lint.md.html). (##) Suppressing You can suppress false positives using one of the following mechanisms: * Using a suppression annotation like this on the enclosing element: ```kt // Kotlin @Suppress("FieldSiteTargetOnQualifierAnnotation") fun method() { problematicStatement() } ``` or ```java // Java @SuppressWarnings("FieldSiteTargetOnQualifierAnnotation") void method() { problematicStatement(); } ``` * Using a suppression comment like this on the line above: ```kt //noinspection FieldSiteTargetOnQualifierAnnotation problematicStatement() ``` * Using a special `lint.xml` file in the source tree which turns off the check in that folder and any sub folder. A simple file might look like this: ```xml <?xml version="1.0" encoding="UTF-8"?> <lint> <issue id="FieldSiteTargetOnQualifierAnnotation" severity="ignore" /> </lint> ``` Instead of `ignore` you can also change the severity here, for example from `error` to `warning`. You can find additional documentation on how to filter issues by path, regular expression and so on [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html). * In Gradle projects, using the DSL syntax to configure lint. For example, you can use something like ```gradle lintOptions { disable 'FieldSiteTargetOnQualifierAnnotation' } ``` In Android projects this should be nested inside an `android { }` block. * For manual invocations of `lint`, using the `--ignore` flag: ``` $ lint --ignore FieldSiteTargetOnQualifierAnnotation ...` ``` * Last, but not least, using baselines, as discussed [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).