Affects PMD Version:
6.13.0
Rule:
UnnecessaryLocalBeforeReturn
Description:
An unnecessary local is missed if chained method calls are split up on separate lines AND the method calls reference another variable.
Code Sample demonstrating the issue:
public class Test { public Object test1() { int i = 0; // the usage of i seems to be relevant for the false negative Object o = thing() .make(i); return o; // false negative when the chained calls are on separate lines } public Object test2() { int i = 0; Object o = thing().make(i); return o; // true positive } public Object test3() { Object o = thing() .make(); return o; // true positive } public Object test4() { Object o = thing().make(); return o; // true positive } }
Running PMD through:
CLI/Gradle
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