Add a test case
This commit is contained in:
@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<test-data
|
<test-data xmlns="http://pmd.sourceforge.net/rule-tests"
|
||||||
xmlns="http://pmd.sourceforge.net/rule-tests"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">
|
||||||
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">
|
|
||||||
<test-code>
|
<test-code>
|
||||||
<description>bad</description>
|
<description>bad</description>
|
||||||
<expected-problems>1</expected-problems>
|
<expected-problems>1</expected-problems>
|
||||||
@ -23,7 +22,6 @@ public class Foo {
|
|||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
|
||||||
|
|
||||||
<test-code>
|
<test-code>
|
||||||
<description>Allowed in anonymous classes</description>
|
<description>Allowed in anonymous classes</description>
|
||||||
<expected-problems>0</expected-problems>
|
<expected-problems>0</expected-problems>
|
||||||
@ -72,6 +70,30 @@ public enum Foo {
|
|||||||
|
|
||||||
{ setCycleDuration(Duration.millis(1200)); }
|
{ setCycleDuration(Duration.millis(1200)); }
|
||||||
|
|
||||||
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>Flag in nested local class</description>
|
||||||
|
<expected-problems>1</expected-problems>
|
||||||
|
<expected-linenumbers>7</expected-linenumbers>
|
||||||
|
<code><![CDATA[
|
||||||
|
public class Foo {
|
||||||
|
public Animation getStatusTransition() {
|
||||||
|
return new Transition() {
|
||||||
|
|
||||||
|
{
|
||||||
|
setCycleDuration(Duration.millis(1200));
|
||||||
|
class ImInAnon {{}} // should be flagged
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void interpolate(double frac) {
|
||||||
|
// magic
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
|
Reference in New Issue
Block a user