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<>();
strings.add(color);
strings.add(name);
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