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] StringToString rule false-positive with field access · Issue #2080 · pmd/pmd Closed Labels a:false-positivePMD flags a piece of code that is not problematicin:symbol-tableAffects the symbol table code Milestone DescriptionAffects PMD Version: Rule: StringToString Description: Attached code should help to understand better the following description. We found a false-positive case for the rule String.toString(). Since the enum is not a Code Sample demonstrating the issue: See attached project for a ready-to-go reproduction case. public enum AnEnum { A, B, C; } public class AnEnumUser { private final String value; public AnEnumUser(final OtherEnumUser otherUser) { // The following line triggers the "false-positive" warning value = otherUser.value.toString(); } public String getValue() { return value; } } public class OtherEnumUser { public final AnEnum value; public OtherEnumUser(final AnEnum value) { this.value = value; } } public final class Main { private Main() { } public static void main(final String[] args) { final OtherEnumUser a = new OtherEnumUser(AnEnum.A); System.out.println("Original " + a.value); final AnEnumUser aCopy = new AnEnumUser(a); System.out.println("Copy " + aCopy.getValue()); } } Running PMD through: Gradle Activity
MetadataMetadataAssigneesLabelsa:false-positivePMD flags a piece of code that is not problematicin:symbol-tableAffects the symbol table 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. |