简体   繁体   中英

SonarLint - RedundantThrowsDeclarationCheck - false positive?

In the following code I get a warning from the squid:RedundantThrowsDeclarationCheck rule on the Foo1Exception (behind the throws keyword): Remove the redundant '!unknownSymbol!' thrown exception declaration(s). 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;
    }

}

Both exceptions are decrlared in seperate files:

Foo1Exception.java:

class Foo1Exception extends Exception {}

Foo2Exception.java:

class Foo2Exception extends Exception {}

I think this is a false positive, isn't it? Also interesting: I don't get this message directly in SonarQube (web interface) only in the SonarLint plugin in IntelliJ IDEA. Any Ideas?

I'm using: IntelliJ IDEA 2016.2.2; SonarLint 2.3 (with working server binding); SonarQube 5.6; SonarQube Java Plugin 4.0; Java 8

这似乎是在SonarLint 2.3.1修复的

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM