[java] UnusedImportRule - False Positive for only usage in Javadoc - {@link...
A source code analyzer
Brought to you by:
adangel,
juansotuyo
The reason is that
\p{Alnum}
in the regex does not match_
, which is very common in constants:https://github.com/pmd/pmd/blob/c2cd2fb4bd1056d8c19eb2aac261b8a5b55479c4/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/imports/UnusedImportsRule.java#L40
{@link HttpURLConnection#HTTPNOTACCEPTABLE}
is fine (no false positive).
The regex should use
\w
instead.This still won't work for indentifier names that don't match the convention (such as arbitrary unicode characters), but it should fix it for the common use case.
Last edit: Sebastian Ratz 2016-11-22
This will be released in PMD 5.4.4, 5.5.3 and later