Affects PMD Version:
7.10.0
Rule:
https://docs.pmd-code.org/latest/pmd_rules_java_bestpractices.html#unusedassignment
Code Sample demonstrating the issue:
List<String> lines = Files.readAllLines("someFile"); int lineNumber = 0; boolean expectingAnotherLine = false; for (String line : lines) { ++lineNumber; if (line.endsWith("\\")) { expectingAnotherLine = true; // line 9 - false positive unused assignment continue; } expectingAnotherLine = false; } if (expectingAnotherLine) throw new IllegalArgumentException("Unexpected end of line: " + command);
Expected outcome:
PMD reports a violation at line 9 (expectingAnotherLine = true;
), but that's wrong. That's a false positive.
Running PMD through:
Maven plugin 3.26.0
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