A RetroSearch Logo

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

Search Query:

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

[java] UnnecessaryFullyQualifiedName: regression / false positive · Issue #2098 · pmd/pmd · GitHub

493e001#diff-bc84f21dff8725b7dc1441ccbc43bef1R243-R253

Affects PMD Version: 6.18.0 and 6.19.0

Rule: UnnecessaryFullyQualifiedName

Description:

I do have a package-info.java file containing an annotation that lays in a subpackage. Therefore specifying a fully qualified name is required. Though, the rule UnnecessaryFullyQualifiedName outputs a violation.

This problem does not occur with PMD 6.17.0. I took a look at the rules code and at a first view 493e001#diff-bc84f21dff8725b7dc1441ccbc43bef1R243-R253 seems to cause the problem.

Code Sample demonstrating the issue:

@com.example.subpackage.ExampleAnnotation
package com.example;

pmd.xml example:

<file name="...\com\example\package-info.java">
<violation beginline="1" endline="1" begincolumn="2" endcolumn="42" rule="UnnecessaryFullyQualifiedName" ruleset="Code Style" externalInfoUrl="https://pmd.github.io/pmd-6.18.0/pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname" priority="4">
Unnecessary use of fully qualified name 'com.example.subpackage.ExampleAnnotation' due to existing same package import 'com.example.*'
</violation>
</file>

Running PMD through: Maven


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