作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在下面的代码中,我从 squid:RedundantThrowsDeclarationCheck
规则中收到关于 Foo1Exception
的警告(在 throws
关键字后面):删除多余的“!unknownSymbol!”抛出的异常声明。
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(具有工作服务器绑定(bind)); Sonar 管 5.6; SonarQube Java 插件 4.0; Java 8
最佳答案
这似乎已在 SonarLint 2.3.1 中修复.
关于java - SonarLint - RedundantThrowsDeclarationCheck - 误报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39019543/
在下面的代码中,我从 squid:RedundantThrowsDeclarationCheck 规则中收到关于 Foo1Exception 的警告(在 throws 关键字后面):删除多余的“!un
我是一名优秀的程序员,十分优秀!