A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2402 below:

[java] CloseResource possible false positive with Primitive Streams · Issue #2402 · pmd/pmd · GitHub

Affects PMD Version: 6.22.0

Rule:

CloseResource

Description:

In Issue #1922 only java.util.Stream got handled, now the same false/positives occure on IntStream, LongStream and DoubleStream

Code Sample demonstrating the issue:

public class PmdPrimitiveStreamReproducer {

    public void reproduceIntStream() {
        IntStream iStream = IntStream.of(1).filter(i -> i < 5);
        iStream.anyMatch(i -> i < 5);
    }


    public void reproduceLongStream() {
        LongStream lStream = LongStream.of(1).filter(i -> i < 5);
        lStream.anyMatch(i -> i < 5);
    }


    public void reproduceDoubleStream() {
        DoubleStream dStream = DoubleStream.of(1).filter(i -> i < 5);
        dStream.anyMatch(i -> i < 5);
    }

}

Expected outcome: no violation should be thrown

Running PMD through: [ Gradle | IntelliJ]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4