Skip to content

[java] UnusedImports: False positive if nested interface is referenced in javadoc #2001

@eekboom

Description

@eekboom

Affects PMD Version:
6.17.0
Rule:
category/java/bestpractices.xml/UnusedImports

UnnecessaryImport

Description:
When a class A is imported and the only reference to it is in javadoc {@link A.B} where B is a nested interface, then the warning triggers incorrectly.

Code Sample demonstrating the issue:

package de.eekboom.acme.util;

public class A {
	public interface B {}
}
package de.eekboom.acme;

import de.eekboom.acme.util.A;

/**
 * Foobedoo {@link A.B}
 */
public class C {
}

Running PMD through: Gradle

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions