forked from phoedos/pmd
merged from trunk: Fixed bug 1481051 - false + UnusedNullCheckInEquals (and other false positives too)
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6440 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
parent
7ed88ed4cf
commit
39e59dd02f
@ -1,5 +1,7 @@
|
||||
???? - 4.2.4:
|
||||
|
||||
Fixed bug 1481051 - false + UnusedNullCheckInEquals (and other false positives too)
|
||||
|
||||
August 31, 2008 - 4.2.3:
|
||||
|
||||
JavaCC generated artifacts updated to JavaCC 4.1d1.
|
||||
|
@ -50,6 +50,33 @@ public class Foo {
|
||||
if (x != null && "Foo".equals(y)) {}
|
||||
if (y.equals(x)) {}
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
var is not used in equals() call
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar() {
|
||||
if (c != null && A.b(c).equals(d)) {}
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
[ 1481051 ] false + UnusedNullCheckInEquals
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar() {
|
||||
if(o1!=null && o1[0] != null && o2[0].getName()!=null && o2[0].getName().equals(o1[0].getName()) ){ }
|
||||
if(o1!=null && o2.equals(o1.getName()) ){ }
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
@ -873,8 +873,8 @@ public class Foo {
|
||||
<value>
|
||||
<![CDATA[
|
||||
//PrimarySuffix[@Image='equals' and not(../PrimaryPrefix/Literal)]
|
||||
/../PrimarySuffix/Arguments/ArgumentList/Expression
|
||||
/PrimaryExpression/PrimaryPrefix
|
||||
/following-sibling::PrimarySuffix/Arguments/ArgumentList/Expression
|
||||
/PrimaryExpression[count(PrimarySuffix)=0]/PrimaryPrefix
|
||||
/Name[@Image = ./../../../../../../../../../../Expression/ConditionalAndExpression
|
||||
/EqualityExpression[@Image="!=" and count(./preceding-sibling::*)=0 and
|
||||
./PrimaryExpression/PrimaryPrefix/Literal/NullLiteral]
|
||||
|
Loading…
x
Reference in New Issue
Block a user