diff --git a/pmd/etc/build.xml b/pmd/etc/build.xml index ded3cc8cfd..1c188e3131 100644 --- a/pmd/etc/build.xml +++ b/pmd/etc/build.xml @@ -57,10 +57,10 @@ - - - - + + + + diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index 3ea06e5892..dd6632602d 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -4,6 +4,7 @@ Fixed bug 672742 - grammar typo was hosing up ASTConstructorDeclaration which wa Fixed bug 674393 - OnlyOneReturn rule no longer counts returns that are inside anonymous inner classes as being inside the containing method. Thx to C. Lamont Gilbert for the bug report. Fixed bug 674420 - AvoidReassigningParametersRule no longer counts parameter field reassignment as a violation. Thx to C. Lamont Gilbert for the bug report. Fixed bug 673662 - The Ant task's "failOnError" attribute works again. +Fixed bug 676340 - Symbol table now creates new scope level when it encounters a switch statement. See the bug for code details; generally, this bug would have triggered runtime exceptions on certain blocks of code. Fixed bug in OverrideBothEqualsAndHashcodeRule - it no longer bails out with a NullPtrException on interfaces that declare a method signature "equals(Object)". Thx to Don Leckie for catching that. Added an optional Ant task formatter attribute 'isReportFilePathAbsolute'. Thx to Andriy Rozeluk for the feedback. diff --git a/pmd/src/net/sourceforge/pmd/symboltable/ScopeCreator.java b/pmd/src/net/sourceforge/pmd/symboltable/ScopeCreator.java index dac2d58dc4..b111263ede 100644 --- a/pmd/src/net/sourceforge/pmd/symboltable/ScopeCreator.java +++ b/pmd/src/net/sourceforge/pmd/symboltable/ScopeCreator.java @@ -16,6 +16,7 @@ import net.sourceforge.pmd.ast.ASTUnmodifiedClassDeclaration; import net.sourceforge.pmd.ast.ASTUnmodifiedInterfaceDeclaration; import net.sourceforge.pmd.ast.JavaParserVisitorAdapter; import net.sourceforge.pmd.ast.SimpleNode; +import net.sourceforge.pmd.ast.ASTSwitchStatement; import java.util.Stack; @@ -33,6 +34,7 @@ public class ScopeCreator extends JavaParserVisitorAdapter { public Object visit(ASTTryStatement node, Object data){openScope(node);return data;} public Object visit(ASTForStatement node, Object data){openScope(node);return data;} public Object visit(ASTIfStatement node, Object data){openScope(node);return data;} + public Object visit(ASTSwitchStatement node, Object data){openScope(node);return data;} private void push(Scope scope) { if (scopes.empty()) { diff --git a/pmd/src/net/sourceforge/pmd/symboltable/ScopeFactory.java b/pmd/src/net/sourceforge/pmd/symboltable/ScopeFactory.java index 7a41852b5b..3e587becbc 100644 --- a/pmd/src/net/sourceforge/pmd/symboltable/ScopeFactory.java +++ b/pmd/src/net/sourceforge/pmd/symboltable/ScopeFactory.java @@ -16,6 +16,7 @@ import net.sourceforge.pmd.ast.ASTUnmodifiedClassDeclaration; import net.sourceforge.pmd.ast.ASTUnmodifiedInterfaceDeclaration; import net.sourceforge.pmd.ast.Node; import net.sourceforge.pmd.ast.SimpleNode; +import net.sourceforge.pmd.ast.ASTSwitchStatement; import java.util.HashSet; import java.util.Set; @@ -48,6 +49,7 @@ public class ScopeFactory { localTriggers.add(ASTBlock.class); localTriggers.add(ASTTryStatement.class); localTriggers.add(ASTForStatement.class); + localTriggers.add(ASTSwitchStatement.class); localTriggers.add(ASTIfStatement.class); methodTriggers.add(ASTConstructorDeclaration.class); methodTriggers.add(ASTMethodDeclaration.class);