SonarQube在java分析过程中不同地依赖于方法名称和行为”;“利用资源进行尝试”;
看起来命名在声纳检查中产生了问题。是否低于预期SonarQube在java分析过程中不同地依赖于方法名称和行为”;“利用资源进行尝试”;,java,sonarqube,static-analysis,Java,Sonarqube,Static Analysis,看起来命名在声纳检查中产生了问题。是否低于预期 public class Main { public static void main(String[] args) { try (A a = new A()) { //failing a.createEmptySheet().newMethod(); //fine a.method1().newMethod();
public class Main {
public static void main(String[] args) {
try (A a = new A()) {
//failing
a.createEmptySheet().newMethod();
//fine
a.method1().newMethod();
//failing
a.newMethod().method1();
} catch (Exception e) {
}
}
static class A implements AutoCloseable {
A newMethod() {
return this;
}
A method1() {
return this;
}
A createEmptySheet() {
return this;
}
@Override
public void close() { }
}
}
移动方法不会改变任何东西,问题与以前的方法相同。例如,我可以移动“a.method1().newMethod();”,在任何地方都可以,在“class a”中的方法也是一样
SonarQube version: 7.9.2
openjdk version "11.0.6" 2020-01-14