False negatives about the rule RSPEC 2692

Hi, I found two false negatives about the rule RSPEC-2692. SonarQube should have reported two warnings in last two lines, but it doesn’t. I think SonarQube is a powerful tool and easy to detect them based on current design. Thanks.

    public static final int literal1 = 0;
    public void foo() {
      String color = "blue";
      String name = "ishmael";
      List<String> strings = new ArrayList<>();
      final int literal2 = 0;
      if (strings.indexOf(color) > literal1) {}  // should report a warning in this line
      if (strings.indexOf(color) > literal2) {}  // should report a warning in this line

Version: Latest

Hello @Belle

Thanks for reporting this, it is indeed a false negative. Ticket created: SONARJAVA-4250.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.