A RetroSearch Logo

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

Search Query:

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

[java] AvoidInstantiatingObjectsInLoops - false positive with Collections · Issue #3088 · pmd/pmd · GitHub

Could you please reopen this? I still experience the false positive with 6.30.0, even when using an example adapted from your tests:

public Collection<Car> checkCollection() {
    Collection<Car> thisIsACar = new ArrayList<>();
    for(int i = 0; i < 3; ++i) {
        thisIsACar.add(new Car());
    }
    return thisIsACar;
}

private static class Car {
}

The array example did not cause a false positive warning with 6.29.0, and still does not with 6.30.0. For created objects as shown above both versions show the warning.

Originally posted by @C-Otto in #2207 (comment)


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