Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3777

Improve S1128 (Unused imports) rule precision by relying on compiler warnings

    Details

    • Type: Improvement
    • Status: To be verified
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 7.0
    • Component/s: Frontend, Rules
    • Labels:
      None

      Description

      S1128 (Unused import) has been subject to many FN and FP in the past, this leads to a complex implementation still not perfect.

      ECJ is also detecting unused imports via warnings, the implementation of this ruleĀ could be greatly simplified thanks to them.

      The related compiler warning is UnusedImport, ID: 268435844.

      Also, as an improvement, only types used in JavaDoc are now excluded, and not the ones from simple comments.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael.gumowski Michael Gumowski
                Reporter:
                margarita.nedzelska Margarita Nedzelska
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated: