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

Annotation on Types should be available in SyntaxTree

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.4
    • Component/s: Plugin
    • Labels:
      None

      Description

      import javax.annotation.Nonnull;
      
      ...
      
      Map<@Nonnull String, @Nonnull String> modulesMap = new HashMap<>();
      

      The annotation on the type parameter are correctly parsed but are absent from the syntax tree.

      This can result in false positive for the unused imports rule.

      see : http://sonarqube.15.x6.nabble.com/False-positive-unused-import-when-annotation-only-used-as-type-annotation-JSR308-td5033521.html

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.gumowski Michael Gumowski
              Reporter:
              benzonico OLD - Nicolas Peru
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: