Update rule to prevent UnusedImport when using JavaDoc with array type

This commit is contained in:
Itai Gilo
2019-04-01 11:06:47 +03:00
parent e7f7422f50
commit ae535ce594
2 changed files with 17 additions and 1 deletions

View File

@ -44,7 +44,7 @@ public class UnusedImportsRule extends AbstractJavaRule {
.compile("@see\\s+(\\p{Alpha}?+\\w*)(?:#\\w*(?:\\(([\\w\\s,]*)\\))?)?");
private static final Pattern LINK_PATTERNS = Pattern
.compile("\\{@link(?:plain)?\\s+(\\p{Alpha}\\w*)(?:#\\w*(?:\\(([.\\w\\s,]*)\\))?)?[\\s\\}]");
.compile("\\{@link(?:plain)?\\s+(\\p{Alpha}\\w*)(?:#\\w*(?:\\(([.\\w\\s,\\[\\]]*)\\))?)?[\\s\\}]");
private static final Pattern VALUE_PATTERN = Pattern.compile("\\{@value\\s+(\\p{Alpha}\\w*)[\\s#\\}]");

View File

@ -241,6 +241,22 @@ public class Foo {
]]></code>
</test-code>
<test-code>
<description>#1720 False Positive in UnusedImports for Javadoc link with array type</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import some.pack.SomeUtility;
public class Foo {
/**
* The {@link SomeUtility#someHelperMethod(String, SomeObjectArray[])} method does something.
*/
public void someMethod() {
}
}
]]></code>
</test-code>
<test-code>
<description><![CDATA[
Bug 2606609 : False "UnusedImports" positive in package-info.java