-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
UnusedImports false positive for annotation used in another annotation attributes (with type resolution) #3246
Comments
Have you enabled type resolution? This rule has a mixed behavior (see #2994) based on wether you have Type Resolution enabled or not: https://detekt.github.io/detekt/type-resolution.html I'm adding a test with your snippet and it seems to work fine: |
Yes I’ve use type resolution. Hm it seems I missing some important detail... |
Yup you're right. I've updated the test with a correct version. Unfortunately we don't have support for compiling snippets when there is more than one file involved. To be fair, the snippet you posted initially was also invalid. You have to instantiate an annotation when passing it as parameter to another annotation: |
Closing this, since tests have been added for the initial code snippet. If new false-positives for this rule appear, please feel free to open a new issue. Thanks! |
Expected Behavior
When an annotation used in another annotation attributes that annotation import should not marked as unused.
Steps to Reproduce
In such code
import somepkg.AnnotationA
is reported as unused.Context
Your Environment
The text was updated successfully, but these errors were encountered: