在字符串比较中使用 == 而不是 equals 不会被 Sonar 捕获

Rip*_*ips 5 java sonarqube sonarlint sonarlint-intellij

我有以下代码:

String s1 = "a";
    String s2 = "a";
    if (s1 == s2) {
        System.out.println("string not equal");
    }
Run Code Online (Sandbox Code Playgroud)

当我使用 SonarLint 分析这段代码时,它没有被捕获。我希望这应该被以下规则所捕获

鱿鱼:S1698-“==”和“!=”当“等于”被覆盖时不应使用

我已经使用 Sonar Qube 7.0 在独立模式和连接模式下检查了这一点。有人知道为什么声纳会这样吗?

- - - - - - - -编辑 - - - - - - - - -

同样的情况也发生在:

Integer x= 500;
Integer y= 500;
if (x==y){
            System.out.println("not equal");
        }
Run Code Online (Sandbox Code Playgroud)