A RetroSearch Logo

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

Search Query:

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

[java] UnnecessaryFullyQualifiedName false positive when nested and non-nested classes with the same name and in the same package are used together · Issue #4085 · pmd/pmd · GitHub

One can find a project to reproduce this issue here: https://github.com/OlegAndreych/PMDNestedClassFQNTest.

package some.pkg;

public class Test {
}
package some.pkg;

public class OuterTest {
    public static class Test{
        private final some.pkg.Test test; // line 5 - false positive

        public Test(some.pkg.Test test){ // line 7 - false positive

            this.test = test;
        }
    }
}

PMD Reports the following violations:

[INFO] PMD Failure: some.pkg.OuterTest$Test:5 Rule:UnnecessaryFullyQualifiedName Priority:4 Unnecessary use of fully qualified name 'some.pkg.Test' due to existing same package import 'some.pkg.*'.
[INFO] PMD Failure: some.pkg.OuterTest$Test:7 Rule:UnnecessaryFullyQualifiedName Priority:4 Unnecessary use of fully qualified name 'some.pkg.Test' due to existing same package import 'some.pkg.*'.

Both are false positives - the fully qualified name is necessary, since the enclosing class has the same name (Test).


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