SonarLint - RedundantThrowsDeclarationCheck - 误报?
SonarLint - RedundantThrowsDeclarationCheck - false positive?
在下面的代码中,我从 Foo1Exception
上的 squid:RedundantThrowsDeclarationCheck
规则(在 throws
关键字后面)收到警告:Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
Foo.java:
public class Foo {
public static boolean bar(final String test) throws Foo1Exception, Foo2Exception {
if (test.startsWith("a")) {
throw new Foo1Exception();
} else if (test.startsWith("b")) {
throw new Foo2Exception();
} else if (test.startsWith("c")) {
return true;
}
return false;
}
}
两个异常都在单独的文件中声明:
Foo1Exception.java:
class Foo1Exception extends Exception {}
Foo2Exception.java:
class Foo2Exception extends Exception {}
我认为这是误报,不是吗?
同样有趣的是:我只在 IntelliJ IDEA 的 SonarLint 插件中没有直接在 SonarQube(Web 界面)中收到此消息。
有什么想法吗?
我正在使用:IntelliJ IDEA 2016.2.2; SonarLint 2.3(具有工作服务器绑定);声纳管 5.6; SonarQube Java 插件 4.0; Java8
这似乎已在 SonarLint 2.3.1 中修复。
在下面的代码中,我从 Foo1Exception
上的 squid:RedundantThrowsDeclarationCheck
规则(在 throws
关键字后面)收到警告:Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
Foo.java:
public class Foo {
public static boolean bar(final String test) throws Foo1Exception, Foo2Exception {
if (test.startsWith("a")) {
throw new Foo1Exception();
} else if (test.startsWith("b")) {
throw new Foo2Exception();
} else if (test.startsWith("c")) {
return true;
}
return false;
}
}
两个异常都在单独的文件中声明:
Foo1Exception.java:
class Foo1Exception extends Exception {}
Foo2Exception.java:
class Foo2Exception extends Exception {}
我认为这是误报,不是吗? 同样有趣的是:我只在 IntelliJ IDEA 的 SonarLint 插件中没有直接在 SonarQube(Web 界面)中收到此消息。 有什么想法吗?
我正在使用:IntelliJ IDEA 2016.2.2; SonarLint 2.3(具有工作服务器绑定);声纳管 5.6; SonarQube Java 插件 4.0; Java8
这似乎已在 SonarLint 2.3.1 中修复。