Bug - unused method parameter in lambda expression.

55 views
Skip to first unread message

kamilb...@gmail.com

unread,
Oct 20, 2017, 4:54:14 AM10/20/17
to SonarQube
Hi, when a method parameter is used only as lambda parameter, then sonar implies that this parameter is unused.

Sonar version: Version 6.4 (build 25310)

private User deleteUserPrivileges(final User user, final Set<String> privilegesToDelete) {
 
if (user == null) {
   
return null;
 
}
  user
.getPrivileges()
   
.stream()
   
.removeIf(m -> privilegesToDelete.contains(m.getAsString()));
 
return user;
}


I am getting the following sonar error:
Remove this unused method parameter "privilegesToDelete".

Michael Gumowski

unread,
Oct 30, 2017, 1:27:07 PM10/30/17
to kamilb...@gmail.com, SonarQube
Hello,

Can you please specify which version of the SonarJava plugin is installed on your SQ instance?
I would also need a self-contained code snippet in order to reproducer the issue and start investigation. Your case seems close from the case depicted in SONARJAVA-2115, but I self-contained example would help me to tell more.

Cheers,
Michael

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/a4dc4455-604a-4c3d-ab49-1bbc8052d0eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Michael Gumowski | SonarSource
Software Developer, Language Team
https://www.sonarsource.com
Reply all
Reply to author
Forward
0 new messages