fixed bug 633892

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1204 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-11-05 20:27:18 +00:00
parent f9a7b1ef3d
commit e210538d82
5 changed files with 9 additions and 6 deletions

View File

@ -58,9 +58,8 @@
<target name="pmd">
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
<!--<pmd reportFile="c:\jdk-1.4.html" rulesetfiles="rulesets/tmp.xml" format="html">-->
<pmd reportFile="c:\jdk-1.4.html" rulesetfiles="rulesets/imports.xml,rulesets/unusedcode.xml,rulesets/basic.xml,rulesets/favorites.xml" format="html">
<!--<fileset dir="c:\data\pmd\pmd\src\net\sourceforge\pmd\">-->
<fileset dir="c:\j2sdk1.4.1_01\src\java\lang">
<pmd reportFile="c:\jdk-1.4.html" rulesetfiles="rulesets/basic.xml" format="html">
<fileset dir="c:\j2sdk1.4.1_01\src\java\">
<include name="**/*.java"/>
<!--<exclude name="**/ast**/"/>-->
</fileset>

View File

@ -1,3 +1,7 @@
???? ?? 2002 - 1.0.1:
Fixed bug 633879: EmptyFinallyBlockRule now handles multiple catch blocks followed by a finally block.
Fixed bug 633892: StringToStringRule false positive exposed problem in symbol table usage to declaration code.
November 04 2002 - 1.0:
Added new rules: StringToStringRule, AvoidReassigningParametersRule, UnnecessaryConstructorRule, AvoidStringLiteralsRule
Fixed bug 631010: AvoidDeeplyNestedIfStmtsRule works correctly with if..else stmts now

View File

@ -2,4 +2,4 @@
set MAIN=net.sourceforge.pmd.PMD
set TEST_FILE=c:\\data\\pmd\\pmd\\test-data\\%1%.java
java %MAIN% %TEST_FILE% xml rulesets\tmp.xml
java %MAIN% %TEST_FILE% xml rulesets/tmp.xml

View File

@ -22,7 +22,7 @@ public class StringToStringRule extends AbstractRule {
if (nameNode instanceof ASTPrimitiveType || !nameNode.getImage().equals("String")) {
return data;
}
// now we know we're at a node of type String
// now we know we're at a variable declaration of type String
Map decls = node.getScope().getVariableDeclarations(true);
for (Iterator i = decls.keySet().iterator(); i.hasNext();) {
VariableNameDeclaration decl = (VariableNameDeclaration)i.next();

View File

@ -53,7 +53,7 @@ public abstract class AbstractScope implements Scope {
public NameDeclaration addVariableNameOccurrence(NameOccurrence occurrence) {
NameDeclaration decl = findVariableHere(occurrence);
if (decl != null) {
if (decl != null && !occurrence.isThisOrSuper()) {
List nameOccurrences = (List)variableNames.get(decl);
nameOccurrences.add(occurrence);
}