forked from phoedos/pmd
fixes #1465 False Positve UnusedImports with javadoc @link
This commit is contained in:
@ -49,14 +49,15 @@ public class UnusedImportsRule extends AbstractJavaRule {
|
|||||||
* @see package.class#member(param, param) label
|
* @see package.class#member(param, param) label
|
||||||
* {@linkplain package.class#member(param, param) label}
|
* {@linkplain package.class#member(param, param) label}
|
||||||
* {@link package.class#member(param, param) label}
|
* {@link package.class#member(param, param) label}
|
||||||
|
* {@link package.class#field}
|
||||||
* {@value package.class#field}
|
* {@value package.class#field}
|
||||||
* @throws package.class label
|
* @throws package.class label
|
||||||
*/
|
*/
|
||||||
private static final Pattern SEE_PATTERN = Pattern.compile(
|
private static final Pattern SEE_PATTERN = Pattern.compile(
|
||||||
"@see\\s+(\\p{Alpha}\\p{Alnum}*)(?:#\\p{Alnum}*\\(([\\w\\s,]*)\\))?");
|
"@see\\s+(\\p{Alpha}\\p{Alnum}*)(?:#\\p{Alnum}*(?:\\(([\\w\\s,]*)\\))?)?");
|
||||||
|
|
||||||
private static final Pattern LINK_PATTERNS = Pattern.compile(
|
private static final Pattern LINK_PATTERNS = Pattern.compile(
|
||||||
"\\{@link(?:plain)?\\s+(\\p{Alpha}\\p{Alnum}*)(?:#\\p{Alnum}*\\(([.\\w\\s,]*)\\))?[\\s\\}]");
|
"\\{@link(?:plain)?\\s+(\\p{Alpha}\\p{Alnum}*)(?:#\\p{Alnum}*(?:\\(([.\\w\\s,]*)\\))?)?[\\s\\}]");
|
||||||
|
|
||||||
private static final Pattern VALUE_PATTERN = Pattern.compile(
|
private static final Pattern VALUE_PATTERN = Pattern.compile(
|
||||||
"\\{@value\\s+(\\p{Alpha}\\p{Alnum}*)[\\s#\\}]");
|
"\\{@value\\s+(\\p{Alpha}\\p{Alnum}*)[\\s#\\}]");
|
||||||
|
@ -290,6 +290,27 @@ public class FooTest {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(PI);
|
System.out.println(PI);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>#1465 False Positve UnusedImports with javadoc @link</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
import a.b.c.d.AgentState;
|
||||||
|
import a.b.c.d.OtherState;
|
||||||
|
|
||||||
|
public interface Foo {
|
||||||
|
/**
|
||||||
|
* Gets all active AgentHandles.
|
||||||
|
* <p/>
|
||||||
|
* An agent is active if it has not posted a {@link AgentStateChangeEvent} containing {@link AgentState#TERMINATED}.
|
||||||
|
*
|
||||||
|
* @return agent handles.
|
||||||
|
* @see OtherState#TERMINATED
|
||||||
|
*/
|
||||||
|
Iterable<AgentHandle> getAgentHandles();
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
@ -212,6 +212,27 @@ public class FooTest {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(PI);
|
System.out.println(PI);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>#1465 False Positve UnusedImports with javadoc @link</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
import a.b.c.d.AgentState;
|
||||||
|
import a.b.c.d.OtherState;
|
||||||
|
|
||||||
|
public interface Foo {
|
||||||
|
/**
|
||||||
|
* Gets all active AgentHandles.
|
||||||
|
* <p/>
|
||||||
|
* An agent is active if it has not posted a {@link AgentStateChangeEvent} containing {@link AgentState#TERMINATED}.
|
||||||
|
*
|
||||||
|
* @return agent handles.
|
||||||
|
* @see OtherState#TERMINATED
|
||||||
|
*/
|
||||||
|
Iterable<AgentHandle> getAgentHandles();
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
* [#1449](https://sourceforge.net/p/pmd/bugs/1449/): false positive when casting a variable to short
|
* [#1449](https://sourceforge.net/p/pmd/bugs/1449/): false positive when casting a variable to short
|
||||||
* java-design/AccessorClassGeneration:
|
* java-design/AccessorClassGeneration:
|
||||||
* [#1452](https://sourceforge.net/p/pmd/bugs/1452/): ArrayIndexOutOfBoundsException with Annotations for AccessorClassGenerationRule
|
* [#1452](https://sourceforge.net/p/pmd/bugs/1452/): ArrayIndexOutOfBoundsException with Annotations for AccessorClassGenerationRule
|
||||||
|
* java-imports/UnusedImports:
|
||||||
|
* [#1465](https://sourceforge.net/p/pmd/bugs/1465/): False Positve UnusedImports with javadoc @link
|
||||||
* java-junit/TestClassWithoutTestCases:
|
* java-junit/TestClassWithoutTestCases:
|
||||||
* [#1453](https://sourceforge.net/p/pmd/bugs/1453/): Test Class Without Test Cases gives false positive
|
* [#1453](https://sourceforge.net/p/pmd/bugs/1453/): Test Class Without Test Cases gives false positive
|
||||||
* java-unusedcode/UnusedFormalParameter:
|
* java-unusedcode/UnusedFormalParameter:
|
||||||
|
Reference in New Issue
Block a user