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] UnconditionalIfStatement: False negative for negated boolean constant · Issue #6435 · pmd/pmd Closed Labels a:false-negativePMD doesn't flag a problematic piece of code Milestone DescriptionAffects PMD Version: 7.20.0 Rule: UnconditionalIfStatement Description: In the AST, !false is parsed as a UnaryExpression containing a BooleanLiteral, which does not satisfy the current [BooleanLiteral[1]] predicate. This allows unconditional code blocks to bypass static analysis simply by adding a logical NOT operator. Code Sample demonstrating the issue: public class Bug { public void method() { if (!false) { //<-should report (FN) int i = 1; } } } Expected outcome: PMD should report a violation at line 4, but doesn't. This is a false-negative. The rule should be updated to account for simple constant expressions or at least unary-negated literals. Actual outcome Running PMD through: CLI 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. |