Fix #1372
This commit is contained in:
@ -1950,7 +1950,9 @@ public class Foo {
|
||||
message="Useless qualified this usage in the same class."
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#uselessqualifiedthis">
|
||||
<description>Look for qualified this usages in the same class.</description>
|
||||
<description>
|
||||
Reports qualified this usages in the same class.
|
||||
</description>
|
||||
<priority>3</priority>
|
||||
<properties>
|
||||
<property name="xpath">
|
||||
@ -1958,7 +1960,7 @@ public class Foo {
|
||||
<![CDATA[
|
||||
//PrimaryExpression
|
||||
[PrimaryPrefix/Name[@Image]]
|
||||
[PrimarySuffix[@Arguments='false']]
|
||||
[PrimarySuffix[@Arguments='false' and @ArrayDereference = 'false']]
|
||||
[not(PrimarySuffix/MemberSelector)]
|
||||
[ancestor::ClassOrInterfaceBodyDeclaration[1][@AnonymousInnerClass='false']]
|
||||
/PrimaryPrefix/Name[@Image = ancestor::ClassOrInterfaceDeclaration[1]/@Image]
|
||||
|
@ -152,4 +152,27 @@ public class ApiExceptionCtrlAdvice {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>False positive for UselessQualifiedThis #1372</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code>
|
||||
<![CDATA[
|
||||
public class Board {
|
||||
private int[] Board;
|
||||
|
||||
|
||||
public Board(int[] b) {
|
||||
for (int i = 0; i < b.length; i++)
|
||||
Board[i] = b[i];
|
||||
}
|
||||
|
||||
|
||||
public int size() {
|
||||
return Board.length;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</code>
|
||||
</test-code>
|
||||
</test-data>
|
Reference in New Issue
Block a user