Reputation: 4103
I have implemented some lines of codes as:
if(condition){
Class a = new Class();
method(a.b(), a.c());
}else{
method(null, null);
}
Sonar fails on protected b and protected c as unused. Please suggest me any solution regarding the same.
Thanks in advance
Upvotes: 1
Views: 718
Reputation: 3121
Rule "Unused Protected Method" has been deprecated in version 4.1
, and dropped in version 4.2
of the SonarQube Java Analyzer plugin, due to its poor reliability (numerous false positives). We are consequently not maintaining this rule anymore.
If these issues are wrong, like you said and as it probably is, simply mark them as "False Positive" (if you are using LTS 5.6
version of SonarQube), or "Won't Fix". There is nothing to fix and SonarQube is doing a mistake.
Note that updating the Java Analyzer Plugin to version 4.2 will make the issue disappear, but only because the rule itself will disappear from available rules.
Upvotes: 2