Menu

#1033 False+ : SingularField

PMD-5.0.1
closed
pmd (543)
5
2014-10-31
2012-10-03
Anonymous
No

Given the following code, a SingularField error is reported, however, the field is used.
PMD 4.3 bundled in Sonar 3.2

public enum MyEnum {
A("a"),
B("b");

private final String description; // <-- SingularField reported

private MyEnum(String description) {
    this.description = description;
}

public static MyEnum byDescription(String description) {
    for (MyEnum myEnum : values()) {
        if (myEnum.description.equals(description)) { // <--- USED HERE
            return myEnum;
        }
    }
    return null;
}

}

Discussion

  • Andreas Dangel

    Andreas Dangel - 2012-10-04

    Thank you for your bug report.
    I can reproduce it with the latest PMD 5 version and will try to fix it soon.

     
  • Andreas Dangel

    Andreas Dangel - 2012-11-23
    • Milestone: PMD-5.1.x --> PMD-5.0.1
     

Log in to post a comment.