#1282 False Positive with implicit String.valuesOf() (Java)
This commit is contained in:
@ -220,7 +220,9 @@ public class Test {
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//Expression/PrimaryExpression/PrimaryPrefix/Expression[count(*)=1 and count(./CastExpression)=0 and count(./ConditionalExpression[@Ternary='true'])=0]
|
||||
//Expression/PrimaryExpression/PrimaryPrefix/Expression
|
||||
[count(*)=1][count(./CastExpression)=0][count(./ConditionalExpression[@Ternary='true'])=0]
|
||||
[not(./AdditiveExpression[//Literal[@StringLiteral='true']])]
|
||||
|
|
||||
//Expression/ConditionalAndExpression/PrimaryExpression/PrimaryPrefix/Expression[
|
||||
count(*)=1 and
|
||||
|
@ -224,6 +224,22 @@ public class Test {
|
||||
public static int thisShouldBreak(final int x, final int y, final int z) {
|
||||
return x - (y + z);
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#1282 False Positive with implicit String.valuesOf() (Java)</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
package com.mycompany.mavenproject1;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class NewClass {
|
||||
|
||||
public void falsePositive(Boolean b) throws IOException {
|
||||
System.out.write(( "" + b ).getBytes());
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
@ -12,3 +12,4 @@
|
||||
|
||||
* [#1276](https://sourceforge.net/p/pmd/bugs/1276/): False positive in UnusedPrivateMethod with inner enum
|
||||
* [#1281](https://sourceforge.net/p/pmd/bugs/1281/): UnusedPrivateMethod incorrectly flagged for methods nested private classes
|
||||
* [#1282](https://sourceforge.net/p/pmd/bugs/1282/): False Positive with implicit String.valuesOf() (Java)
|
||||
|
Reference in New Issue
Block a user