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.
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:
It fails on first line with
[PrematureDeclaration] Avoid declaring a variable if it is unreferenced before a possible exit point.