Affects PMD Version: 7.0.0-rc3 (works fine in 6.55.0)
Rule: UnusedAssignment
Description:
False-positive is reported when a variable is assigned in record compact constructor.
UnusedAssignment: The value assigned to variable 'foo' is never used
Code Sample demonstrating the issue:
class Main { public static void main(String[] args) { System.out.println(new TestRecord(2).foo()); } } record TestRecord(int foo) { TestRecord { foo = Math.min(foo, 1); // <!--- violation here } }
Expected outcome:
PMD should not report false-positive about unused foo
in compact constructor.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
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