A RetroSearch Logo

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

Search Query:

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

[java] UnusedImports false positive for method parameter type in @see Javadoc · Issue #1555 · pmd/pmd · GitHub

Affects PMD Version:

Rule:
UnusedImports

Description:
When a derived class refers to a type in a @see #method(ImportedType) Javadoc tag, the ImportedType is flagged as being unused.

Code Sample demonstrating the issue:

public class Base {
    void method(java.io.File file) {}
}
import java.io.File;

public class Derived extends Base {
    /** @see #method(File) */
    void main() {}
}

Running PMD through: doesn't matter

Suggested fix: In UnusedImportsRule.java, change SEE_PATTERN:

- "@see\\s+(\\p{Alpha}\\w*)(?:#\\w*(?:\\(([\\w\\s,]*)\\))?)?"
+ "@see\\s+(\\p{Alpha}?+\\w*)(?:#\\w*(?:\\(([\\w\\s,]*)\\))?)?"

This makes the type name optional. The regular expression should now match:


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