GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [java] UnusedLocalVariable: false-negative with compound assignments · Issue #4517 · pmd/pmd Closed Labels a:false-negativePMD doesn't flag a problematic piece of code Milestone DescriptionAffects PMD Version: 6.x Rule: UnusedLocalVariable Description: If a variable is only used in a compound statement (e.g. Note: This has already been fixed with PMD 7.0.0-rc1. (via #3113) Code Sample demonstrating the issue: public class UnusedCompoundAssignment { void this_is_unused() { int x = 0; // violation expected (line 3) x += 2; // doesn't count as usage } void transitive_used_but_unused1() { int a = 1; // _no_ violation expected, a is used int b = a; // _no_ violation expected, b is used int c = b; // violation expected (line 9) } void transitive_used_but_unused2() { int a, b, c; // 1 violation expected, only c is unused (line 12) a = 1; b = a; c = b; } void transitive_used() { int a, b, c; // _no_ violation expected a = 1; b = a; c = b; System.out.println(c); // usage } void this_is_used() { int y = 0; // _no_ violation expected y += 2; System.out.println(y); // usage } } Expected outcome: PMD should report a violation at line 3, but doesn't. This is a false-negative. Activity
MetadataMetadataAssigneesLabelsa:false-negativePMD doesn't flag a problematic piece of code TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |