FP on squid:S1481 when using nested Streams

java

(Daganar) #1

Description:
Unused variable warning when using variable within nested streams.

Sonar Version:

  • SonarLint IntelliJ 4.0.0.2916, Java 8

Minimum code example:

public void example() {
        final MutableInt count = new MutableInt(1);
        Stream.empty().forEach(item -> {
            Stream.of(item)
                .forEach(batch -> {
                    log.debug("Processing batch: {}", count.getAndIncrement());
                });
        });
    }