Remove this unused method parameter in Sonar

I am having problems with the problem sonar:

Remove this unused parameter of the "messageId" method.

Well my method looks like this:

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));
}

messageIdused inside filter equalsfilter. This is not a field. This is a parameter of the method.

Is this a mistake sonaror am I missing something? We are using Sonar 5.6

+4
source share
1 answer

Yes, it seems to be a mistake. This seems to have been recently reviewed in SonarJava 5.0 (compatible with SonarQube 6.7+), which was released last December.

https://jira.sonarsource.com/browse/SONARJAVA-2115

+5
source

Source: https://habr.com/ru/post/1694216/


All Articles