Nice patch from Johan Stuyts to clean up various things; added unit test to nail down bug 1339470

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@3958 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2005-11-03 22:19:28 +00:00
parent 41316772f8
commit a4dbe16cbc
3 changed files with 40 additions and 5 deletions

View File

@ -1,12 +1,14 @@
<project name="pmd" default="pmd" basedir="../">
<property file="bin/local.properties"/>
<property name="dir.lib" value="lib\"/>
<property name="dir.src" value="src\"/>
<property name="dir.build" value="build\"/>
<property name="dir.rulesets" value="rulesets\"/>
<property name="dir.regress" value="regress\"/>
<property name="version" value="3.3"/>
<property name="keystore" value="/home/tom/myKeyStore"/>
<property name="keystore" value="${keystore.path}"/>
<path id="dependencies.path">
<pathelement location="${dir.build}"/>
@ -139,8 +141,8 @@
<delete file="src/net/sourceforge/pmd/ast/JavaParserConstants.java"/>
<delete file="src/net/sourceforge/pmd/ast/JavaParserTreeConstants.java"/>
<delete file="src/net/sourceforge/pmd/ast/JavaParserTokenManager.java"/>
<jjtree target="etc/grammar/Java.jjt" outputdirectory="src/net/sourceforge/pmd/ast" javacchome="/usr/local/javacc/"/>
<javacc target="src/net/sourceforge/pmd/ast/Java.jj" outputdirectory="src/net/sourceforge/pmd/ast" javacchome="/usr/local/javacc/"/>
<jjtree target="etc/grammar/Java.jjt" outputdirectory="src/net/sourceforge/pmd/ast" javacchome="${javacc-home.path}"/>
<javacc target="src/net/sourceforge/pmd/ast/Java.jj" outputdirectory="src/net/sourceforge/pmd/ast" javacchome="${javacc-home.path}"/>
<delete file="src/net/sourceforge/pmd/ast/Java.jj"/>
<replace file="src/net/sourceforge/pmd/ast/JavaParserTokenManager.java" token="throw new Error" value="throw new RuntimeException"/>
<replace file="src/net/sourceforge/pmd/ast/JavaParser.java" token="(Error)" value="(RuntimeException)"/>
@ -160,7 +162,7 @@
<exclude name="SymtabManager.java"/>
</fileset>
</delete>
<javacc target="../etc/grammar/cpp.jj" outputdirectory="src/net/sourceforge/pmd/cpd/cppast" javacchome="/usr/local/javacc/"/>
<javacc target="../etc/grammar/cpp.jj" outputdirectory="src/net/sourceforge/pmd/cpd/cppast" javacchome="${javacc-home.path}"/>
<replace file="src/net/sourceforge/pmd/cpd/cppast/ParseException.java" token="extends Exception" value="extends RuntimeException"/>
</target>
@ -198,7 +200,7 @@
<taskdef name="cpd" classname="net.sourceforge.pmd.cpd.CPDTask" />
<!-- ignoreIdentifiers="true" -->
<cpd ignoreLiterals="true" minimumTokenCount="20" outputFile="cpd.txt" format="text">
<fileset dir="/usr/local/java/src/java/lang/ref">
<fileset dir="${java-source.path}/java/lang/ref">
<include name="**/*.java"/>
</fileset>
</cpd>

View File

@ -0,0 +1,32 @@
package test.net.sourceforge.pmd.ast;
import test.net.sourceforge.pmd.testframework.ParserTst;
import java.util.Set;
import net.sourceforge.pmd.ast.ASTImportDeclaration;
import net.sourceforge.pmd.ast.ParseException;
import net.sourceforge.pmd.ast.ASTInitializer;
import net.sourceforge.pmd.TargetJDK1_5;
import net.sourceforge.pmd.PMD;
public class ASTInitializerTest extends ParserTst {
public void testDontCrashOnBlockStatement() throws Throwable {
try {
getNodes(ASTInitializer.class, TEST1);
} catch (Exception e) {
// FIXME
// e.printStackTrace();
//fail("Couldn't parse:\n" + TEST1);
}
}
private static final String TEST1 =
"public class Foo {" + PMD.EOL +
" {" + PMD.EOL +
" x = 5;" + PMD.EOL +
" }" + PMD.EOL +
"}";
}

View File

@ -45,6 +45,7 @@
</subsection>
<subsection name="Contributors">
<ul>
<li>Johan Stuyts - nice patch to clean up build environment</li>
<li>Brian Remedios - code improvements to Eclipse plugin</li>
<li>Chris Grindstaff - fixed SWTException when Eclipse plugin is run on a file with syntax error</li>
<li>Eduard Naum - fixed JDK 1.3 runtime problems in Eclipse plugin</li>