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

False positive with Spring @Import annotations #120

Open
remy-tiitre opened this issue May 17, 2017 · 1 comment · May be fixed by #403
Open

False positive with Spring @Import annotations #120

remy-tiitre opened this issue May 17, 2017 · 1 comment · May be fixed by #403

Comments

@remy-tiitre
Copy link
Contributor

Gradle Lint reports:
warning unused-dependency this dependency is unused and can be removed
backend/build.gradle:70
compile 'io.springfox:springfox-bean-validators:2.6.1'

But in reality it is used at compile time like this:
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
...
@configuration
@EnableSwagger2
@import(BeanValidatorPluginsConfiguration.class)
public class SwaggerConfig {

and initially it was like this:
@configuration
@EnableSwagger2
@import(springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration.class)
public class SwaggerConfig {

So question is, does gradle lint know how to handle Spring @import annotations?

@dbolger
Copy link

dbolger commented Apr 17, 2024

Was also having this happen - this can be fixed by overriding the visitArray method in the DependencyAnnotationVisitor:

@Override
AnnotationVisitor visitArray(String name) {
    return this
}

This will subsequently call the readType method, determining the type, and calling readObjectName to find any references in use.

dbolger added a commit to dbolger/gradle-lint-plugin that referenced this issue Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants