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] MethodReturnsInternalArray: Various false negatives with local aliases and conditional expressions · Issue #6901 · pmd/pmd Closed Labels a:false-negativePMD doesn't flag a problematic piece of codein:data-flowAffects the data flow analysis code Milestone DescriptionAffects PMD Version: 7.26.0 Rule: MethodReturnsInternalArray Description:
Code Sample demonstrating the issue: public class ArrDirect { // reported private int[] data = new int[4]; public int[] getData() { return data; } } public class ArrAlias { // NOT reported private int[] data = new int[4]; public int[] getData() { int[] result = data; return result; } } public class ArrConditional { // NOT reported private int[] data = new int[4]; private boolean flag; public int[] getData() { return flag ? data : new int[0]; } } public class ArrBranches { // NOT reported private int[] data = new int[4]; private boolean flag; public int[] getData() { int[] result; if (flag) { result = data; } else { result = new int[0]; } return result; } } public class ArrVariant { // NOT reported (original reproducer) private int[] data = new int[4]; public int[] getData() { return java.util.Collections.singletonList(data).get(0); } } Expected outcome: PMD should report a Running PMD through: CLI These examples match the test cases added in #6940. Activity
MetadataMetadataAssigneesLabelsa:false-negativePMD doesn't flag a problematic piece of codein:data-flowAffects the data flow analysis 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. |