A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/342 below:

Name clash with another public field not properly handled · Issue #342 · pmd/pmd · GitHub

Rule Set: AccessorMethodGeneration (Java - Design), PMD 5.5.5

Description:

It appears that the rule AccessorMethodGeneration fails to resolve name clash with public field in another class with identical name.

Code Sample demonstrating the issue:

public class ClassA {

    public String field;

}
public class ClassB {

    private String field;

    private class ClassC {

        public void doSomething() {
            ClassA a = new ClassA();
            a.field = "abcd"; // should not be a violation here but reported as one
        }

    }

}

Changing ClassB#field to e.g. ClassB#field0 removes the violation.

Running PMD through: Gradle


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4