A RetroSearch Logo

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

Search Query:

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

[java] PrematureDeclaration as result of method call (false positive) · Issue #1429 · pmd/pmd · GitHub

Affects PMD Version:
6.9.0

Rule:
PrematureDeclaration

Description:
The result of a ConcurrentMap#put is captured for handling later in the method. As put has a side effect, the logic changes if the declaration is moved downward.

Code Sample demonstrating the issue:

var prior = cache.put(uri, cachedPath);

if (ref == null) {
  return PathRef.create(cachedPath, 1);
}
if (prior == null) {
  ref.count().incrementAndGet();
}

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