forked from phoedos/pmd
pmd: fix #975 false positive in ClassCastExceptionWithToArray
This commit is contained in:
parent
41c44e5d8d
commit
5f45a28621
@ -1,6 +1,7 @@
|
||||
????? ??, 2013 - 5.0.3:
|
||||
|
||||
Fixed bug 968: Issues with JUnit4 @Test annotation with expected exception (Thanks to Yiannis Paschalidis)
|
||||
Fixed bug 975: false positive in ClassCastExceptionWithToArray
|
||||
Fixed bug 976: UselessStringValueOf wrong when appending character arrays
|
||||
Fixed bug 977: MisplacedNullCheck makes false positives
|
||||
Fixed bug 984: Cyclomatic complexity should treat constructors like methods
|
||||
|
@ -297,7 +297,7 @@ in a ClassCastException.
|
||||
<value>
|
||||
<![CDATA[
|
||||
//CastExpression[Type/ReferenceType/ClassOrInterfaceType[@Image !=
|
||||
"Object"]]//PrimaryExpression
|
||||
"Object"]]/PrimaryExpression
|
||||
[
|
||||
PrimaryPrefix/Name[ends-with(@Image, '.toArray')]
|
||||
and
|
||||
|
@ -46,4 +46,22 @@ public class Foo {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#975 false positive in ClassCastExceptionWithToArray</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import org.apache.commons.dbutils.*;
|
||||
import org.apache.commons.dbutils.handlers.*;
|
||||
|
||||
public class Test {
|
||||
public void foo() {
|
||||
QueryRunner qr = getQueryRunner();
|
||||
List<?> parms = new java.util.ArrayList();
|
||||
// public <T> T QueryRunner.query(String sql, ResultSetHandler<T> rsh, Object... params)
|
||||
String result = (String) qr.query( sql, new ScalarHandler(), parms.toArray() );
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user