I got some trouble with a sonar
issue:
Remove this unused method parameter "messageId".
well my method looks like:
private static Optional<Status> getStatus(Member member, String messageId) {
return Optional.ofNullable(member)
.map(Member::getTraffic)
.map(Traffic::getSymlinks)
.map(messages -> messages
.stream()
.filter(message -> message.getMessageId().equals(messageId))
.findFirst()).flatMap(message -> message.map(Message::getStatus));
}
the messageId
is used inside the equals
of the filter.
It is no field. It is the method parameter.
Is that a sonar
bug or have I overlooked something?
We are using Sonar 5.6
Yeah, looks like a Bug . Seems this got recently addressed in SonarJava 5.0 (compatible with SonarQube 6.7+) which got released last December
https://jira.sonarsource.com/browse/SONARJAVA-2115
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With