SonarQube 7.7 (but same issue occured with version 6.9 and following)
Scanner 3.3
error observed
Remove the redundant '!unknownSymbol!' thrown exception declaration(s).
steps to reproduce
For some reasons the code have methods which throws multiple checked exceptions.
The problem is that it seems that the scanner is a bit lost when parsing it.
Here is an example of code which generates the problem:
All theses two exceptions extends Exception. They are declared in implemented interface. Nothing who justify the “unknownSymbol”.
My assumptions are: the scanner get lost somehow -> read an unknownSymbol and then is not able to determine with accuracy if the rule should succeed or not.
Any help is welcome thank you in advance
potential workaround
I have to mark manually as wrong positive…
indeed this is a false positive. I created ticket to fix it https://jira.sonarsource.com/browse/SONARJAVA-3111 . While this will avoid raising of the issue, it might be also interesting to understand why the exception types are not resolved properly. Were all the dependencies provided to the analyzer? What kind of scanner (maven, gradle, …) do you use?
I use the standalone scanner delivered by sonar version 3.3
Regarding the question about dependencies.
This is a maven project everything is located in target/ dir do I have to explicitely says to sonar go read target/libs/*.jar folder ?
No, with maven scanner everything should be automatic, you don’t need to configure any properties unless there is something peculiar about the way you build your project.