Fixed bug in symbol table; it wasn't creating a scope level when it hit a switch statement
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@1388 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -57,10 +57,10 @@
|
||||
|
||||
<target name="pmd">
|
||||
<taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"/>
|
||||
<pmd rulesetfiles="rulesets/imports.xml" shortFilenames="true">
|
||||
<formatter type="html" toFile="foo.html"/>
|
||||
<fileset dir="C:\j2sdk1.4.1_01\src\java\lang\">
|
||||
<include name="**/*.java"/>
|
||||
<pmd rulesetfiles="rulesets/tmp.xml" failOnError="true" shortFilenames="true">
|
||||
<formatter type="html" toFile="c:\foo.html" isReportFilePathAbsolute="true"/>
|
||||
<fileset dir="C:\data\pmd\pmd\test-data\">
|
||||
<include name="Foo.java"/>
|
||||
</fileset>
|
||||
</pmd>
|
||||
</target>
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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()) {
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user