forked from phoedos/pmd
pmd: #1002 False +: FinalFieldCouldBeStatic on inner class
This commit is contained in:
parent
adcbdc204f
commit
3b14b3f5cb
@ -1,5 +1,6 @@
|
||||
????? ??, 2013 - 5.0.3:
|
||||
|
||||
Fixed bug 1002: False +: FinalFieldCouldBeStatic on inner class
|
||||
Fixed bug 1064: Exception running PrematureDeclaration
|
||||
Fixed bug 1068: CPD fails on broken symbolic links
|
||||
Fixed bug 1073: Hard coded violation messages CommentSize
|
||||
|
@ -292,7 +292,7 @@ in each object at runtime.
|
||||
[@Final='true' and @Static='false']
|
||||
[not (../../../../ClassOrInterfaceDeclaration[@Interface='true'])]
|
||||
/VariableDeclarator/VariableInitializer/Expression
|
||||
/PrimaryExpression/PrimaryPrefix/Literal
|
||||
/PrimaryExpression[not(PrimarySuffix)]/PrimaryPrefix/Literal
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -66,4 +66,31 @@ public interface Foo {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
<test-code>
|
||||
<description>bug #1002 False +: FinalFieldCouldBeStatic on inner class</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
package net.sourceforge.pmd;
|
||||
|
||||
public class FinalFieldCouldBeStaticTest {
|
||||
|
||||
public void foo() {
|
||||
final Test t = new Test() {
|
||||
// the rule was triggered for "foo" - which could be indeed a final static String constant
|
||||
private final byte[] b = "foo".getBytes();
|
||||
|
||||
@Override
|
||||
public byte[] bar() {
|
||||
return b;
|
||||
}
|
||||
};
|
||||
t.bar();
|
||||
}
|
||||
}
|
||||
|
||||
interface Test {
|
||||
byte[] bar();
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user