A RetroSearch Logo

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

Search Query:

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

[java] PrematureDeclaration rule false-positive on variable declared to measure time · Issue #1208 · pmd/pmd · GitHub

Affects PMD Version:
6.4.0

Rule:
PrematureDeclaration

Description:
PrematureDeclaration shouldn't trigger on classes which are specific to time measurement. E.g. it fails when stopwatch is used to measure time to invoke entire method (and I'm interested only in sunny-day scenario when exit points are not triggered).

Code Sample demonstrating the issue:

Stopwatch stopwatch = Stopwatch.createStarted();
// some code with exit points
return stopwatch.elapsed(MILLISECONDS);

It fails on first line with [PrematureDeclaration] Avoid declaring a variable if it is unreferenced before a possible exit point.

ngaya-ll, nicolashenry, linusjf and rdesgroppes


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