Fixed bug [ 805092 ] Problem with VariableNamingConventionsRule

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2256 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-09-12 14:38:19 +00:00
parent 3edcc53e5b
commit e07888b94b
4 changed files with 12 additions and 2 deletions

View File

@ -4,7 +4,8 @@ Fixed bug 782235 - "ant -version" now prints more details when a file errors out
Fixed bug 779874 - LooseCouplingRule no longer triggers on ArrayList
Fixed bug 781393 - VariableNameDeclaration no longer throws ClassCastExpression since ASTLocalVariableDeclaration now subclasses AccessNode
Fixed bug 797243 - CPD XML report can no longer contain ]]> (CDEnd)
Fixed bug 690196 - PMD now handles both JDK 1.3 and 1.4 code - i.e., non-keyword usage of "assert".
Fixed bug 690196 - PMD now handles both JDK 1.3 and 1.4 code - i.e., usage of "assert" as an identifier.
Fixed bug 805092 - VariableNamingConventionsRule no longer flags serialVersionUID as a violation
Fixed bug - Specifying a non-existing rule format on the command line no longer results in a ClassNotFoundException.
XPath rules may now include pluggable parameters. This feature is very limited. For now.
Tweaked CPD time display field

View File

@ -12,6 +12,7 @@ public class VariableNamingConventionsRuleTest extends SimpleAggregatorTst {
new TestDescriptor(TEST3, "variables names should start with lowercase character", 1, new VariableNamingConventionsRule()),
new TestDescriptor(TEST4, "all is well", 0, new VariableNamingConventionsRule()),
new TestDescriptor(TEST5, "local finals are ok", 0, new VariableNamingConventionsRule()),
new TestDescriptor(TEST6, "serialVersionUID is OK", 0, new VariableNamingConventionsRule()),
});
}
@ -42,4 +43,9 @@ public class VariableNamingConventionsRuleTest extends SimpleAggregatorTst {
" final int STATE_READING = 0;" + PMD.EOL +
" }" + PMD.EOL +
"}";
private static final String TEST6 =
"public class Foo {" + PMD.EOL +
" static final long serialVersionUID = 423343L;" + PMD.EOL +
"}";
}

View File

@ -42,6 +42,9 @@ public class VariableNamingConventionsRule extends AbstractRule {
ASTVariableDeclaratorId childNodeId = (ASTVariableDeclaratorId)childNodeName.jjtGetChild(0);
String varName = childNodeId.getImage();
if (varName.equals("serialVersionUID")) {
return data;
}
if (isFinal) {
if (!varName.equals(varName.toUpperCase())) {

View File

@ -38,6 +38,7 @@
</subsection>
<subsection name="Contributors">
<ul>
<li>Andriy Rozeluk - bug report, feature suggestions</li>
<li>Vadim Nasardinov - xdocs cleanup, run.sh cleanup</li>
<li>Sreenivasa Viswanadha - grammar cleanup for Ctrl-Z problem</li>
<li>Sigiswald Madou - bug report</li>
@ -98,7 +99,6 @@
<li>Martin Cooper - feature suggestions</li>
<li>Bruce Mayhew - feedback on the jEdit plugin</li>
<li>Juergen Ebert - feature suggestions and pmd-netbeans feedback</li>
<li>Andriy Rozeluk - feature suggestions</li>
<li>J.D. Fagan - feature suggestions</li>
<li>William McArthur - ForLoopShouldBeWhileLoop rule</li>
<li>Ales Bukovsky - pmd-netbeans feedback</li>