Commit e645107d authored by John Zhang's avatar John Zhang

pmd: new workload in directories

- small and default are from PMD 5.8.1 source
- large contains large (>500k) Java sources from Eclipse
parent e6c4ee89
......@@ -68,25 +68,7 @@
</target>
<target name="data">
<property name="pmd-data" value="${bm-build-top}/data/pmd"/>
<mkdir dir="${pmd-data}"/>
<copy todir="${pmd-data}">
<fileset dir="${bm-build-top}">
<include name="**/*.java"/>
</fileset>
</copy>
<copy todir="${pmd-data}">
<fileset dir="${bm-build-top}/pmd-java/src/main/resources">
<include name="rulesets/**/*"/>
</fileset>
</copy>
<copy todir="${pmd-data}" >
<fileset dir="${bm-data}/pmd">
<include name="*.lst"/>
</fileset>
</copy>
<zip basedir="${bm-build-top}/data" includes="pmd/**" destfile="${bm-dat}/pmd.zip"/>
<delete dir="${bm-build-top}/data"/>
<zip destfile="${bm-dat}/pmd.zip" basedir="${bm-data}" includes="pmd/**/*"/>
</target>
<target name="libs">
......
This diff is collapsed.
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd;
/**
* Base configuration class for both PMD and CPD.
*
* @author Brian Remedios
*/
public abstract class AbstractConfiguration {
private String sourceEncoding = System.getProperty("file.encoding");
private boolean debug;
/**
* Create a new abstract configuration.
*/
protected AbstractConfiguration() {
super();
}
/**
* 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;
}
/**
* Return the debug indicator. If this value is <code>true</code> then PMD
* will log debug information.
*
* @return <code>true</code> if debug logging is enabled, <code>false</code>
* otherwise.
*/
public boolean isDebug() {
return debug;
}
/**
* Set the debug indicator.
*
* @param debug
* The debug indicator to set.
* @see #isDebug()
*/
public void setDebug(boolean debug) {
this.debug = debug;
}
}
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sourceforge.pmd.util.CollectionUtil;
/**
* Base class for objects which can be configured through properties. Rules and
* Reports are such objects.
*
* @author Brian Remedios
*/
public abstract class AbstractPropertySource implements PropertySource {
/** The list of known properties that can be configured. */
protected List<PropertyDescriptor<?>> propertyDescriptors = new ArrayList<>();
/** The values for each property. */
protected Map<PropertyDescriptor<?>, Object> propertyValuesByDescriptor = new HashMap<>();
/**
* Creates a copied list of the property descriptors and returns it.
*
* @return a copy of the property descriptors.
*/
protected List<PropertyDescriptor<?>> copyPropertyDescriptors() {
return new ArrayList<>(propertyDescriptors);
}
/**
* Creates a copied map of the values of the properties and returns it.
*
* @return a copy of the values
*/
protected Map<PropertyDescriptor<?>, Object> copyPropertyValues() {
return new HashMap<>(propertyValuesByDescriptor);
}
/**
* {@inheritDoc}
*/
@Override
public Set<PropertyDescriptor<?>> ignoredProperties() {
return Collections.emptySet();
}
/**
* {@inheritDoc}
*/
@Override
public void definePropertyDescriptor(PropertyDescriptor<?> propertyDescriptor) {
// Check to ensure the property does not already exist.
for (PropertyDescriptor<?> descriptor : propertyDescriptors) {
if (descriptor.name().equals(propertyDescriptor.name())) {
throw new IllegalArgumentException("There is already a PropertyDescriptor with name '"
+ propertyDescriptor.name() + "' defined on Rule " + getName() + ".");
}
}
propertyDescriptors.add(propertyDescriptor);
// Sort in UI order
Collections.sort(propertyDescriptors);
}
/**
* Gets the name of the property source. This is e.g. the rule name or the
* report name.
*
* @return the name
*/
public abstract String getName();
/**
* {@inheritDoc}
*/
@Override
public PropertyDescriptor<?> getPropertyDescriptor(String name) {
for (PropertyDescriptor<?> propertyDescriptor : propertyDescriptors) {
if (name.equals(propertyDescriptor.name())) {