Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube doesn't see method reference

I have private method in my class.

public class MyClass {
     public void method(){
         ....
         List<String> filteredPaths = Arrays.asList(paths).stream().filter(this::validate).collect(Collectors.toList());
         ....
     }
     private boolean validate(String path){
        ...
     }
}

I see major issue:

Private method 'validate' is never used.

Is this issue known?

How to fix it? workarounds?

like image 743
gstackoverflow Avatar asked Sep 14 '15 14:09

gstackoverflow


1 Answers

It is a known bug: please see http://jira.sonarsource.com/browse/SONARJAVA-583

To provide more context here : This unused private method is relying on an old implementation and is (at time of writing my answer) being migrating to rely on semantic analysis and not only bytecode analysis.

like image 118
benzonico Avatar answered Sep 23 '22 08:09

benzonico