java - SonarQube giving unused private method issue for lambda usage -
i have following logic;
.. if(list.stream() .filter(myclass::isenabled) .filter(this::isactive) .count() > 0) { //do smth } .. private boolean isactive(myclass obj) { return bool; }
as see, isactive
method being used in stream structure, when build class on jenkins, unused private method issue sonarqube, says should delete redundant private method. bug? if not, why haven't still included lambda logic in analyze structure?
only solution is, obviously, this;
.filter(obj -> isactive(obj))
, destroys uniformity, , readability (imo).
this known issue of sonarqube java analyzer : https://jira.sonarsource.com/browse/sonarjava-583
this due lack of semantic analysis resolve method reference (thus identify method this::isactive refers to).
Comments
Post a Comment