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

CheckVerifier expect too many issues when a //Noncompliant comment is placed after a multi-variable declaration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.3
    • Component/s: Java API
    • Labels:
      None

      Description

      When placing a //Noncompliant comment in the line before a multi-variable declaration, the CheckVerifier identifies too many expected issues.

      Due to the form of the AST, the verifier reads the comment once per variable, instead of only once. For a multi-variable declaration with N variables, we then end up with N expected issues, while there is only one.

      class A {
      
        private int a; // Noncompliant
      
        private int b, c;
      }
      

        Attachments

          Activity

            People

            Assignee:
            michael.gumowski Michael Gumowski
            Reporter:
            michael.gumowski Michael Gumowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: