Merge branch 'pr-1427'

This commit is contained in:
Juan Martín Sotuyo Dodero
2018-11-05 00:00:35 -03:00
3 changed files with 29 additions and 2 deletions

View File

@ -19,6 +19,8 @@ This is a {{ site.pmd.release_type }} release.
* all
* [#1318](https://github.com/pmd/pmd/issues/1318): \[test] Kotlin DSL to ease test writing
* [#1341](https://github.com/pmd/pmd/issues/1341): \[doc] Documentation Error with Regex Properties
* java-codestyle
* [#1372](https://github.com/pmd/pmd/issues/1372): \[java] false positive for UselessQualifiedThis
### API Changes

View File

@ -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]

View File

@ -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>