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] SimplifyBooleanReturns triggers inconsistently depending on redundant parentheses in return expression · Issue #6694 · pmd/pmd Closed Labels a:false-positivePMD flags a piece of code that is not problematic Milestone DescriptionAffects PMD Version: 7.24.0 Rule: SimplifyBooleanReturns — https://docs.pmd-code.org/latest/pmd_rules_java_design.html#simplifybooleanreturns Description:
Code Sample demonstrating the issue: public class FactoryChecker { // BEFORE — NOT flagged by SimplifyBooleanReturns public boolean isFactoryMethodA(String qualifier, String name) { if (qualifier != null) { return typeEndsWith(qualifier, "Factory") || nameEndsWith(name); } return false; } // AFTER — flagged by SimplifyBooleanReturns (line of the `if`) public boolean isFactoryMethodB(String qualifier, String name) { if (qualifier != null) { return (typeEndsWith(qualifier, "Factory") || nameEndsWith(name)); } return false; } private boolean typeEndsWith(String q, String suffix) { return q != null && q.endsWith(suffix); } private boolean nameEndsWith(String n) { return n != null && n.endsWith("Factory"); } } Expected outcome: Both methods (which are semantically identical) should receive the same verdict — either both are reported as simplifiable to Actual outcome: Only Running PMD through: CLI Activity
MetadataMetadataAssigneesLabelsa:false-positivePMD flags a piece of code that is not problematic 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. |