A RetroSearch Logo

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

Search Query:

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

[java] UnnecessaryImport false positive for multiline @link Javadoc · Issue #1639 · pmd/pmd · GitHub

Affects PMD Version:

Rule: UnnecessaryImport

Description:
When a derived class refers to a type in a {@link Type#method(ImportedType)} Javadoc tag and there is a line break after the @link , the ImportedType is flagged as being unused.

Code Sample demonstrating the issue:

import java.io.File;
import java.io.FileOutputStream;

public class Demo {
    /** {@link
     * FileOutputStream#FileOutputStream(File)} */
    void main() {}
}

Running PMD through: doesn't matter

Suggested fix: In UnusedImportsRule.java, change LINKS_PATTERN to match the following strings:

Since this is very similar to #1555 it may be wrong to use regular expressions at all. By using a proper Java comment parser (which must exist somewhere since the Javadoc tool uses it), it should be easier to catch this edge case and probably some more.

Quick and dirty hacks:


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