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

FP on S1065 when usage/declaration of labels is wrong in case of nested labels

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0
    • Component/s: CFG, Rules, Semantic
    • Labels:
      None

      Description

      Original implementation of the label handling for labeled, break and continue statements does not handle nesting of class or lambdas.

      This leads to definition of wrong usages and declaration node in the corresponding symbol.

        void foo() {
          i: { // FP on S1065, symbol is used
            new Object() {
              void bar() {
                i: 
                  break i;
              }
            }.bar();
            break i; // wrong symbol. should be the one at the beginning of the foo() method but resolved to the one defined in bar()
          }
        }
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: