forked from phoedos/pmd
pmd: fix #1095 AvoidFinalLocalVariable false positive
This commit is contained in:
parent
9a81bcf7dd
commit
5c92fdd31a
@ -4,6 +4,7 @@ Fixed bug 991: AvoidSynchronizedAtMethodLevel for static methods
|
||||
Fixed bug 1084: NPE at UselessStringValueOfRule.java:36
|
||||
Fixed bug 1091: file extension for fortran seems to be wrong in cpdgui tools
|
||||
Fixed bug 1092: Wrong Attribute "excludemarker" in Ant Task Documentation
|
||||
Fixed bug 1095: AvoidFinalLocalVariable false positive
|
||||
Fixed bug 1099: UseArraysAsList false positives
|
||||
Fixed bug 1102: False positive: shift operator parenthesis
|
||||
Fixed bug 1104: IdempotentOperation false positive
|
||||
|
@ -366,6 +366,7 @@ Avoid using final local variables, turn them into fields.
|
||||
<value><![CDATA[
|
||||
//LocalVariableDeclaration[
|
||||
@Final = 'true'
|
||||
and not(../../ForStatement)
|
||||
and
|
||||
(
|
||||
(count(VariableDeclarator/VariableInitializer) = 0)
|
||||
|
@ -12,7 +12,6 @@ public class ControversialRulesTest extends SimpleAggregatorTst {
|
||||
@Before
|
||||
public void setUp() {
|
||||
addRule(RULESET, "AssignmentInOperand");
|
||||
addRule(RULESET, "AvoidFinalLocalVariable");
|
||||
addRule(RULESET, "AvoidLiteralsInIfCondition");
|
||||
addRule(RULESET, "AvoidPrefixingMethodParameters");
|
||||
addRule(RULESET, "AvoidUsingNativeCode");
|
||||
|
@ -51,4 +51,17 @@ public class A {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>#1095 AvoidFinalLocalVariable false positive</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Test {
|
||||
|
||||
public void test() {
|
||||
final File[] files = new File(".").listFiles();
|
||||
for (final File f : files) { f.getAbsolutePath(); }
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user