gpt4 book ai didi

java - SonarLint - RedundantThrowsDeclarationCheck - 误报?

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:14:05 24 4
gpt4 key购买 nike

在下面的代码中,我从 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com