Remove support for Java 1.4 runtime. Primarily this entails removal of the build processes and scripts used to support running with retroweaver. Additional changes are made to code which made checks for running on a 1.4 JVM (found via searches).

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6565 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Ryan Gustafson committed 2008-10-06 05:20:27 +00:00
1 parent c1f5d18669
commit 302e38ba8d
36 files changed
+123 -729

No files matched your search

+2 -98
View File
@@ -3,7 +3,6 @@
<property file="local.properties" />
<property name="dir.lib" value="${basedir}/lib" />
<property name="dir.lib14" value="${basedir}/java14/lib" />
<property name="dir.src" value="src" />
<property name="dir.build" value="build" />
<property name="dir.rulesets" value="rulesets" />
@@ -20,7 +19,6 @@
<property name="jaxen.version" value="1.1.1" />
<property name="saxon.version" value="9" />
<property name="junit.version" value="4.4" />
<property name="retroweaver.version" value="2.0.6" />
<property name="javacc-home.path" value="${dir.lib}" />
<!--Settings-->
@@ -41,9 +39,6 @@
<delete file="${dir.lib}/pmd-${version}.jar" />
<delete file="${dir.lib}/pmd-src-${version}.jar" />
<delete file="${dir.lib}/pmd-test-${version}.jar" />
<delete file="${dir.lib14}/pmd14-${version}.jar" />
<delete file="${dir.lib14}/pmd14-test-${version}.jar" />
<delete file="${dir.lib14}/junit.jar" />
<delete dir="${dir.api}" />
<mkdir dir="${dir.build}" />
</target>
@@ -98,58 +93,6 @@
basedir="${dir.build}" />
</target>
<taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask">
<classpath>
<pathelement location="${dir.lib14}/retroweaver-${retroweaver.version}.jar"/>
<pathelement location="${dir.lib14}/retroweaver-rt-${retroweaver.version}.jar"/>
<pathelement location="${dir.lib14}/backport-util-concurrent.jar"/>
<pathelement location="${dir.lib14}/asm-commons-${asm.version}.jar"/>
<pathelement location="${dir.lib14}/asm-util-${asm.version}.jar"/>
<pathelement location="${dir.lib}/asm-${asm.version}.jar"/>
</classpath>
</taskdef>
<target name="weavejunit" depends="jar">
<path id="retroweaverclasspath">
<pathelement location="${dir.lib14}/retroweaver-rt-${retroweaver.version}.jar"/>
<pathelement location="${dir.lib14}/backport-util-concurrent.jar"/>
<pathelement location="${dir.lib}/asm-${asm.version}.jar"/>
<pathelement location="${jvm14.runtime}" />
<pathelement location="${dir.lib14}/junit.jar" />
</path>
<retroweaver inputjar="${dir.lib}/junit-${junit.version}.jar" outputjar="${dir.lib14}/junit.jar" target="1.4" failonerror="true" verify="true">
<classpath refid="retroweaverclasspath" />
</retroweaver>
</target>
<target name="weave" depends="jar, weavejunit">
<fail unless="ant.jar" message="ant.jar location is not defined properly" />
<fail unless="jvm14.runtime" message="jvm14.runtime (i.e. rt.jar) location is not defined properly" />
<path id="retroweaverclasspath">
<pathelement location="${dir.lib14}/pmd14-${version}.jar" />
<pathelement location="${dir.lib14}/pmd14-test-${version}.jar" />
<pathelement location="${dir.lib14}/retroweaver-rt-${retroweaver.version}.jar"/>
<pathelement location="${dir.lib14}/backport-util-concurrent.jar"/>
<pathelement location="${dir.lib}/asm-${asm.version}.jar"/>
<pathelement location="${jvm14.runtime}" />
<pathelement location="${dir.lib}/jaxen-${jaxen.version}.jar" />
<pathelement location="${dir.lib}/saxon${saxon.version}.jar" />
<pathelement location="${dir.lib14}/junit.jar" />
<pathelement location="${ant.jar}" />
<pathelement location="${ant-testutil.jar}" />
</path>
<retroweaver inputjar="${dir.lib}/pmd-${version}.jar" outputjar="${dir.lib14}/pmd14-${version}.jar" target="1.4" failonerror="true" verify="true">
<classpath refid="retroweaverclasspath" />
</retroweaver>
<retroweaver inputjar="${dir.lib}/pmd-test-${version}.jar" outputjar="${dir.lib14}/pmd14-test-${version}.jar" target="1.4" failonerror="true" verify="true">
<classpath refid="retroweaverclasspath" />
</retroweaver>
</target>
<target name="jarsrc" depends="copy,compile" description="Jars up the source directory">
<jar jarfile="${dir.lib}/pmd-src-${version}.jar" basedir="${dir.src}" />
</target>
@@ -313,45 +256,6 @@
</concat>
</target>
<path id="dependencies14.path">
<fileset dir="${dir.lib14}">
<include name="backport-util-concurrent.jar" />
<include name="pmd14-${version}.jar" />
<include name="pmd14-test-${version}.jar" />
<include name="retroweaver-rt-${retroweaver.version}.jar" />
<include name="junit.jar" />
</fileset>
<fileset dir="${dir.lib}">
<include name="jaxen-${jaxen.version}.jar" />
<include name="saxon${saxon.version}.jar" />
<include name="asm-${asm.version}.jar" />
</fileset>
</path>
<target name="test14" depends="requires-junit,compile,copy,weavejunit,weave" description="Runs the unit tests with 1.4 jvm">
<fail unless="jvm14.exe" message="jvm14.exe location is not defined properly" />
<antcall target="test-execute">
<param name="test.outputdir" value="${dir.reports}/test14"/>
<param name="test.jvm" value="${jvm14.exe}"/>
<param name="test.dependencies" value="dependencies14.path"/>
<param name="test.regression" value="false"/>
<param name="test.printsummary" value="true"/>
</antcall>
</target>
<target name="regress14" depends="requires-junit,compile,copy,weavejunit,weave" description="Runs the regression unit tests with 1.4 jvm">
<fail unless="jvm14.exe" message="jvm14.exe location is not defined properly" />
<antcall target="test-execute">
<param name="test.outputdir" value="${dir.reports}/regress14"/>
<param name="test.jvm" value="${jvm14.exe}"/>
<param name="test.dependencies" value="dependencies14.path"/>
<param name="test.regression" value="true"/>
<param name="test.printsummary" value="false"/>
</antcall>
</target>
<target name="symtabtest" depends="compile" description="Runs the unit tests for the symboltable package">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
@@ -527,7 +431,7 @@ public class]]></replacevalue>
<target name="recompile" depends="clean,compile,copy" description="Does a complete recompile" />
<target name="dist" depends="recompile,jar,weave" description="Preps things for a release" />
<target name="dist" depends="recompile,jar" description="Preps things for a release" />
<target name="cpdjnlp" depends="dist" description="Uploads a new CPD JNLP thingy to the PMD web site">
<signjar jar="${dir.lib}/pmd-${version}.jar" storetype="${keystore.type}" alias="${keystore.alias}" keystore="${keystore.path}" storepass="${keystore.password}" />
@@ -582,6 +486,6 @@ public class]]></replacevalue>
</javadoc>
</target>
<target name="qa" depends="dist, regress, regress14, pmdOnPmd, cpdOnPmd, symtabtest, dfatest, cpdtest, javadoc" description="Runs all tests (used for continuous integration tests)"/>
<target name="qa" depends="dist, regress, pmdOnPmd, cpdOnPmd, symtabtest, dfatest, cpdtest, javadoc" description="Runs all tests (used for continuous integration tests)"/>
</project>
-4
View File
@@ -18,8 +18,6 @@ if [ -z $option ]; then
elif [ $option = "uploadcurrent" ]; then
echo "Generating and uploading maven artifacts"
mvn -Prelease -q source:jar javadoc:jar deploy
ant -f tools/ant/generate-jdk4-pom.xml
mvn -Prelease -q deploy:deploy-file -Durl=scp://pmd.sourceforge.net/home/groups/p/pm/pmd/htdocs/maven2 -DrepositoryId=pmd-repo -Dfile=java14/lib/pmd14-${currentVersion}.jar -DpomFile=target/pmd-jdk14-pom.xml
echo "Generating xdocs and uploading"
mvn site
tarball-docs 'pmd.sourceforge.net:/home/groups/p/pm/pmd/htdocs/current/'
@@ -28,8 +26,6 @@ elif [ $option = "upload" ]; then
echo "Generating and uploading maven artifacts"
mvn -Prelease -q source:jar javadoc:jar deploy
mkdir -p target
ant -f tools/ant/generate-jdk4-pom.xml
mvn -Prelease -q deploy:deploy-file -Durl=scp://pmd.sourceforge.net/home/groups/p/pm/pmd/htdocs/maven2 -DrepositoryId=pmd-repo -Dfile=java14/lib/pmd14-${currentVersion}.jar -DpomFile=target/pmd-jdk14-pom.xml
echo "Uploading xdocs"
tarball-docs 'pmd.sourceforge.net:/home/groups/p/pm/pmd/'
ssh pmd.sourceforge.net "cd /home/groups/p/pm/pmd/ && rm -rf xref && rm -rf apidocs && ./update_docs.sh"
+3 -1
View File
@@ -437,7 +437,9 @@ Fixed false negative in UselessOverridingMethod
Fixed handling of escape characters in UseIndexOfChar and AppendCharacterWithChar
Fixed ClassCastException on generic method in BeanMembersShouldSerialize
Fixed ClassCastException in symbol table code
retroweaver updated to version 2.0.6.
Support for Java 1.4 runtime dropped, PMD now requires Java 5 or higher. PMD can still process Java 1.4 source files.
java4,Javafour,1.4,weave,retro,jdk4
New Java rules:
-12
View File
@@ -1,12 +0,0 @@
@echo off
set TOPDIR=%~dp0/../..
set VERSION=5.0
set PMDJAR=%TOPDIR%/java14/lib/pmd14-%VERSION%.jar
set JARPATH=%TOPDIR%/lib/asm-3.1.jar;%TOPDIR%/lib/jaxen-1.1.1.jar
set RWPATH=%TOPDIR%/java14/lib/retroweaver-rt-2.0.6.jar;%TOPDIR%/java14/lib/backport-util-concurrent.jar
set JARPATH=%JARPATH%;%RWPATH%
set OPTS=
set MAIN_CLASS=net.sourceforge.pmd.util.viewer.Viewer
java %OPTS% -cp "%PMDJAR%;%JARPATH%;%TOPDIR%/build" %MAIN_CLASS% %*
-11
View File
@@ -1,11 +0,0 @@
TOPDIR=../..
VERSION=5.0
PMDJAR=$TOPDIR/java14/lib/pmd14-$VERSION.jar
JARPATH=$TOPDIR/lib/asm-3.1.jar:$TOPDIR/lib/jaxen-1.1.1.jar
RWPATH=$TOPDIR/java14/lib/retroweaver-rt-2.0.6.jar:$TOPDIR/java14/lib/backport-util-concurrent.jar
JARPATH=$JARPATH:$RWPATH
OPTS=
MAIN_CLASS=net.sourceforge.pmd.util.viewer.Viewer
java $OPTS -cp $PMDJAR:$JARPATH:$TOPDIR/build $MAIN_CLASS $*
-94
View File
@@ -1,94 +0,0 @@
#!/bin/sh
## This will work in the majority of shells out there...
## This will parse a directory named on the command line and produce a
## cut and paste report for c++ files in that directory (or 'c', if you
## set the environment variable LANGUAGE to 'c').
## Note that other rules are only for Java code not C source.
## If you run into java.lang.OutOfMemoryError, try setting the environment
## variable HEAPSIZE to e.g. 512m
DIRECTORY=$1
if [ -z "$1" ]; then
script=`basename $0`
echo "Usage:"
echo " $script <directory>"
exit 1
fi
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
cd "$SCRIPT_DIR/../../lib"
LIB_DIR=`pwd -P`
cd "$CWD"
cd "$SCRIPT_DIR/../lib"
RW_LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
for jarfile in `ls $RW_LIB_DIR/*.jar`; do
classpath=$classpath:$jarfile
done
build_dir="$SCRIPT_DIR/../../build"
if [ -d "$build_dir" ]; then
cd "$build_dir"
build_dir=`pwd -P`
classpath=$classpath:$build_dir
fi
cd "$CWD"
for jarfile in `ls $LIB_DIR/*.jar`; do
classpath=$classpath:$jarfile
done
HEAPSIZE=${HEAPSIZE:-512m}
LANGUAGE=${LANGUAGE:-cpp}
MINIMUM_TOKENS=${MINIMUM_TOKENS:-100}
case "$HEAPSIZE" in
[1-9]*[mgMG]) HEAPSIZE=-Xmx$HEAPSIZE ;;
'') ;;
*) echo "HEAPSIZE '$HEAPSIZE' unknown (try: 512m)"
exit 1
esac
case "$LANGUAGE" in
c|cpp|fortran|java|jsp|php|ruby) ;;
*) echo "Language '$LANGUAGE' unknown (try: c, cpp, fortran, java, jsp, php, ruby)"
exit 1
esac
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
classpath=`cygpath --path --windows "$classpath"`
DIRECTORY=`cygpath --windows "$DIRECTORY"`
fi
java $HEAPSIZE -cp $classpath net.sourceforge.pmd.cpd.CPD --minimum-tokens $MINIMUM_TOKENS --files $DIRECTORY --language $LANGUAGE
-12
View File
@@ -1,12 +0,0 @@
@echo off
set TOPDIR=%~dp0/../..
set VERSION=5.0
set PMDJAR=%TOPDIR%/java14/lib/pmd14-%VERSION%.jar
set JARPATH=%TOPDIR%/lib/asm-3.1.jar;%TOPDIR%/lib/jaxen-1.1.1.jar
set RWPATH=%TOPDIR%/java14/lib/retroweaver-rt-2.0.6.jar;%TOPDIR%/java14/lib/backport-util-concurrent.jar
set JARPATH=%JARPATH%;%RWPATH%
set OPTS=-Xmx512m
set MAIN_CLASS=net.sourceforge.pmd.cpd.GUI
java %OPTS% -cp "%PMDJAR%;%JARPATH%" %MAIN_CLASS% %*
-12
View File
@@ -1,12 +0,0 @@
@echo off
set TOPDIR=%~dp0/../..
set VERSION=5.0
set PMDJAR=%TOPDIR%/java14/lib/pmd14-%VERSION%.jar
set JARPATH=%TOPDIR%/lib/asm-3.1.jar;%TOPDIR%/lib/jaxen-1.1.1.jar
set RWPATH=%TOPDIR%/java14/lib/retroweaver-rt-2.0.6.jar;%TOPDIR%/java14/lib/backport-util-concurrent.jar
set JARPATH=%JARPATH%;%RWPATH%
set OPTS=
set MAIN_CLASS=net.sourceforge.pmd.util.designer.Designer
java %OPTS% -cp "%PMDJAR%;%JARPATH%;%TOPDIR%/build" %MAIN_CLASS% %*
-61
View File
@@ -1,61 +0,0 @@
#!/bin/bash
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
cd "$SCRIPT_DIR/../../lib"
LIB_DIR=`pwd -P`
cd "$CWD"
cd "$SCRIPT_DIR/../lib"
RW_LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
for jarfile in `ls $RW_LIB_DIR/*.jar`; do
classpath=$classpath:$jarfile
done
build_dir="$SCRIPT_DIR/../../build"
if [ -d "$build_dir" ]; then
cd "$build_dir"
build_dir=`pwd -P`
classpath=$classpath:$build_dir
fi
cd "$CWD"
for jarfile in `ls $LIB_DIR/*.jar`; do
classpath=$classpath:$jarfile
done
FILE=$1
shift
FORMAT=$1
shift
RULESETFILES="$@"
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
classpath=`cygpath --path --windows "$classpath"`
fi
java -cp $classpath net.sourceforge.pmd.util.designer.Designer
-12
View File
@@ -1,12 +0,0 @@
@echo off
set TOPDIR=%~dp0/../..
set VERSION=5.0
set PMDJAR=%TOPDIR%/java14/lib/pmd14-%VERSION%.jar
set JARPATH=%TOPDIR%/lib/asm-3.1.jar;%TOPDIR%/lib/jaxen-1.1.1.jar
set RWPATH=%TOPDIR%/java14/lib/retroweaver-rt-2.0.6.jar;%TOPDIR%/java14/lib/backport-util-concurrent.jar
set JARPATH=%JARPATH%;%RWPATH%
set OPTS=
set MAIN_CLASS=net.sourceforge.pmd.PMD
java %OPTS% -cp "%PMDJAR%;%JARPATH%;%CLASSPATH%" %MAIN_CLASS% %*
-70
View File
@@ -1,70 +0,0 @@
#!/bin/bash
if [ -z "$3" ]; then
script=`basename $0`
echo "Usage:"
echo " $script <java-src-file> html|xml|text|vbhtml rulesetfile1[,rulesetfile2[,..]]"
exit 1
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
cd "$SCRIPT_DIR/../../lib"
LIB_DIR=`pwd -P`
cd "$CWD"
cd "$SCRIPT_DIR/../lib"
RW_LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
for jarfile in `ls $RW_LIB_DIR/*.jar`; do
classpath=$classpath:$jarfile
done
build_dir="$SCRIPT_DIR/../../build"
if [ -d "$build_dir" ]; then
cd "$build_dir"
build_dir=`pwd -P`
classpath=$classpath:$build_dir
fi
cd "$CWD"
for jarfile in `ls $LIB_DIR/*.jar`; do
classpath=$classpath:$jarfile
done
FILE=$1
shift
FORMAT=$1
shift
RULESETFILES="$@"
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
classpath=`cygpath --path --windows "$classpath"`
FILE=`cygpath --windows "$FILE"`
fi
java -Xmx512m -cp $classpath net.sourceforge.pmd.PMD $FILE $FORMAT $RULESETFILES
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -43,28 +43,14 @@ import net.sourceforge.pmd.lang.rule.RuleReference;
import net.sourceforge.pmd.lang.rule.XPathRule;
import net.sourceforge.pmd.util.ResourceLoader;
import org.junit.Before;
import org.junit.Test;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import test.net.sourceforge.pmd.testframework.TestDescriptor;
public class RuleSetFactoryTest {
private boolean isJdk14;
@Before
public void setUp() {
try {
Class.forName("java.lang.Appendable");
} catch (Throwable t) {
isJdk14 = true;
}
}
@Test
public void testRuleSetFileName() throws RuleSetNotFoundException {
RuleSet rs = loadRuleSet(EMPTY_RULESET);
@@ -377,11 +363,6 @@ public class RuleSetFactoryTest {
@Test
public void testXmlSchema() throws IOException, RuleSetNotFoundException, ParserConfigurationException,
SAXException {
if (isJdk14) {
// ignore failure with jdk 1.4
return;
}
boolean allValid = true;
List<String> ruleSetFileNames = getRuleSetFileNames();
for (String fileName : ruleSetFileNames) {
@@ -412,18 +393,6 @@ public class RuleSetFactoryTest {
}
}
@Test
public void testWindowsJdk14Bug() throws IOException, RuleSetNotFoundException, ParserConfigurationException,
SAXException {
if (TestDescriptor.inRegressionTestMode()) {
// skip this test if we're only running regression tests
return;
}
// This fails only on Windows running the weaved pmd version
testRuleSet("regress/test/net/sourceforge/pmd/xml/j2ee.xml");
}
public void testRuleSet(String fileName) throws IOException, RuleSetNotFoundException,
ParserConfigurationException, SAXException {
@@ -460,12 +429,10 @@ public class RuleSetFactoryTest {
RuleSet ruleSet3 = ruleSetFactory.createRuleSet(new ByteArrayInputStream(outputStream2.toByteArray()));
// The 2 written XMLs should all be valid w.r.t Schema/DTD
if (!isJdk14) {
assertTrue("1st roundtrip RuleSet XML is not valid against Schema",
validateAgainstSchema(new ByteArrayInputStream(xml2.getBytes())));
assertTrue("2nd roundtrip RuleSet XML is not valid against Schema",
validateAgainstSchema(new ByteArrayInputStream(xml3.getBytes())));
}
assertTrue("1st roundtrip RuleSet XML is not valid against Schema",
validateAgainstSchema(new ByteArrayInputStream(xml2.getBytes())));
assertTrue("2nd roundtrip RuleSet XML is not valid against Schema",
validateAgainstSchema(new ByteArrayInputStream(xml3.getBytes())));
assertTrue("1st roundtrip RuleSet XML is not valid against DTD", validateAgainstDtd(new ByteArrayInputStream(
xml2.getBytes())));
assertTrue("2nd roundtrip RuleSet XML is not valid against DTD", validateAgainstDtd(new ByteArrayInputStream(
@@ -12,32 +12,9 @@ import org.junit.runners.Suite.SuiteClasses;
* Tests for the net.sourceforge.pmd.ant package
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
@RunWith(Suite.class)
@SuiteClasses({FormatterTest.class, PMDTaskTest.class})
public class AntTests {
}
/*
* $Log$
* Revision 1.6 2007/02/09 01:37:59 allancaplan
* Moving to JUnit 4
*
* Revision 1.5 2006/02/10 14:26:25 tomcopeland
* Huge reformatting checkin
*
* Revision 1.4 2006/02/10 14:15:19 tomcopeland
* Latest source from Pieter, everything compiles and all the tests pass with the exception of a few missing rules in basic-jsp.xml
*
* Revision 1.3 2003/11/20 16:01:01 tomcopeland
* Changing over license headers in the source code
*
* Revision 1.2 2003/10/07 18:49:19 tomcopeland
* Added copyright headers
*
* Revision 1.1 2003/09/29 14:32:30 tomcopeland
* Committed regression test suites, thanks to Boris Gruschko
*
*/
@@ -12,26 +12,3 @@ import org.junit.runners.Suite.SuiteClasses;
public class ASTTests {
}
/*
* $Log$
* Revision 1.6 2007/02/09 01:38:05 allancaplan
* Moving to JUnit 4
*
* Revision 1.5 2006/02/10 14:26:25 tomcopeland
* Huge reformatting checkin
*
* Revision 1.4 2006/02/10 14:15:19 tomcopeland
* Latest source from Pieter, everything compiles and all the tests pass with the exception of a few missing rules in basic-jsp.xml
*
* Revision 1.3 2004/04/08 18:51:07 tomcopeland
* Implemented RFE 925839 - Added some more detail to the UseSingletonRule.
*
* Revision 1.2 2003/11/20 16:01:02 tomcopeland
* Changing over license headers in the source code
*
* Revision 1.1 2003/09/29 14:32:31 tomcopeland
* Committed regression test suites, thanks to Boris Gruschko
*
*/
@@ -12,37 +12,8 @@ import org.junit.runners.Suite.SuiteClasses;
* tests for the net.sourceforge.pmd.renderers package
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
@RunWith(Suite.class)
@SuiteClasses({CSVRendererTest.class, EmacsRendererTest.class, XMLRendererTest.class, TextPadRendererTest.class})
public class RenderersTests {
}
/*
* $Log$
* Revision 1.7 2007/02/09 01:38:02 allancaplan
* Moving to JUnit 4
*
* Revision 1.6 2006/10/13 23:49:38 allancaplan
* Improving JUnit tests
*
* I went over the output, it looks correct. For many, having a test will help down the road to throw a flag if anything changes
*
* Revision 1.5 2006/02/10 14:26:25 tomcopeland
* Huge reformatting checkin
*
* Revision 1.4 2006/02/10 14:15:20 tomcopeland
* Latest source from Pieter, everything compiles and all the tests pass with the exception of a few missing rules in basic-jsp.xml
*
* Revision 1.3 2003/11/20 16:53:10 tomcopeland
* Changing over license headers in the source code, cleaned up a test
*
* Revision 1.2 2003/10/01 14:55:55 tomcopeland
* Added unit tests for TextPad integration; thanks to Jeff Epstein
*
* Revision 1.1 2003/09/29 14:32:32 tomcopeland
* Committed regression test suites, thanks to Boris Gruschko
*
*/
@@ -9,26 +9,8 @@ import org.junit.runners.Suite.SuiteClasses;
* tests for the net.sourceforge.pmd.stat package
*
* @author Boris Gruschko ( boris at gruschko.org )
* @version $Id$
*/
@RunWith(Suite.class)
@SuiteClasses({MetricTest.class, StatisticalRuleTest.class})
public class StatTests {
}
/*
* $Log$
* Revision 1.4 2007/02/09 01:38:09 allancaplan
* Moving to JUnit 4
*
* Revision 1.3 2006/02/10 14:26:27 tomcopeland
* Huge reformatting checkin
*
* Revision 1.2 2006/02/10 14:15:22 tomcopeland
* Latest source from Pieter, everything compiles and all the tests pass with the exception of a few missing rules in basic-jsp.xml
*
* Revision 1.1 2003/09/29 14:32:32 tomcopeland
* Committed regression test suites, thanks to Boris Gruschko
*
*/
@@ -77,6 +77,9 @@ public abstract class SimpleAggregatorTst extends RuleTst {
}
} catch (Throwable t) {
Failure f = CustomXmlTestClassMethodsRunner.createFailure(r, t);
System.out.println("-----");
System.out.println(f.getTestHeader());
System.out.println(f.getMessage());
l.add(f);
}
}
@@ -44,17 +44,6 @@ import test.net.sourceforge.pmd.typeresolution.testdata.Promotion;
public class ClassTypeResolverTest {
private boolean isJdk14;
@Before
public void setUp() {
try {
Class.forName("java.lang.Appendable");
} catch (Throwable t) {
isJdk14 = true;
}
}
@Test
public void testClassNameExists() {
ClassTypeResolver classTypeResolver = new ClassTypeResolver();
@@ -248,14 +237,9 @@ public class ClassTypeResolverTest {
assertEquals(0, literals.get(index).jjtGetNumChildren());
assertEquals(Float.TYPE, literals.get(index++).getType());
// No hex floating point literals in Java 1.4
if (!isJdk14) {
// float float3 = 0x08.08p3f;
assertEquals(0, literals.get(index).jjtGetNumChildren());
assertEquals(Float.TYPE, literals.get(index++).getType());
} else {
index++;
}
// float float3 = 0x08.08p3f;
assertEquals(0, literals.get(index).jjtGetNumChildren());
assertEquals(Float.TYPE, literals.get(index++).getType());
// float float4 = 0xFF;
assertEquals(0, literals.get(index).jjtGetNumChildren());
@@ -273,14 +257,9 @@ public class ClassTypeResolverTest {
assertEquals(0, literals.get(index).jjtGetNumChildren());
assertEquals(Double.TYPE, literals.get(index++).getType());
// No hex floating point literals in Java 1.4
if (!isJdk14) {
// double double3 = 0x08.08p3;
assertEquals(0, literals.get(index).jjtGetNumChildren());
assertEquals(Double.TYPE, literals.get(index++).getType());
} else {
index++;
}
// double double3 = 0x08.08p3;
assertEquals(0, literals.get(index).jjtGetNumChildren());
assertEquals(Double.TYPE, literals.get(index++).getType());
// double double4 = 0xFF;
assertEquals(0, literals.get(index).jjtGetNumChildren());
+12
View File
@@ -183,5 +183,17 @@
</rule>
<rule ref="rulesets/useless.xml"/>
<!-- Don't let the Language specific APIs leak out -->
<!--
<rule name="LanguageLoosePackageCoupling" ref="rulesets/coupling.xml/LoosePackageCoupling">
<properties>
<property name="packages"><value>net.sourceforge.pmd.lang,net.sourceforge.pmd.lang.java,net.sourceforge.pmd.lang.jsp,net.sourceforge.pmd.lang.ecmascript,net.sourceforge.pmd.lang.cpp</value></property>
<property name="classes">
<value>net.sourceforge.pmd.lang.Language,net.sourceforge.pmd.lang.LanguageVersion,net.sourceforge.pmd.lang.LanguageVersionDiscoverer,net.sourceforge.pmd.lang.LanguageVersionHandler,net.sourceforge.pmd.lang.Parser,net.sourceforge.pmd.lang.ast.Node</value>
</property>
</properties>
</rule>
-->
</ruleset>
+89 -9
View File
@@ -10,7 +10,6 @@ import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.LanguageVersionDiscoverer;
import net.sourceforge.pmd.util.ClasspathClassLoader;
/**
* This class contains the details for the runtime configuration of PMD.
* There are several aspects to the configuration of PMD.
@@ -34,13 +33,12 @@ import net.sourceforge.pmd.util.ClasspathClassLoader;
* The aspects related to Rules and Source files are:
* <ul>
* <li>A comma separated list of RuleSets URIs.</li>
* <li>A minimum priority filter when loading Rules from RuleSets,
* <li>A minimum priority threshold when loading Rules from RuleSets,
* defaults to {@link RulePriority#LOW}.</li>
* <li></li>
* <li></li>
* <li></li>
* <li></li>
* <li></li>
* <li>The character encoding of source files, defaults to the system default
* as returned by <code>System.getProperty("file.encoding")</code>.</li>
* <li>A comma separated list of input paths to process for source files.
* This may include files, directories, archives (e.g. ZIP files), etc.</li>
* </ul>
* <p>
* The aspects related to Reporting are:
@@ -48,6 +46,8 @@ import net.sourceforge.pmd.util.ClasspathClassLoader;
* <li></li>
* <li></li>
* <li></li>
* <li>An indicator of whether to use File short names in Reports, defaults
* to <code>false</code>.</li>
* <li></li>
* <li></li>
* </ul>
@@ -74,14 +74,14 @@ public class Configuration {
// Rule and source file options
private String ruleSets;
private RulePriority minPriority = RulePriority.LOW;
private boolean shortNames;
private String inputPath;
private String sourceEncoding = new InputStreamReader(System.in).getEncoding();
private String inputPaths;
// Reporting options
private String reportFormat;
private String reportEncoding;
private String reportFile;
private boolean shortNames;
private String linePrefix;
private String linkPrefix;
private String xsltFilename;
@@ -244,4 +244,84 @@ public class Configuration {
}
return classLoader;
}
/**
* Get the comma separated list of RuleSets URIs.
* @return The RuleSet URIs.
*/
public String getRuleSets() {
return ruleSets;
}
/**
* Set the command separated list of RuleSet URIs.
* @param ruleSets
*/
public void setRuleSets(String ruleSets) {
this.ruleSets = ruleSets;
}
/**
* Get the minimum priority threshold when loading Rules from RuleSets.
* @return The minimum priority threshold.
*/
public RulePriority getMinPriority() {
return minPriority;
}
/**
* Set the minimum priority threshold when loading Rules from RuleSets.
* @param minPriority The minimum priority.
*/
public void setMinPriority(RulePriority minPriority) {
this.minPriority = minPriority;
}
/**
* Get the character encoding of source files.
* @return The character encoding.
*/
public String getSourceEncoding() {
return sourceEncoding;
}
/**
* Set the character encoding of source files.
* @param sourceEncoding The character encoding.
*/
public void setSourceEncoding(String sourceEncoding) {
this.sourceEncoding = sourceEncoding;
}
/**
* Get the comma separated list of input paths to process for source files.
* @return A comma separated list.
*/
public String getInputPaths() {
return inputPaths;
}
/**
* Set the comma separated list of input paths to process for source files.
* @param inputPaths The comma separated list.
*/
public void setInputPaths(String inputPaths) {
this.inputPaths = inputPaths;
}
/**
* Get whether to use File short names in Reports.
* @return <code>true</code> when using short names in reports.
*/
public boolean isShortNames() {
return shortNames;
}
/**
* Set whether to use File short names in Reports.
* @param shortNames <code>true</code> when using short names in reports.
*/
public void setShortNames(boolean shortNames) {
this.shortNames = shortNames;
}
}
@@ -61,11 +61,11 @@ public class RuleSetWriter {
document.appendChild(ruleSetElement);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute("indent-number", 3);
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
// This is as close to pretty printing as we'll get using standard Java APIs.
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.transform(new DOMSource(document), new StreamResult(outputStream));
} catch (DOMException e) {
@@ -24,8 +24,6 @@ import java.io.FileWriter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
@@ -114,7 +112,6 @@ import net.sourceforge.pmd.lang.java.symboltable.SourceFileScope;
import net.sourceforge.pmd.lang.java.symboltable.VariableNameDeclaration;
import net.sourceforge.pmd.lang.rule.XPathRule;
import net.sourceforge.pmd.lang.xpath.Initializer;
import net.sourceforge.pmd.util.NumericConstants;
import net.sourceforge.pmd.util.StringUtil;
import org.w3c.dom.Document;
@@ -712,28 +709,8 @@ public class Designer implements ClipboardOwner {
JTabbedPane tabbed = new JTabbedPane();
tabbed.addTab("Abstract Syntax Tree / XPath / Symbol Table", resultsSplitPane);
tabbed.addTab("Data Flow Analysis", dfaPanel);
try {
// Remove when minimal runtime support is >= JDK 1.4
Method setMnemonicAt = JTabbedPane.class.getMethod("setMnemonicAt", new Class[] { Integer.TYPE,
Integer.TYPE });
if (setMnemonicAt != null) {
// // Compatible with >= JDK 1.4
// tabbed.setMnemonicAt(0, KeyEvent.VK_A);
// tabbed.setMnemonicAt(1, KeyEvent.VK_D);
setMnemonicAt.invoke(tabbed, new Object[] { NumericConstants.ZERO, KeyEvent.VK_A });
setMnemonicAt.invoke(tabbed, new Object[] { NumericConstants.ONE, KeyEvent.VK_D });
}
} catch (NoSuchMethodException nsme) { // Runtime is < JDK 1.4
} catch (IllegalAccessException e) { // Runtime is >= JDK 1.4 but there was an error accessing the function
e.printStackTrace();
throw new InternalError("Runtime reports to be >= JDK 1.4 yet String.split(java.lang.String) is broken.");
} catch (IllegalArgumentException e) {
e.printStackTrace();
throw new InternalError("Runtime reports to be >= JDK 1.4 yet String.split(java.lang.String) is broken.");
} catch (InvocationTargetException e) { // Runtime is >= JDK 1.4 but there was an error accessing the function
e.printStackTrace();
throw new InternalError("Runtime reports to be >= JDK 1.4 yet String.split(java.lang.String) is broken.");
}
tabbed.setMnemonicAt(0, KeyEvent.VK_A);
tabbed.setMnemonicAt(1, KeyEvent.VK_D);
JSplitPane containerSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, controlSplitPane, tabbed);
containerSplitPane.setContinuousLayout(true);
@@ -973,14 +950,9 @@ public class Designer implements ClipboardOwner {
Source source = new DOMSource(node.getAsDocument());
Result result = new StreamResult(writer);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
try {
transformerFactory.setAttribute("indent-number", 3); //For java 5
} catch (IllegalArgumentException e) {
//Running on Java 1.4 which does not support this attribute
}
transformerFactory.setAttribute("indent-number", 3);
Transformer xformer = transformerFactory.newTransformer();
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "3"); //For java 1.4
xformer.transform(source, result);
return writer.toString();
-23
View File
@@ -1,23 +0,0 @@
<project name="generate-jdk4-pom"
default="generate-pom-java4">
<!--
This scripts required two property:
pom : orignal pom to transform
output : filename for generated pom file
-->
<target name="transform">
<delete file="${output}"/>
<xslt in="${pom}"
out="${output}"
style="../../tools/xslt/generate-pom-jdk4.xsl"/>
</target>
<target name="generate-pom-java4">
<antcall target="transform">
<param name="pom" value="../../pom.xml"/>
<param name="output" value="../../target/pom-jdk4.xml"/>
</antcall>
</target>
</project>
-5
View File
@@ -57,15 +57,10 @@ rm -f $pmd_top_dir/pmd-bin-$version.zip
mkdir -p $pmd_bin_dir/etc
mkdir $pmd_bin_dir/bin
mkdir $pmd_bin_dir/lib
mkdir -p $pmd_bin_dir/java14/lib
mkdir $pmd_bin_dir/java14/bin
cp ../LICENSE.txt changelog.txt $pmd_bin_dir/etc
cd ../bin/
cp pmd.* cpd.sh cpdgui.bat designer.* $pmd_bin_dir/bin
cd ../etc/
cp ../java14/lib/*.jar $pmd_bin_dir/java14/lib/
cp ../java14/bin/cpd* ../java14/bin/pmd.* ../java14/bin/designer.* $pmd_bin_dir/java14/bin/
chmod 755 $pmd_bin_dir/java14/bin/*
cp ../lib/pmd-$version.jar ../lib/asm-3.1.jar ../lib/jaxen-1.1.1.jar ../lib/junit-4.4.jar $pmd_bin_dir/lib/
mkdir $pmd_bin_dir/etc/xslt
cp xslt/*.xslt xslt/*.js xslt/*.gif xslt/*.css $pmd_bin_dir/etc/xslt/
-2
View File
@@ -40,8 +40,6 @@ scp -r target/release/${version}-build-${buildnumber} ${remote_host}:${remote_di
echo "Generating and uploading maven artifacts"
mvn -q -DskipTests source:jar javadoc:jar deploy
ant -f tools/ant/generate-jdk4-pom.xml
mvn -q deploy:deploy-file -Durl=scp://${remote_host}${remote_dir_home}/maven2 -DrepositoryId=pmd-snapshot-repo -Dfile=java14/lib/pmd14-${version}.jar -DpomFile=pmd-jdk14-pom.xml
echo "Uploading xdocs"
Loaded 30 of 36 files, more files were not shown because too many files have changed in this diff. Show more