diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/AbstractConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/AbstractConfiguration.java
index cb37622466..bededb0f95 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/AbstractConfiguration.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/AbstractConfiguration.java
@@ -6,7 +6,7 @@ package net.sourceforge.pmd;
/**
* Base configuration class for both PMD and CPD.
- *
+ *
* @author Brian Remedios
*/
public abstract class AbstractConfiguration {
@@ -23,7 +23,7 @@ public abstract class AbstractConfiguration {
/**
* Get the character encoding of source files.
- *
+ *
* @return The character encoding.
*/
public String getSourceEncoding() {
@@ -32,7 +32,7 @@ public abstract class AbstractConfiguration {
/**
* Set the character encoding of source files.
- *
+ *
* @param sourceEncoding
* The character encoding.
*/
@@ -43,7 +43,7 @@ public abstract class AbstractConfiguration {
/**
* Return the debug indicator. If this value is true
then PMD
* will log debug information.
- *
+ *
* @return true
if debug logging is enabled, false
* otherwise.
*/
@@ -53,7 +53,7 @@ public abstract class AbstractConfiguration {
/**
* Set the debug indicator.
- *
+ *
* @param debug
* The debug indicator to set.
* @see #isDebug()
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/AbstractPropertySource.java b/pmd-core/src/main/java/net/sourceforge/pmd/AbstractPropertySource.java
index 35c158edef..e9ee2d60d5 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/AbstractPropertySource.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/AbstractPropertySource.java
@@ -17,7 +17,7 @@ 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 {
@@ -29,7 +29,7 @@ public abstract class AbstractPropertySource implements PropertySource {
/**
* Creates a copied list of the property descriptors and returns it.
- *
+ *
* @return a copy of the property descriptors.
*/
protected List> copyPropertyDescriptors() {
@@ -38,7 +38,7 @@ public abstract class AbstractPropertySource implements PropertySource {
/**
* Creates a copied map of the values of the properties and returns it.
- *
+ *
* @return a copy of the values
*/
protected Map, Object> copyPropertyValues() {
@@ -48,6 +48,7 @@ public abstract class AbstractPropertySource implements PropertySource {
/**
* {@inheritDoc}
*/
+ @Override
public Set> ignoredProperties() {
return Collections.emptySet();
}
@@ -55,6 +56,7 @@ public abstract class AbstractPropertySource implements PropertySource {
/**
* {@inheritDoc}
*/
+ @Override
public void definePropertyDescriptor(PropertyDescriptor> propertyDescriptor) {
// Check to ensure the property does not already exist.
for (PropertyDescriptor> descriptor : propertyDescriptors) {
@@ -71,7 +73,7 @@ public abstract class AbstractPropertySource implements PropertySource {
/**
* 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();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/NumericPropertyDescriptor.java b/pmd-core/src/main/java/net/sourceforge/pmd/NumericPropertyDescriptor.java
index 06523bd207..d15703d768 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/NumericPropertyDescriptor.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/NumericPropertyDescriptor.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd;
/**
* Defines a descriptor type whose instance values are required lie within
* specified upper and lower limits.
- *
+ *
* @author Brian Remedios
*
* @param
@@ -16,14 +16,14 @@ public interface NumericPropertyDescriptor extends PropertyDes
/**
* Returns the maximum value that instances of the property can have
- *
+ *
* @return Number
*/
Number upperLimit();
/**
* Returns the minimum value that instances of the property can have
- *
+ *
* @return Number
*/
Number lowerLimit();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java
index 7670d6aa5d..89d42117e4 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java
@@ -106,7 +106,7 @@ public class PMD {
/**
* Parses the given string as a database uri and returns a list of
* datasources.
- *
+ *
* @param uriString
* the URI to parse
* @return list of data sources
@@ -153,7 +153,7 @@ public class PMD {
/**
* Helper method to get a configured parser for the requested language. The
* parser is configured based on the given {@link PMDConfiguration}.
- *
+ *
* @param languageVersion
* the requested language
* @param configuration
@@ -232,7 +232,7 @@ public class PMD {
/**
* Gets the source code processor.
- *
+ *
* @return SourceCodeProcessor
*/
public SourceCodeProcessor getSourceCodeProcessor() {
@@ -423,7 +423,7 @@ public class PMD {
/**
* Determines all the files, that should be analyzed by PMD.
- *
+ *
* @param configuration
* contains either the file path or the DB URI, from where to
* load the files
@@ -516,7 +516,7 @@ public class PMD {
/**
* Parses the command line arguments and executes PMD.
- *
+ *
* @param args
* command line arguments
* @return the exit code, where 0
means successful execution,
@@ -533,8 +533,10 @@ public class PMD {
final Handler logHandler = new ConsoleLogHandler();
final ScopedLogHandlersManager logHandlerManager = new ScopedLogHandlersManager(logLevel, logHandler);
final Level oldLogLevel = LOG.getLevel();
- LOG.setLevel(logLevel); // Need to do this, since the static logger has
- // already been initialized at this point
+ // Need to do this, since the static logger has already been initialized
+ // at this point
+ LOG.setLevel(logLevel);
+
try {
int violations = PMD.doPMD(configuration);
if (violations > 0 && configuration.isFailOnViolation()) {
@@ -554,9 +556,9 @@ public class PMD {
long end = System.nanoTime();
Benchmarker.mark(Benchmark.TotalPMD, end - start, 0);
- TextReport report = new TextReport(); // TODO get specified
- // report format from
- // config
+ // TODO get specified report format from config
+ TextReport report = new TextReport();
+
report.generate(Benchmarker.values(), System.err);
}
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java
index a4b2169256..f4fbfea0bd 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java
@@ -514,7 +514,7 @@ public class PMDConfiguration extends AbstractConfiguration {
/**
* Whether PMD should exit with status 4 (the default behavior, true) if
* violations are found or just with 0 (to not break the build, e.g.).
- *
+ *
* @return failOnViolation
*/
public boolean isFailOnViolation() {
@@ -524,7 +524,7 @@ public class PMDConfiguration extends AbstractConfiguration {
/**
* Sets whether PMD should exit with status 4 (the default behavior, true)
* if violations are found or just with 0 (to not break the build, e.g.).
- *
+ *
* @param failOnViolation
* failOnViolation
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMDException.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMDException.java
index fdd1e15541..4cadd9728d 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PMDException.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMDException.java
@@ -8,7 +8,7 @@ package net.sourceforge.pmd;
* A convenience exception wrapper. Contains the original exception, if any.
* Also, contains a severity number (int). Zero implies no severity. The higher
* the number the greater the severity.
- *
+ *
* @author Donald A. Leckie
* @version $Revision$, $Date$
* @since August 30, 2002
@@ -20,7 +20,7 @@ public class PMDException extends Exception {
/**
* Creates a new PMD exception with the specified message.
- *
+ *
* @param message
* the message
*/
@@ -31,7 +31,7 @@ public class PMDException extends Exception {
/**
* Creates a new PMD exception with the specified message and the given
* reason as root cause.
- *
+ *
* @param message
* the message
* @param reason
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptor.java b/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptor.java
index d8691c1e42..5d26eb04d4 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptor.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptor.java
@@ -11,7 +11,7 @@ import java.util.Map;
* property values for use within PMD and any associated GUIs. While concrete
* descriptor instances are static and immutable they provide validation,
* serialization, and default values for any specific datatypes.
- *
+ *
* @author Brian Remedios
* @param
*/
@@ -19,7 +19,7 @@ public interface PropertyDescriptor extends Comparable extends Comparable type();
/**
* Returns whether the property is multi-valued, i.e. an array of strings,
- *
+ *
* As unary property rule properties will return a value of one, you must
* use the get/setProperty accessors when working with the actual values.
* When working with multi-value properties then the get/setProperties
* accessors must be used.
- *
+ *
* @return boolean
*/
boolean isMultiValue();
@@ -54,7 +54,7 @@ public interface PropertyDescriptor extends Comparable extends Comparable extends Comparable extends Comparable 0.0 description 1.0 minValue -> 2.0 maxValue -> 2.1
- *
+ *
* ..would have their fields placed like:
- *
+ *
* name: [ ] description: [ ] minimum: [ ] maximum: [ ]
- *
+ *
* @return float
*/
float uiOrder();
@@ -97,7 +97,7 @@ public interface PropertyDescriptor extends Comparable extends Comparable extends Comparable extends Comparable extends Comparable extends Comparable extends Comparable
*/
Map attributeValuesById();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFactory.java
index 2d355919fe..9ed7c55997 100755
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFactory.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFactory.java
@@ -8,7 +8,7 @@ import java.util.Map;
/**
* A factory to create {@link PropertyDescriptor}s based on a map of values.
- *
+ *
* @author Brian Remedios
*/
public interface PropertyDescriptorFactory {
@@ -16,7 +16,7 @@ public interface PropertyDescriptorFactory {
/**
* The type of the value of the {@link PropertyDescriptor} created by this
* factory.
- *
+ *
* @return the type of the value.
*/
Class> valueType();
@@ -24,7 +24,7 @@ public interface PropertyDescriptorFactory {
/**
* Denote the identifiers of the expected fields paired with booleans
* denoting whether they are required (non-null) or not.
- *
+ *
* @return Map
*/
Map expectedFields();
@@ -32,7 +32,7 @@ public interface PropertyDescriptorFactory {
/**
* Create a property descriptor of the appropriate type using the values
* provided.
- *
+ *
* @param valuesById
* the map of values
* @return a new and initialized {@link PropertyDescriptor}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFields.java b/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFields.java
index 90d4de6d1a..1de85f25a9 100755
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFields.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PropertyDescriptorFields.java
@@ -8,7 +8,7 @@ import net.sourceforge.pmd.lang.rule.properties.factories.PropertyDescriptorUtil
/**
* Field names for parsing the properties out of the ruleset xml files.
- *
+ *
* @author Brian Remedios
* @see RuleSetFactory
*/
@@ -16,7 +16,7 @@ public class PropertyDescriptorFields {
/**
* The type of the property.
- *
+ *
* @see PropertyDescriptorUtil
*/
public static final String TYPE = "type";
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PropertySource.java b/pmd-core/src/main/java/net/sourceforge/pmd/PropertySource.java
index 5e79214fb8..ecabc141b7 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/PropertySource.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/PropertySource.java
@@ -11,14 +11,14 @@ import java.util.Set;
/**
* Any entity that manages a list of properties is a {@link PropertySource}.
* These are e.g. Rules and Renderers.
- *
+ *
* @author Brian Remedios
*/
public interface PropertySource {
/**
* Define a new property via a PropertyDescriptor.
- *
+ *
* @param propertyDescriptor
* The property descriptor.
* @throws IllegalArgumentException
@@ -28,7 +28,7 @@ public interface PropertySource {
/**
* Get the PropertyDescriptor for the given property name.
- *
+ *
* @param name
* The name of the property.
* @return The PropertyDescriptor for the named property, null
@@ -39,14 +39,14 @@ public interface PropertySource {
/**
* Get the PropertyDescriptors for all defined properties. The properties
* are returned sorted by UI order.
- *
+ *
* @return The PropertyDescriptors in UI order.
*/
List> getPropertyDescriptors();
/**
* Get the typed value for the given property.
- *
+ *
* @param
* The underlying type of the property descriptor.
* @param propertyDescriptor
@@ -57,7 +57,7 @@ public interface PropertySource {
/**
* Set the property value specified (will be type-checked)
- *
+ *
* @param
* The underlying type of the property descriptor.
* @param propertyDescriptor
@@ -70,14 +70,14 @@ public interface PropertySource {
/**
* Returns all the current property values for the receiver or an immutable
* empty map if none are specified.
- *
+ *
* @return all current property values or a empty map.
*/
Map, Object> getPropertiesByPropertyDescriptor();
/**
* Returns whether this Rule has the specified PropertyDescriptor.
- *
+ *
* @param descriptor
* The PropertyDescriptor for which to check.
* @return boolean true
if the descriptor is present,
@@ -87,7 +87,7 @@ public interface PropertySource {
/**
* Returns whether this Rule uses default values for properties.
- *
+ *
* @return boolean true
if the properties all have default
* values, false
otherwise.
*/
@@ -96,7 +96,7 @@ public interface PropertySource {
/**
* Clears out any user-specified value for the property allowing it to use
* the default value in the descriptor.
- *
+ *
* @param desc
* the property to clear out
*/
@@ -106,7 +106,7 @@ public interface PropertySource {
* Return the properties that are effectively ignored due to the
* configuration of the rule and values held by other properties. This can
* be used to disable corresponding widgets in a UI.
- *
+ *
* @return the properties that are ignored
*/
Set> ignoredProperties();
@@ -115,7 +115,7 @@ public interface PropertySource {
* Returns a description of why the receiver may be dysfunctional. Usually
* due to missing property values or some kind of conflict between values.
* Returns null if the receiver is ok.
- *
+ *
* @return String
*/
String dysfunctionReason();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/ReportListener.java b/pmd-core/src/main/java/net/sourceforge/pmd/ReportListener.java
index 65862f033b..ad1a383404 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/ReportListener.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/ReportListener.java
@@ -13,7 +13,7 @@ import net.sourceforge.pmd.stat.Metric;
public interface ReportListener {
/**
* A new violation has been found.
- *
+ *
* @param ruleViolation
* the found violation.
*/
@@ -21,7 +21,7 @@ public interface ReportListener {
/**
* A new metric point has been reported.
- *
+ *
* @param metric
* the metric
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/Rule.java b/pmd-core/src/main/java/net/sourceforge/pmd/Rule.java
index b21dfd6d5a..98e44a9de6 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/Rule.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/Rule.java
@@ -40,14 +40,14 @@ public interface Rule extends PropertySource {
/**
* Get the Language of this Rule.
- *
+ *
* @return the language
*/
Language getLanguage();
/**
* Set the Language of this Rule.
- *
+ *
* @param language
* the language
*/
@@ -56,14 +56,14 @@ public interface Rule extends PropertySource {
/**
* Get the minimum LanguageVersion to which this Rule applies. If this value
* is null
it indicates there is no minimum bound.
- *
+ *
* @return the minimum language version
*/
LanguageVersion getMinimumLanguageVersion();
/**
* Set the minimum LanguageVersion to which this Rule applies.
- *
+ *
* @param minimumLanguageVersion
* the minimum language version
*/
@@ -72,14 +72,14 @@ public interface Rule extends PropertySource {
/**
* Get the maximum LanguageVersion to which this Rule applies. If this value
* is null
it indicates there is no maximum bound.
- *
+ *
* @return the maximum language version
*/
LanguageVersion getMaximumLanguageVersion();
/**
* Set the maximum LanguageVersion to which this Rule applies.
- *
+ *
* @param maximumLanguageVersion
* the maximum language version
*/
@@ -94,14 +94,14 @@ public interface Rule extends PropertySource {
* or, has been renamed/moved and the old name will be completely
* removed in a future version of PMD
*
- *
+ *
* @return true
if this rule is deprecated
*/
boolean isDeprecated();
/**
* Sets whether this Rule is deprecated.
- *
+ *
* @param deprecated
* whether this rule is deprecated
*/
@@ -109,14 +109,14 @@ public interface Rule extends PropertySource {
/**
* Get the name of this Rule.
- *
+ *
* @return the name
*/
String getName();
/**
* Set the name of this Rule.
- *
+ *
* @param name
* the name
*/
@@ -125,14 +125,14 @@ public interface Rule extends PropertySource {
/**
* Get the version of PMD in which this Rule was added. Return
* null
if not applicable.
- *
+ *
* @return version of PMD since when this rule was added
*/
String getSince();
/**
* Set the version of PMD in which this Rule was added.
- *
+ *
* @param since
* the version of PMD since when this rule was added
*/
@@ -140,14 +140,14 @@ public interface Rule extends PropertySource {
/**
* Get the implementation class of this Rule.
- *
+ *
* @return the implementation class name of this rule.
*/
String getRuleClass();
/**
* Set the class of this Rule.
- *
+ *
* @param ruleClass
* the class name of this rule.
*/
@@ -155,7 +155,7 @@ public interface Rule extends PropertySource {
/**
* Get the name of the RuleSet containing this Rule.
- *
+ *
* @return the name of th ruleset containing this rule.
* @see RuleSet
*/
@@ -163,7 +163,7 @@ public interface Rule extends PropertySource {
/**
* Set the name of the RuleSet containing this Rule.
- *
+ *
* @param name
* the name of the ruleset containing this rule.
* @see RuleSet
@@ -172,14 +172,14 @@ public interface Rule extends PropertySource {
/**
* Get the message to show when this Rule identifies a violation.
- *
+ *
* @return the message to show for a violation.
*/
String getMessage();
/**
* Set the message to show when this Rule identifies a violation.
- *
+ *
* @param message
* the message to show for a violation.
*/
@@ -187,14 +187,14 @@ public interface Rule extends PropertySource {
/**
* Get the description of this Rule.
- *
+ *
* @return the description
*/
String getDescription();
/**
* Set the description of this Rule.
- *
+ *
* @param description
* the description
*/
@@ -202,14 +202,14 @@ public interface Rule extends PropertySource {
/**
* Get the list of examples for this Rule.
- *
+ *
* @return the list of examples for this rule.
*/
List getExamples();
/**
* Add a single example for this Rule.
- *
+ *
* @param example
* a single example to add
*/
@@ -217,14 +217,14 @@ public interface Rule extends PropertySource {
/**
* Get a URL for external information about this Rule.
- *
+ *
* @return the URL for external information about this rule.
*/
String getExternalInfoUrl();
/**
* Set a URL for external information about this Rule.
- *
+ *
* @param externalInfoUrl
* the URL for external information about this rule.
*/
@@ -232,14 +232,14 @@ public interface Rule extends PropertySource {
/**
* Get the priority of this Rule.
- *
+ *
* @return the priority
*/
RulePriority getPriority();
/**
* Set the priority of this Rule.
- *
+ *
* @param priority
* the priority
*/
@@ -250,7 +250,7 @@ public interface Rule extends PropertySource {
* configure the {@link net.sourceforge.pmd.lang.Parser} to create an AST in
* the form the Rule is expecting. Because ParserOptions are mutable, a Rule
* should return a new instance on each call.
- *
+ *
* @return the parser options
*/
ParserOptions getParserOptions();
@@ -263,7 +263,7 @@ public interface Rule extends PropertySource {
/**
* Gets whether this Rule uses Data Flow Analysis.
- *
+ *
* @return true
if Data Flow Analysis is used.
*/
// FUTURE Use JavaBean conventions for boolean attributes
@@ -277,7 +277,7 @@ public interface Rule extends PropertySource {
/**
* Gets whether this Rule uses Type Resolution.
- *
+ *
* @return true
if Type Resolution is used.
*/
// FUTURE Use JavaBean conventions for boolean attributes
@@ -285,7 +285,7 @@ public interface Rule extends PropertySource {
/**
* Gets whether this Rule uses the RuleChain.
- *
+ *
* @return true
if RuleChain is used.
*/
// FUTURE Use JavaBean conventions for boolean attributes
@@ -294,14 +294,14 @@ public interface Rule extends PropertySource {
/**
* Gets the collection of AST node names visited by the Rule on the
* RuleChain.
- *
+ *
* @return the list of AST node names
*/
List getRuleChainVisits();
/**
* Adds an AST node by class to be visited by the Rule on the RuleChain.
- *
+ *
* @param nodeClass
* the AST node to add to the RuleChain visit list
*/
@@ -309,7 +309,7 @@ public interface Rule extends PropertySource {
/**
* Adds an AST node by name to be visited by the Rule on the RuleChain.
- *
+ *
* @param astNodeName
* the AST node to add to the RuleChain visit list as string
*/
@@ -317,7 +317,7 @@ public interface Rule extends PropertySource {
/**
* Start processing. Called once, before apply() is first called.
- *
+ *
* @param ctx
* the rule context
*/
@@ -326,7 +326,7 @@ public interface Rule extends PropertySource {
/**
* Apply this rule to the given collection of nodes, using the given
* context.
- *
+ *
* @param nodes
* the nodes
* @param ctx
@@ -336,7 +336,7 @@ public interface Rule extends PropertySource {
/**
* End processing. Called once, after apply() is last called.
- *
+ *
* @param ctx
* the rule context
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleChain.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleChain.java
index cd5d26a085..fd86b9b8ae 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleChain.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleChain.java
@@ -25,7 +25,7 @@ public class RuleChain {
/**
* Add all Rules from the given RuleSet which want to participate in the
* RuleChain.
- *
+ *
* @param ruleSet
* The RuleSet to add Rules from.
*/
@@ -37,7 +37,7 @@ public class RuleChain {
/**
* Add the given Rule if it wants to participate in the RuleChain.
- *
+ *
* @param ruleSet
* The RuleSet to which the rule belongs.
* @param rule
@@ -53,7 +53,7 @@ public class RuleChain {
/**
* Apply the RuleChain to the given Nodes using the given RuleContext, for
* those rules using the given Language.
- *
+ *
* @param nodes
* The Nodes.
* @param ctx
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java
index ec0d207c4b..e9614c3885 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleContext.java
@@ -46,7 +46,7 @@ public class RuleContext {
/**
* Constructor which shares attributes and report listeners with the given
* RuleContext.
- *
+ *
* @param ruleContext
* the context from which the values are shared
*/
@@ -57,7 +57,7 @@ public class RuleContext {
/**
* Get the Report to which Rule Violations are sent.
- *
+ *
* @return The Report.
*/
public Report getReport() {
@@ -66,7 +66,7 @@ public class RuleContext {
/**
* Set the Report to which Rule Violations are sent.
- *
+ *
* @param report
* The Report.
*/
@@ -76,7 +76,7 @@ public class RuleContext {
/**
* Get the File associated with the current source file.
- *
+ *
* @return The File.
*/
public File getSourceCodeFile() {
@@ -87,7 +87,7 @@ public class RuleContext {
* Set the File associated with the current source file. While this may be
* set to null
, the exclude/include facilities will not work
* properly without a File.
- *
+ *
* @param sourceCodeFile
* The File.
*/
@@ -97,7 +97,7 @@ public class RuleContext {
/**
* Get the file name associated with the current source file.
- *
+ *
* @return The file name.
*/
public String getSourceCodeFilename() {
@@ -106,7 +106,7 @@ public class RuleContext {
/**
* Set the file name associated with the current source file.
- *
+ *
* @param filename
* The file name.
*/
@@ -116,7 +116,7 @@ public class RuleContext {
/**
* Get the LanguageVersion associated with the current source file.
- *
+ *
* @return The LanguageVersion, null
if unknown.
*/
public LanguageVersion getLanguageVersion() {
@@ -224,7 +224,7 @@ public class RuleContext {
* If set to false
then the processing will be aborted with the
* exception. This is especially useful during unit tests, in order to not
* oversee any exceptions.
- *
+ *
* @param ignoreExceptions
* if true
simply skip failing rules (default).
*/
@@ -236,7 +236,7 @@ public class RuleContext {
* Gets the configuration whether to skip failing rules (true
)
* or whether to throw a a RuntimeException and abort the processing for the
* first failing rule.
- *
+ *
* @return true
when failing rules are skipped,
* false
otherwise.
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RulePriority.java b/pmd-core/src/main/java/net/sourceforge/pmd/RulePriority.java
index dfddd68fcb..4ef99b380e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RulePriority.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RulePriority.java
@@ -6,7 +6,7 @@ package net.sourceforge.pmd;
/**
* These are the possible Rule priority values.
- *
+ *
* For backward compatibility, priorities range in value from 1 to 5, with 5
* being the lowest priority. This means the ordinal value of the Enum should be
* avoided in favor of {@link RulePriority#getPriority()} and
@@ -43,7 +43,7 @@ public enum RulePriority {
private final int priority;
private final String name;
- private RulePriority(int priority, String name) {
+ RulePriority(int priority, String name) {
this.priority = priority;
this.name = name;
}
@@ -69,7 +69,7 @@ public enum RulePriority {
/**
* Returns the descriptive name of the priority.
- *
+ *
* @return descriptive name of the priority
* @see #getName()
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSet.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSet.java
index a5bca18091..af77d9e0bc 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSet.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSet.java
@@ -524,7 +524,7 @@ public class RuleSet {
private void patternsChanged() {
filter = null; // ensure we start with one that reflects the current
- // patterns
+ // patterns
}
/**
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java
index b036318d76..899b6388cc 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactory.java
@@ -74,7 +74,7 @@ public class RuleSetFactory {
/**
* Set the minimum rule priority threshold for all Rules which are loaded
* from RuleSets via reference.
- *
+ *
* @param minimumPriority
* The minimum priority.
*/
@@ -85,7 +85,7 @@ public class RuleSetFactory {
/**
* Set whether warning messages should be logged for usage of deprecated
* Rules.
- *
+ *
* @param warnDeprecated
* true
to log warning messages.
*/
@@ -105,7 +105,7 @@ public class RuleSetFactory {
/**
* Gets the compatibility filter in order to adjust it, e.g. add additional
* filters.
- *
+ *
* @return the {@link RuleSetFactoryCompatibility}
*/
public RuleSetFactoryCompatibility getCompatibilityFilter() {
@@ -244,7 +244,7 @@ public class RuleSetFactory {
/**
* Parse a ruleset node to construct a RuleSet.
- *
+ *
* @param ruleSetReferenceId
* The RuleSetReferenceId of the RuleSet being parsed.
* @param withDeprecatedRuleReferences
@@ -309,7 +309,7 @@ public class RuleSetFactory {
}
}
- private static RuleSet classNotFoundProblem(Exception ex) throws RuntimeException {
+ private static RuleSet classNotFoundProblem(Exception ex) {
ex.printStackTrace();
throw new RuntimeException("Couldn't find the class " + ex.getMessage());
}
@@ -563,12 +563,9 @@ public class RuleSetFactory {
otherRuleSetReferenceId = new RuleSetReferenceId(ref, ruleSetReferenceId);
isSameRuleSet = true;
}
- Rule referencedRule = ruleSetFactory.createRule(otherRuleSetReferenceId, true); // do
- // not
- // ignore
- // deprecated
- // rule
- // references
+ // do not ignore deprecated rule references
+ Rule referencedRule = ruleSetFactory.createRule(otherRuleSetReferenceId, true);
+
if (referencedRule == null) {
throw new IllegalArgumentException("Unable to find referenced rule " + otherRuleSetReferenceId.getRuleName()
+ "; perhaps the rule name is mispelled?");
@@ -646,7 +643,7 @@ public class RuleSetFactory {
/**
* Check whether the given ruleName is contained in the given ruleset.
- *
+ *
* @param ruleSetReferenceId
* the ruleset to check
* @param ruleName
@@ -794,9 +791,8 @@ public class RuleSetFactory {
for (Map.Entry entry : valueKeys.entrySet()) {
String valueStr = propertyElement.getAttribute(entry.getKey());
if (entry.getValue() && StringUtil.isEmpty(valueStr)) {
- System.out.println("Missing required value for: " + entry.getKey()); // debug
- // pt
- // TODO
+ // TODO debug pt
+ System.out.println("Missing required value for: " + entry.getKey());
}
values.put(entry.getKey(), valueStr);
}
@@ -836,7 +832,7 @@ public class RuleSetFactory {
/**
* Determine if the specified rule element will represent a Rule with the
* given name.
- *
+ *
* @param ruleElement
* The rule element.
* @param ruleName
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java
index 3b8ce5f918..3d89c3bb32 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetFactoryCompatibility.java
@@ -28,7 +28,7 @@ import org.apache.commons.io.IOUtils;
public class RuleSetFactoryCompatibility {
private static final Logger LOG = Logger.getLogger(RuleSetFactoryCompatibility.class.getName());
- private List filters = new LinkedList();
+ private List filters = new LinkedList<>();
/**
* Creates a new instance of the compatibility filter with the built-in
@@ -107,7 +107,7 @@ public class RuleSetFactoryCompatibility {
/**
* Determines the encoding of the given bytes, assuming this is a XML
* document, which specifies the encoding in the first 1024 bytes.
- *
+ *
* @param bytes
* the input bytes, might be more or less than 1024 bytes
* @return the determined encoding, falls back to the default UTF-8 encoding
@@ -185,8 +185,9 @@ public class RuleSetFactoryCompatibility {
}
}
- if (exclusionPattern == null)
+ if (exclusionPattern == null) {
return result;
+ }
Matcher exclusions = exclusionPattern.matcher(result);
if (exclusions.find()) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java
index 10eac4ce3f..8e4e876c74 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetReferenceId.java
@@ -24,27 +24,27 @@ import net.sourceforge.pmd.util.StringUtil;
* RuleSet XML. The RuleSet reference can refer to either an external RuleSet or
* the current RuleSet when used as a Rule 'ref' attribute value. An individual
* Rule in the RuleSet can be indicated.
- *
+ *
* For an external RuleSet, referring to the entire RuleSet, the format is
* ruleSetName, where the RuleSet name is either a resource file path to
* a RuleSet that ends with '.xml'
., or a simple RuleSet name.
- *
+ *
* A simple RuleSet name, is one which contains no path separators, and either
* contains a '-' or is entirely numeric release number. A simple name of the
* form [language]-[name]
is short for the full RuleSet name
* rulesets/[language]/[name].xml
. A numeric release simple name of
* the form [release]
is short for the full PMD Release RuleSet
* name rulesets/releases/[release].xml
.
- *
+ *
* For an external RuleSet, referring to a single Rule, the format is
* ruleSetName/ruleName, where the RuleSet name is as described above. A
* Rule with the ruleName should exist in this external RuleSet.
- *
+ *
* For the current RuleSet, the format is ruleName, where the Rule name
* is not RuleSet name (i.e. contains no path separators, '-' or '.xml' in it,
* and is not all numeric). A Rule with the ruleName should exist in the
* current RuleSet.
- *
+ *
*
* Examples
*
@@ -90,7 +90,7 @@ public class RuleSetReferenceId {
/**
* Construct a RuleSetReferenceId for the given single ID string.
- *
+ *
* @param id
* The id string.
* @throws IllegalArgumentException
@@ -106,7 +106,7 @@ public class RuleSetReferenceId {
* external RuleSetReferenceId is given, the ID must refer to a non-external
* Rule. The external RuleSetReferenceId will be responsible for producing
* the InputStream containing the Rule.
- *
+ *
* @param id
* The id string.
* @param externalRuleSetReferenceId
@@ -219,7 +219,7 @@ public class RuleSetReferenceId {
/**
* Tries to load the given ruleset.
- *
+ *
* @param name
* the ruleset name
* @return true
if the ruleset could be loaded,
@@ -276,7 +276,7 @@ public class RuleSetReferenceId {
* Extracts the rule name out of a ruleset path. E.g. for
* "/my/ruleset.xml/MyRule" it would return "MyRule". If no single rule is
* specified, null
is returned.
- *
+ *
* @param rulesetName
* the full rule set path
* @return the rule name or null
.
@@ -334,7 +334,7 @@ public class RuleSetReferenceId {
/**
* Parse a String comma separated list of RuleSet reference IDs into a List
* of RuleReferenceId instances.
- *
+ *
* @param referenceString
* A comma separated list of RuleSet reference IDs.
* @return The corresponding List of RuleSetReferenceId instances.
@@ -356,7 +356,7 @@ public class RuleSetReferenceId {
/**
* Is this an external RuleSet reference?
- *
+ *
* @return true
if this is an external reference,
* false
otherwise.
*/
@@ -366,7 +366,7 @@ public class RuleSetReferenceId {
/**
* Is this a reference to all Rules in a RuleSet, or a single Rule?
- *
+ *
* @return true
if this is a reference to all Rules,
* false
otherwise.
*/
@@ -376,7 +376,7 @@ public class RuleSetReferenceId {
/**
* Get the RuleSet file name.
- *
+ *
* @return The RuleSet file name if this is an external reference,
* null
otherwise.
*/
@@ -386,7 +386,7 @@ public class RuleSetReferenceId {
/**
* Get the Rule name.
- *
+ *
* @return The Rule name. The Rule name.
*/
public String getRuleName() {
@@ -423,12 +423,13 @@ public class RuleSetReferenceId {
/**
* Return the String form of this Rule reference.
- *
+ *
* @return Return the String form of this Rule reference, which is
* ruleSetFileName for all Rule external references,
* ruleSetFileName/ruleName, for a single Rule external
* references, or ruleName otherwise.
*/
+ @Override
public String toString() {
if (ruleSetFileName != null) {
if (allRules) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java
index dffdff315a..96bfefe61c 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSetWriter.java
@@ -267,20 +267,20 @@ public class RuleSetWriter {
if (propertyDescriptors != null) {
for (PropertyDescriptor> propertyDescriptor : propertyDescriptors) { // For
- // each
- // provided
- // PropertyDescriptor
+ // each
+ // provided
+ // PropertyDescriptor
if (propertyDescriptor instanceof PropertyDescriptorWrapper) { // Any
- // wrapper
- // property
- // needs
- // to
- // go
- // out
- // as
- // a
- // definition.
+ // wrapper
+ // property
+ // needs
+ // to
+ // go
+ // out
+ // as
+ // a
+ // definition.
if (propertiesElement == null) {
propertiesElement = createPropertiesElement();
}
@@ -290,16 +290,16 @@ public class RuleSetWriter {
propertiesElement.appendChild(propertyElement);
} else {
if (propertiesByPropertyDescriptor != null) { // Otherwise,
- // any
- // property
- // which has a
- // value
- // different
- // than the
- // default
- // needs to go
- // out as a
- // value.
+ // any
+ // property
+ // which has a
+ // value
+ // different
+ // than the
+ // default
+ // needs to go
+ // out as a
+ // value.
Object defaultValue = propertyDescriptor.defaultValue();
Object value = propertiesByPropertyDescriptor.get(propertyDescriptor);
if (value != defaultValue && (value == null || !value.equals(defaultValue))) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSets.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSets.java
index abc1d3f98a..9255ec2fb9 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleSets.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleSets.java
@@ -89,7 +89,7 @@ public class RuleSets {
/**
* Check if a given source file should be checked by rules in this RuleSets.
- *
+ *
* @param file
* the source file to check
* @return true
if the file should be checked,
@@ -165,7 +165,7 @@ public class RuleSets {
*
* Note: Since we support multiple languages, rule names are not expected to
* be unique within any specific ruleset.
- *
+ *
* @param ruleName
* the exact name of the rule to find
* @return the rule or null if not found
@@ -181,7 +181,7 @@ public class RuleSets {
/**
* Determines the total count of rules that are used in all rule sets.
- *
+ *
* @return the count
*/
public int ruleCount() {
@@ -203,7 +203,7 @@ public class RuleSets {
/**
* Remove and collect any rules that report problems.
- *
+ *
* @param collector
*/
public void removeDysfunctionalRules(Collection collector) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolation.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolation.java
index 407963aab8..7267ab4e1e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolation.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolation.java
@@ -7,28 +7,28 @@ package net.sourceforge.pmd;
/**
* A RuleViolation is created by a Rule when it identifies a violation of the
* Rule constraints.
- *
+ *
* @see Rule
*/
public interface RuleViolation {
/**
* Get the Rule which identified this violation.
- *
+ *
* @return The identifying Rule.
*/
Rule getRule();
/**
* Get the description of this violation.
- *
+ *
* @return The description.
*/
String getDescription();
/**
* Indicates whether this violation has been suppressed.
- *
+ *
* @return true
if this violation is suppressed,
* false
otherwise.
*/
@@ -36,7 +36,7 @@ public interface RuleViolation {
/**
* Get the source file name in which this violation was identified.
- *
+ *
* @return The source file name.
*/
String getFilename();
@@ -44,7 +44,7 @@ public interface RuleViolation {
/**
* Get the begin line number in the source file in which this violation was
* identified.
- *
+ *
* @return Begin line number.
*/
int getBeginLine();
@@ -52,7 +52,7 @@ public interface RuleViolation {
/**
* Get the column number of the begin line in the source file in which this
* violation was identified.
- *
+ *
* @return Begin column number.
*/
int getBeginColumn();
@@ -60,7 +60,7 @@ public interface RuleViolation {
/**
* Get the end line number in the source file in which this violation was
* identified.
- *
+ *
* @return End line number.
*/
int getEndLine();
@@ -68,14 +68,14 @@ public interface RuleViolation {
/**
* Get the column number of the end line in the source file in which this
* violation was identified.
- *
+ *
* @return End column number.
*/
int getEndColumn();
/**
* Get the package name of the Class in which this violation was identified.
- *
+ *
* @return The package name.
*/
// TODO Isn't this Java specific?
@@ -83,7 +83,7 @@ public interface RuleViolation {
/**
* Get the name of the Class in which this violation was identified.
- *
+ *
* @return The Class name.
*/
// TODO Isn't this Java specific?
@@ -91,7 +91,7 @@ public interface RuleViolation {
/**
* Get the method name in which this violation was identified.
- *
+ *
* @return The method name.
*/
// TODO Isn't this Java specific?
@@ -99,7 +99,7 @@ public interface RuleViolation {
/**
* Get the variable name on which this violation was identified.
- *
+ *
* @return The variable name.
*/
String getVariableName();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolationComparator.java b/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolationComparator.java
index 25eb306758..1947c7ddab 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolationComparator.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RuleViolationComparator.java
@@ -25,6 +25,7 @@ public final class RuleViolationComparator implements Comparator
private RuleViolationComparator() {
}
+ @Override
public int compare(final RuleViolation r1, final RuleViolation r2) {
int cmp = r1.getFilename().compareTo(r2.getFilename());
if (cmp == 0) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java b/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java
index 71f36b43e5..a52bcf6930 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/RulesetsFactoryUtils.java
@@ -20,7 +20,7 @@ public final class RulesetsFactoryUtils {
/**
* Creates a new rulesets with the given string. The resulting rulesets will
* contain all referenced rulesets.
- *
+ *
* @param rulesets
* the string with the rulesets to load
* @param factory
@@ -52,7 +52,7 @@ public final class RulesetsFactoryUtils {
/**
* See {@link #getRuleSets(String, RuleSetFactory)}. In addition, the
* loading of the rules is benchmarked.
- *
+ *
* @param rulesets
* the string with the rulesets to load
* @param factory
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/SynchronizedReportListener.java b/pmd-core/src/main/java/net/sourceforge/pmd/SynchronizedReportListener.java
index 126e22ad01..10adbecf49 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/SynchronizedReportListener.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/SynchronizedReportListener.java
@@ -16,7 +16,7 @@ public final class SynchronizedReportListener implements ReportListener {
/**
* Creates a new {@link SynchronizedReportListener} by wrapping the given
* report listener.
- *
+ *
* @param listener
* the listener to be synchronized
*/
@@ -27,6 +27,7 @@ public final class SynchronizedReportListener implements ReportListener {
/**
* {@inheritDoc}
*/
+ @Override
public synchronized void ruleViolationAdded(RuleViolation ruleViolation) {
wrapped.ruleViolationAdded(ruleViolation);
}
@@ -34,6 +35,7 @@ public final class SynchronizedReportListener implements ReportListener {
/**
* {@inheritDoc}
*/
+ @Override
public synchronized void metricAdded(Metric metric) {
wrapped.metricAdded(metric);
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/ant/SourceLanguage.java b/pmd-core/src/main/java/net/sourceforge/pmd/ant/SourceLanguage.java
index 3333e41482..6f0749535d 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/ant/SourceLanguage.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/ant/SourceLanguage.java
@@ -28,6 +28,7 @@ public class SourceLanguage {
this.name = name;
}
+ @Override
public String toString() {
return "";
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java b/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java
index 4f4b71b27d..9bf65ffedf 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/ant/internal/PMDTaskImpl.java
@@ -157,15 +157,18 @@ public class PMDTaskImpl {
configuration.setInputPaths(inputPaths);
Renderer logRenderer = new AbstractRenderer("log", "Logging renderer") {
+ @Override
public void start() {
// Nothing to do
}
+ @Override
public void startFileAnalysis(DataSource dataSource) {
project.log("Processing file " + dataSource.getNiceFileName(false, inputPaths),
Project.MSG_VERBOSE);
}
+ @Override
public void renderFileReport(Report r) {
int size = r.size();
if (size > 0) {
@@ -173,10 +176,12 @@ public class PMDTaskImpl {
}
}
+ @Override
public void end() {
// Nothing to do
}
+ @Override
public String defaultFileExtension() {
return null;
} // not relevant
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmark.java b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmark.java
index b6f9ffb5b7..6ed3b816f9 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmark.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/Benchmark.java
@@ -5,21 +5,30 @@
package net.sourceforge.pmd.benchmark;
/**
- *
+ *
* @author Brian Remedios
*/
public enum Benchmark {
- Rule(0, null), RuleChainRule(1, null), CollectFiles(2, "Collect files"), LoadRules(3, "Load rules"), Parser(4,
- "Parser"), SymbolTable(5, "Symbol table"), DFA(6, "DFA"), TypeResolution(7,
- "Type resolution"), RuleChainVisit(8, "RuleChain visit"), Reporting(9, "Reporting"), RuleTotal(10,
- "Rule total"), RuleChainTotal(11, "Rule chain rule total"), MeasuredTotal(12,
- "Measured total"), NonMeasuredTotal(13,
- "Non-measured total"), TotalPMD(14, "Total PMD");
+ Rule(0, null),
+ RuleChainRule(1, null),
+ CollectFiles(2, "Collect files"),
+ LoadRules(3, "Load rules"),
+ Parser(4, "Parser"),
+ SymbolTable(5, "Symbol table"),
+ DFA(6, "DFA"),
+ TypeResolution(7, "Type resolution"),
+ RuleChainVisit(8, "RuleChain visit"),
+ Reporting(9, "Reporting"),
+ RuleTotal(10, "Rule total"),
+ RuleChainTotal(11, "Rule chain rule total"),
+ MeasuredTotal(12, "Measured total"),
+ NonMeasuredTotal(13, "Non-measured total"),
+ TotalPMD(14, "Total PMD");
public final int index;
public final String name;
- private Benchmark(int idx, String theName) {
+ Benchmark(int idx, String theName) {
index = idx;
name = theName;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkReport.java b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkReport.java
index 9a5aefd434..49f021cf40 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkReport.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkReport.java
@@ -9,20 +9,20 @@ import java.util.Map;
import java.util.Set;
/**
- *
+ *
* @author Brian Remedios
*/
public interface BenchmarkReport {
/**
- *
+ *
* @param stressResults
* @param out
*/
void generate(Set stressResults, PrintStream out);
/**
- *
+ *
* @param benchmarksByName
* @param out
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkResult.java b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkResult.java
index af471b5ffb..80ec47df53 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkResult.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/BenchmarkResult.java
@@ -11,12 +11,12 @@ class BenchmarkResult implements Comparable {
private long time;
private long count;
- public BenchmarkResult(Benchmark type, String name) {
+ BenchmarkResult(Benchmark type, String name) {
this.type = type;
this.name = name;
}
- public BenchmarkResult(Benchmark type, long time, long count) {
+ BenchmarkResult(Benchmark type, long time, long count) {
this(type, type.name);
this.time = time;
this.count = count;
@@ -35,6 +35,7 @@ class BenchmarkResult implements Comparable {
this.count += count;
}
+ @Override
public int compareTo(BenchmarkResult benchmarkResult) {
int cmp = type.index - benchmarkResult.type.index;
if (cmp == 0) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/StringBuilderCR.java b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/StringBuilderCR.java
index 6e47fd6c1c..a07840f606 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/StringBuilderCR.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/StringBuilderCR.java
@@ -7,7 +7,7 @@ package net.sourceforge.pmd.benchmark;
/**
* A wrapped StringBuilder that appends a variable number of text segments
* efficiently and always appends the specified carriage return terminator.
- *
+ *
* @author Brian Remedios
*/
public class StringBuilderCR {
@@ -32,6 +32,7 @@ public class StringBuilderCR {
sb.append(cr);
}
+ @Override
public String toString() {
return sb.toString();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/TextReport.java b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/TextReport.java
index 2ce19773c1..c9fe38555d 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/TextReport.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/benchmark/TextReport.java
@@ -34,6 +34,7 @@ public class TextReport implements BenchmarkReport {
* @see net.sourceforge.pmd.benchmark.BenchmarkReport#generate(Set,
* PrintStream)
*/
+ @Override
public void generate(Set stressResults, PrintStream out) {
out.println("=========================================================");
@@ -70,6 +71,7 @@ public class TextReport implements BenchmarkReport {
* @see net.sourceforge.pmd.benchmark.BenchmarkReport#generate(Map,
* PrintStream)
*/
+ @Override
public void generate(Map benchmarksByName, PrintStream out) {
List results = new ArrayList<>(benchmarksByName.values());
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java
index 5e0e22e5ba..e1b280a541 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDCommandLineInterface.java
@@ -6,15 +6,15 @@ package net.sourceforge.pmd.cli;
import java.util.Properties;
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.ParameterException;
-
import net.sourceforge.pmd.PMD;
import net.sourceforge.pmd.PropertyDescriptor;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.renderers.Renderer;
import net.sourceforge.pmd.renderers.RendererFactory;
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.ParameterException;
+
/**
* @author Romain Pelisse
*
@@ -81,7 +81,8 @@ public class PMDCommandLineInterface {
fullText += "Available report formats and their configuration properties are:" + PMD.EOL + getReports()
+ PMD.EOL + getExamples() + PMD.EOL + PMD.EOL + PMD.EOL;
- return fullText += usage.toString();
+ fullText += usage.toString();
+ return fullText;
}
private static String getExamples() {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java
index 920055baed..4338774eb9 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java
@@ -9,20 +9,20 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import com.beust.jcommander.IStringConverter;
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.ParameterException;
-import com.beust.jcommander.validators.PositiveInteger;
-
import net.sourceforge.pmd.PMDConfiguration;
import net.sourceforge.pmd.RulePriority;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.LanguageVersion;
+import com.beust.jcommander.IStringConverter;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ParameterException;
+import com.beust.jcommander.validators.PositiveInteger;
+
public class PMDParameters {
- @Parameter(names = { "-rulesets",
- "-R" }, description = "Comma separated list of ruleset names to use.", required = true)
+ @Parameter(names = { "-rulesets", "-R" }, description = "Comma separated list of ruleset names to use.",
+ required = true)
private String rulesets;
@Parameter(names = { "-uri", "-u" }, description = "Database URI for sources.", required = false)
@@ -31,8 +31,8 @@ public class PMDParameters {
@Parameter(names = { "-dir", "-d" }, description = "Root directory for sources.", required = false)
private String sourceDir;
- @Parameter(names = {
- "-filelist" }, description = "Path to a file containing a list of files to analyze.", required = false)
+ @Parameter(names = { "-filelist" }, description = "Path to a file containing a list of files to analyze.",
+ required = false)
private String fileListPath;
@Parameter(names = { "-format", "-f" }, description = "Report format type.")
@@ -44,16 +44,16 @@ public class PMDParameters {
@Parameter(names = { "-help", "-h", "-H" }, description = "Display help on usage.", help = true)
private boolean help = false;
- @Parameter(names = { "-encoding",
- "-e" }, description = "Specifies the character set encoding of the source code files PMD is reading (i.e., UTF-8).")
+ @Parameter(names = { "-encoding", "-e" },
+ description = "Specifies the character set encoding of the source code files PMD is reading (i.e., UTF-8).")
private String encoding = "UTF-8";
- @Parameter(names = { "-threads",
- "-t" }, description = "Sets the number of threads used by PMD.", validateWith = PositiveInteger.class)
+ @Parameter(names = { "-threads", "-t" }, description = "Sets the number of threads used by PMD.",
+ validateWith = PositiveInteger.class)
private Integer threads = 1;
- @Parameter(names = { "-benchmark",
- "-b" }, description = "Benchmark mode - output a benchmark report upon completion; default to System.err.")
+ @Parameter(names = { "-benchmark", "-b" },
+ description = "Benchmark mode - output a benchmark report upon completion; default to System.err.")
private boolean benchmark = false;
@Parameter(names = { "-stress", "-S" }, description = "Performs a stress test.")
@@ -65,15 +65,17 @@ public class PMDParameters {
@Parameter(names = "-showsuppressed", description = "Report should show suppressed rule violations.")
private boolean showsuppressed = false;
- @Parameter(names = "-suppressmarker", description = "Specifies the string that marks the a line which PMD should ignore; default is NOPMD.")
+ @Parameter(names = "-suppressmarker",
+ description = "Specifies the string that marks the a line which PMD should ignore; default is NOPMD.")
private String suppressmarker = "NOPMD";
- @Parameter(names = { "-minimumpriority",
- "-min" }, description = "Rule priority threshold; rules with lower priority than configured here won't be used. Default is '5' which is the lowest priority.", converter = RulePriorityConverter.class)
+ @Parameter(names = { "-minimumpriority", "-min" },
+ description = "Rule priority threshold; rules with lower priority than configured here won't be used. Default is '5' which is the lowest priority.",
+ converter = RulePriorityConverter.class)
private RulePriority minimumPriority = RulePriority.LOW;
- @Parameter(names = { "-property",
- "-P" }, description = "{name}={value}: Define a property for the report format.", converter = PropertyConverter.class)
+ @Parameter(names = { "-property", "-P" }, description = "{name}={value}: Define a property for the report format.",
+ converter = PropertyConverter.class)
private List properties = new ArrayList<>();
@Parameter(names = { "-reportfile", "-r" }, description = "Sends report output to a file; default to System.out.")
@@ -85,14 +87,16 @@ public class PMDParameters {
@Parameter(names = { "-language", "-l" }, description = "Specify a language PMD should use.")
private String language = null;
- @Parameter(names = "-auxclasspath", description = "Specifies the classpath for libraries used by the source code. This is used by the type resolution. Alternatively, a 'file://' URL to a text file containing path elements on consecutive lines can be specified.")
+ @Parameter(names = "-auxclasspath",
+ description = "Specifies the classpath for libraries used by the source code. This is used by the type resolution. Alternatively, a 'file://' URL to a text file containing path elements on consecutive lines can be specified.")
private String auxclasspath;
- @Parameter(names = { "-failOnViolation",
- "--failOnViolation" }, arity = 1, description = "By default PMD exits with status 4 if violations are found. Disable this option with '-failOnViolation false' to exit with 0 instead and just write the report.")
+ @Parameter(names = { "-failOnViolation", "--failOnViolation" }, arity = 1,
+ description = "By default PMD exits with status 4 if violations are found. Disable this option with '-failOnViolation false' to exit with 0 instead and just write the report.")
private boolean failOnViolation = true;
- @Parameter(names = "-norulesetcompatibility", description = "Disable the ruleset compatibility filter. The filter is active by default and tries automatically 'fix' old ruleset files with old rule names")
+ @Parameter(names = "-norulesetcompatibility",
+ description = "Disable the ruleset compatibility filter. The filter is active by default and tries automatically 'fix' old ruleset files with old rule names")
private boolean noRuleSetCompatibility = false;
// this has to be a public static class, so that JCommander can use it!
@@ -100,6 +104,7 @@ public class PMDParameters {
private static final char SEPARATOR = '=';
+ @Override
public Properties convert(String value) {
int indexOfSeparator = value.indexOf(SEPARATOR);
if (indexOfSeparator < 0) {
@@ -126,6 +131,7 @@ public class PMDParameters {
return minPriorityValue;
}
+ @Override
public RulePriority convert(String value) {
return RulePriority.valueOf(validate(value));
}
@@ -246,7 +252,7 @@ public class PMDParameters {
public String getFileListPath() {
return fileListPath;
- };
+ }
public String getFormat() {
return format;
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java
index 261556f621..a6485062b5 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java
@@ -26,26 +26,32 @@ public abstract class AbstractLanguage implements Language {
this.extensions = Arrays.asList(extensions);
}
+ @Override
public FilenameFilter getFileFilter() {
return fileFilter;
}
+ @Override
public Tokenizer getTokenizer() {
return tokenizer;
}
+ @Override
public void setProperties(Properties properties) {
// needs to be implemented by subclasses.
}
+ @Override
public String getName() {
return name;
}
+ @Override
public String getTerseName() {
return terseName;
}
+ @Override
public List getExtensions() {
return extensions;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractTokenizer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractTokenizer.java
index fc71c74b86..39c63357e4 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractTokenizer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AbstractTokenizer.java
@@ -17,28 +17,29 @@ public abstract class AbstractTokenizer implements Tokenizer {
// better to make private and setup via explicit hook methods
protected List stringToken; // List, should be set by sub
- // classes
+ // classes
protected List ignorableCharacter; // List, should be set by
- // sub classes
- // FIXME:Maybe an array of 'char'
- // would be better for
- // performance ?
+ // sub classes
+ // FIXME:Maybe an array of 'char'
+ // would be better for
+ // performance ?
protected List ignorableStmt; // List, should be set by sub
- // classes
+ // classes
protected char oneLineCommentChar = '#'; // Most script languages ( shell,
- // ruby, python,...) use this
- // symbol for comment line
+ // ruby, python,...) use this
+ // symbol for comment line
private List code;
private int lineNumber = 0;
private String currentLine;
protected boolean spanMultipleLinesString = true; // Most languages do, so
- // default is true
+ // default is true
protected Character spanMultipleLinesLineContinuationCharacter = null;
private boolean downcaseString = true;
+ @Override
public void tokenize(SourceCode tokens, Tokens tokenEntries) {
code = tokens.getCode();
@@ -77,7 +78,7 @@ public abstract class AbstractTokenizer implements Tokenizer {
} else if (isString(tok)) {
if (token.length() > 0) {
return j; // we need to now parse the string as a
- // separate token.
+ // separate token.
} else {
// we are at the start of a string
return parseString(token, j, tok);
@@ -118,13 +119,13 @@ public abstract class AbstractTokenizer implements Tokenizer {
// Handling multiple lines string
if (!done && // ... we didn't find the end of the string
loc >= currentLine.length() && // ... we have reach the end of
- // the line ( the String is
- // incomplete, for the moment at
- // least)
+ // the line ( the String is
+ // incomplete, for the moment at
+ // least)
spanMultipleLinesString && // ... the language allow multiple
- // line span Strings
+ // line span Strings
lineNumber < code.size() - 1 // ... there is still more lines to
- // parse
+ // parse
) {
// removes last character, if it is the line continuation (e.g.
// backslash) character
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AnyTokenizer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AnyTokenizer.java
index cee67b4da4..c3449f579c 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AnyTokenizer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/AnyTokenizer.java
@@ -19,6 +19,7 @@ import org.apache.commons.io.IOUtils;
public class AnyTokenizer implements Tokenizer {
public static final String TOKENS = " \t!#$%^&*(){}-=+<>/\\`~;:";
+ @Override
public void tokenize(SourceCode sourceCode, Tokens tokenEntries) {
StringBuilder sb = sourceCode.getCodeBuffer();
BufferedReader reader = new BufferedReader(new CharArrayReader(sb.toString().toCharArray()));
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java
index fc8c12669d..b1ed3e7788 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java
@@ -157,7 +157,7 @@ public class CPD {
/**
* List names/paths of each source to be processed.
- *
+ *
* @return names of sources to be processed
*/
public List getSourcePaths() {
@@ -166,7 +166,7 @@ public class CPD {
/**
* Get each Source to be processed.
- *
+ *
* @return all Sources to be processed
*/
public List getSources() {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java
index 7c3136672c..c97f01e89e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java
@@ -12,12 +12,12 @@ import java.util.Arrays;
import java.util.List;
import java.util.logging.Logger;
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.ParameterException;
-
import net.sourceforge.pmd.PMD;
import net.sourceforge.pmd.util.database.DBURI;
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.ParameterException;
+
public class CPDCommandLineInterface {
private static final Logger LOGGER = Logger.getLogger(CPDCommandLineInterface.class.getName());
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java
index e92ae4e99f..06480117af 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java
@@ -20,14 +20,14 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import com.beust.jcommander.IStringConverter;
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.converters.FileConverter;
-
import net.sourceforge.pmd.AbstractConfiguration;
import net.sourceforge.pmd.util.FileFinder;
import net.sourceforge.pmd.util.FileUtil;
+import com.beust.jcommander.IStringConverter;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.converters.FileConverter;
+
/**
*
* @author Brian Remedios
@@ -41,18 +41,20 @@ public class CPDConfiguration extends AbstractConfiguration {
private static final Map> RENDERERS = new HashMap<>();
- @Parameter(names = "--language", description = "Sources code language. Default value is "
- + DEFAULT_LANGUAGE, required = false, converter = LanguageConverter.class)
+ @Parameter(names = "--language", description = "Sources code language. Default value is " + DEFAULT_LANGUAGE,
+ required = false, converter = LanguageConverter.class)
private Language language;
- @Parameter(names = "--minimum-tokens", description = "The minimum token length which should be reported as a duplicate.", required = true)
+ @Parameter(names = "--minimum-tokens",
+ description = "The minimum token length which should be reported as a duplicate.", required = true)
private int minimumTileSize;
- @Parameter(names = "--skip-duplicate-files", description = "Ignore multiple copies of files of the same name and length in comparison", required = false)
+ @Parameter(names = "--skip-duplicate-files",
+ description = "Ignore multiple copies of files of the same name and length in comparison", required = false)
private boolean skipDuplicates;
- @Parameter(names = "--format", description = "Report format. Default value is "
- + DEFAULT_RENDERER, required = false)
+ @Parameter(names = "--format", description = "Report format. Default value is " + DEFAULT_RENDERER,
+ required = false)
private String rendererName;
/**
@@ -63,32 +65,43 @@ public class CPDConfiguration extends AbstractConfiguration {
private String encoding;
- @Parameter(names = "--ignore-literals", description = "Ignore number values and string contents when comparing text", required = false)
+ @Parameter(names = "--ignore-literals",
+ description = "Ignore number values and string contents when comparing text", required = false)
private boolean ignoreLiterals;
- @Parameter(names = "--ignore-identifiers", description = "Ignore constant and variable names when comparing text", required = false)
+ @Parameter(names = "--ignore-identifiers", description = "Ignore constant and variable names when comparing text",
+ required = false)
private boolean ignoreIdentifiers;
- @Parameter(names = "--ignore-annotations", description = "Ignore language annotations when comparing text", required = false)
+ @Parameter(names = "--ignore-annotations", description = "Ignore language annotations when comparing text",
+ required = false)
private boolean ignoreAnnotations;
@Parameter(names = "--ignore-usings", description = "Ignore using directives in C#", required = false)
private boolean ignoreUsings;
- @Parameter(names = "--skip-lexical-errors", description = "Skip files which can't be tokenized due to invalid characters instead of aborting CPD", required = false)
+ @Parameter(names = "--skip-lexical-errors",
+ description = "Skip files which can't be tokenized due to invalid characters instead of aborting CPD",
+ required = false)
private boolean skipLexicalErrors = false;
- @Parameter(names = "--no-skip-blocks", description = "Do not skip code blocks marked with --skip-blocks-pattern (e.g. #if 0 until #endif)", required = false)
+ @Parameter(names = "--no-skip-blocks",
+ description = "Do not skip code blocks marked with --skip-blocks-pattern (e.g. #if 0 until #endif)",
+ required = false)
private boolean noSkipBlocks = false;
- @Parameter(names = "--skip-blocks-pattern", description = "Pattern to find the blocks to skip. Start and End pattern separated by |. "
- + "Default is \"" + Tokenizer.DEFAULT_SKIP_BLOCKS_PATTERN + "\".", required = false)
+ @Parameter(names = "--skip-blocks-pattern",
+ description = "Pattern to find the blocks to skip. Start and End pattern separated by |. " + "Default is \""
+ + Tokenizer.DEFAULT_SKIP_BLOCKS_PATTERN + "\".",
+ required = false)
private String skipBlocksPattern = Tokenizer.DEFAULT_SKIP_BLOCKS_PATTERN;
- @Parameter(names = "--files", variableArity = true, description = "List of files and directories to process", required = false, converter = FileConverter.class)
+ @Parameter(names = "--files", variableArity = true, description = "List of files and directories to process",
+ required = false, converter = FileConverter.class)
private List files;
- @Parameter(names = "--exclude", variableArity = true, description = "Files to be excluded from CPD check", required = false, converter = FileConverter.class)
+ @Parameter(names = "--exclude", variableArity = true, description = "Files to be excluded from CPD check",
+ required = false, converter = FileConverter.class)
private List excludes;
@Parameter(names = "--non-recursive", description = "Don't scan subdirectiories", required = false)
@@ -100,8 +113,8 @@ public class CPDConfiguration extends AbstractConfiguration {
@Parameter(names = { "--help", "-h" }, description = "Print help text", required = false, help = true)
private boolean help;
- @Parameter(names = { "--failOnViolation",
- "-failOnViolation" }, arity = 1, description = "By default CPD exits with status 4 if code duplications are found. Disable this option with '-failOnViolation false' to exit with 0 instead and just write the report.")
+ @Parameter(names = { "--failOnViolation", "-failOnViolation" }, arity = 1,
+ description = "By default CPD exits with status 4 if code duplications are found. Disable this option with '-failOnViolation false' to exit with 0 instead and just write the report.")
private boolean failOnViolation = true;
// this has to be a public static class, so that JCommander can use it!
@@ -154,7 +167,7 @@ public class CPDConfiguration extends AbstractConfiguration {
/**
* Gets a renderer with the platform's default encoding.
- *
+ *
* @param name
* renderer name
* @return a fresh renderer instance
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDNullListener.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDNullListener.java
index 49400052bc..dd0a132bf1 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDNullListener.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDNullListener.java
@@ -7,9 +7,11 @@ package net.sourceforge.pmd.cpd;
import java.io.File;
public class CPDNullListener implements CPDListener {
+ @Override
public void addedFile(int fileCount, File file) {
}
+ @Override
public void phaseUpdate(int phase) {
}
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java
index 4d1eca5e09..8300e72465 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDTask.java
@@ -54,6 +54,7 @@ public class CPDTask extends Task {
private String encoding = System.getProperty("file.encoding");
private List filesets = new ArrayList<>();
+ @Override
public void execute() throws BuildException {
ClassLoader oldClassloader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(CPDTask.class.getClassLoader());
@@ -230,6 +231,7 @@ public class CPDTask extends Task {
public static class FormatAttribute extends EnumeratedAttribute {
private static final String[] FORMATS = new String[] { XML_FORMAT, TEXT_FORMAT, CSV_FORMAT };
+ @Override
public String[] getValues() {
return FORMATS;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CSVRenderer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CSVRenderer.java
index 529673ab6d..197b39c6cd 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CSVRenderer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CSVRenderer.java
@@ -35,6 +35,7 @@ public class CSVRenderer implements Renderer {
this.lineCountPerFile = lineCountPerFile;
}
+ @Override
public String render(Iterator matches) {
StringBuilder csv = new StringBuilder(1000);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java
index bf3e652d09..7cfbaec817 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/GUI.java
@@ -53,6 +53,7 @@ import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
+import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.Timer;
import javax.swing.event.ListSelectionEvent;
@@ -75,24 +76,28 @@ public class GUI implements CPDListener {
// }
private static final Object[][] RENDERER_SETS = new Object[][] { { "Text", new Renderer() {
+ @Override
public String render(Iterator items) {
return new SimpleRenderer().render(items);
}
- } }, { "XML", new Renderer() {
+ }, }, { "XML", new Renderer() {
+ @Override
public String render(Iterator items) {
return new XMLRenderer().render(items);
}
- } }, { "CSV (comma)", new Renderer() {
+ }, }, { "CSV (comma)", new Renderer() {
+ @Override
public String render(Iterator items) {
return new CSVRenderer(',').render(items);
}
- } }, { "CSV (tab)", new Renderer() {
+ }, }, { "CSV (tab)", new Renderer() {
+ @Override
public String render(Iterator items) {
return new CSVRenderer('\t').render(items);
}
- } } };
+ }, }, };
- private static abstract class LanguageConfig {
+ private abstract static class LanguageConfig {
public abstract Language languageFor(Properties p);
public boolean canIgnoreIdentifiers() {
@@ -184,7 +189,7 @@ public class GUI implements CPDListener {
private int width;
private Comparator sorter;
- public ColumnSpec(String aLabel, int anAlignment, int aWidth, Comparator aSorter) {
+ ColumnSpec(String aLabel, int anAlignment, int aWidth, Comparator aSorter) {
label = aLabel;
alignment = anAlignment;
width = aWidth;
@@ -209,9 +214,9 @@ public class GUI implements CPDListener {
}
private final ColumnSpec[] matchColumns = new ColumnSpec[] {
- new ColumnSpec("Source", SwingConstants.LEFT, -1, Match.LABEL_COMPARATOR),
- new ColumnSpec("Matches", SwingConstants.RIGHT, 60, Match.MATCHES_COMPARATOR),
- new ColumnSpec("Lines", SwingConstants.RIGHT, 45, Match.LINES_COMPARATOR), };
+ new ColumnSpec("Source", SwingConstants.LEFT, -1, Match.LABEL_COMPARATOR),
+ new ColumnSpec("Matches", SwingConstants.RIGHT, 60, Match.MATCHES_COMPARATOR),
+ new ColumnSpec("Lines", SwingConstants.RIGHT, 45, Match.LINES_COMPARATOR), };
static {
for (int i = 0; i < LANGUAGE_SETS.length; i++) {
@@ -224,14 +229,17 @@ public class GUI implements CPDListener {
}
private static class CancelListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
}
private class GoListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
new Thread(new Runnable() {
+ @Override
public void run() {
tokenizingFilesBar.setValue(0);
tokenizingFilesBar.setString("");
@@ -248,10 +256,11 @@ public class GUI implements CPDListener {
final Renderer renderer;
- public SaveListener(Renderer theRenderer) {
+ SaveListener(Renderer theRenderer) {
renderer = theRenderer;
}
+ @Override
public void actionPerformed(ActionEvent evt) {
JFileChooser fcSave = new JFileChooser();
int ret = fcSave.showSaveDialog(GUI.this.frame);
@@ -287,6 +296,7 @@ public class GUI implements CPDListener {
}
private class BrowseListener implements ActionListener {
+ @Override
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser(rootDirectoryField.getText());
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
@@ -301,10 +311,11 @@ public class GUI implements CPDListener {
private static final long serialVersionUID = -2190382865483285032L;
private int[] alignments;
- public AlignmentRenderer(int[] theAlignments) {
+ AlignmentRenderer(int[] theAlignments) {
alignments = theAlignments;
}
+ @Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
@@ -368,6 +379,7 @@ public class GUI implements CPDListener {
fileMenu.setMnemonic('v');
JMenuItem trimItem = new JCheckBoxMenuItem("Trim leading whitespace");
trimItem.addItemListener(new ItemListener() {
+ @Override
public void itemStateChanged(ItemEvent e) {
AbstractButton button = (AbstractButton) e.getItem();
GUI.this.trimLeadingWhitespace = button.isSelected();
@@ -434,6 +446,7 @@ public class GUI implements CPDListener {
languageBox.addItem(String.valueOf(LANGUAGE_SETS[i][0]));
}
languageBox.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
adjustLanguageControlsFor(languageConfigFor((String) languageBox.getSelectedItem()));
}
@@ -505,7 +518,7 @@ public class GUI implements CPDListener {
resultsPanel.setLayout(new BorderLayout());
JScrollPane areaScrollPane = new JScrollPane(resultsTextArea);
resultsTextArea.setEditable(false);
- areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+ areaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
areaScrollPane.setPreferredSize(new Dimension(600, 300));
resultsPanel.add(makeMatchList(), BorderLayout.WEST);
@@ -562,18 +575,21 @@ public class GUI implements CPDListener {
private JComponent makeMatchList() {
resultsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
public void valueChanged(ListSelectionEvent e) {
populateResultArea();
}
});
resultsTable.registerKeyboardAction(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
copyMatchListSelectionsToClipboard();
}
}, "Copy", COPY_KEY_STROKE, JComponent.WHEN_FOCUSED);
resultsTable.registerKeyboardAction(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
deleteMatchlistSelections();
}
@@ -588,6 +604,7 @@ public class GUI implements CPDListener {
final JTableHeader header = resultsTable.getTableHeader();
header.addMouseListener(new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent e) {
sortOnColumn(header.columnAtPoint(new Point(e.getX(), e.getY())));
}
@@ -664,8 +681,8 @@ public class GUI implements CPDListener {
tokenizingFilesBar.setMinimum(0);
phaseLabel.setText("");
if (isLegalPath(dirPath.getPath(), conf)) { // should use the
- // language file filter
- // instead?
+ // language file filter
+ // instead?
cpd.add(dirPath);
} else {
if (recurseCheckbox.isSelected()) {
@@ -709,6 +726,7 @@ public class GUI implements CPDListener {
final long start = System.currentTimeMillis();
Timer t = new Timer(1000, new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
long now = System.currentTimeMillis();
long elapsedMillis = now - start;
@@ -754,6 +772,7 @@ public class GUI implements CPDListener {
private int sortColumn;
private boolean sortDescending;
+ @Override
public Object getValueAt(int rowIndex, int columnIndex) {
Match match = items.get(rowIndex);
switch (columnIndex) {
@@ -770,51 +789,64 @@ public class GUI implements CPDListener {
}
}
+ @Override
public int getColumnCount() {
return matchColumns.length;
}
+ @Override
public int getRowCount() {
return items.size();
}
+ @Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
+ @Override
public Class> getColumnClass(int columnIndex) {
return Object.class;
}
+ @Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
}
+ @Override
public String getColumnName(int i) {
return matchColumns[i].label();
}
+ @Override
public void addTableModelListener(TableModelListener l) {
}
+ @Override
public void removeTableModelListener(TableModelListener l) {
}
+ @Override
public int sortColumn() {
return sortColumn;
}
+ @Override
public void sortColumn(int column) {
sortColumn = column;
}
+ @Override
public boolean sortDescending() {
return sortDescending;
}
+ @Override
public void sortDescending(boolean flag) {
sortDescending = flag;
}
+ @Override
public void sort(Comparator comparator) {
Collections.sort(items, comparator);
if (sortDescending) {
@@ -859,6 +891,7 @@ public class GUI implements CPDListener {
}
// CPDListener
+ @Override
public void phaseUpdate(int phase) {
phaseLabel.setText(getPhaseText(phase));
}
@@ -880,6 +913,7 @@ public class GUI implements CPDListener {
}
}
+ @Override
public void addedFile(int fileCount, File file) {
tokenizingFilesBar.setMaximum(fileCount);
tokenizingFilesBar.setValue(tokenizingFilesBar.getValue() + 1);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/LanguageFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/LanguageFactory.java
index 3bd9a1bd8a..2fbd961994 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/LanguageFactory.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/LanguageFactory.java
@@ -18,6 +18,7 @@ public final class LanguageFactory {
private static LanguageFactory instance = new LanguageFactory();
public static String[] supportedLanguages;
+
static {
supportedLanguages = instance.languages.keySet().toArray(new String[instance.languages.size()]);
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Match.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Match.java
index fb5524ad0f..4bb9b83af4 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Match.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Match.java
@@ -18,18 +18,21 @@ public class Match implements Comparable {
private String label;
public static final Comparator MATCHES_COMPARATOR = new Comparator() {
+ @Override
public int compare(Match ma, Match mb) {
return mb.getMarkCount() - ma.getMarkCount();
}
};
public static final Comparator LINES_COMPARATOR = new Comparator() {
+ @Override
public int compare(Match ma, Match mb) {
return mb.getLineCount() - ma.getLineCount();
}
};
public static final Comparator LABEL_COMPARATOR = new Comparator() {
+ @Override
public int compare(Match ma, Match mb) {
if (ma.getLabel() == null) {
return 1;
@@ -42,6 +45,7 @@ public class Match implements Comparable {
};
public static final Comparator LENGTH_COMPARATOR = new Comparator() {
+ @Override
public int compare(Match ma, Match mb) {
return mb.getLineCount() - ma.getLineCount();
}
@@ -77,6 +81,7 @@ public class Match implements Comparable {
return markSet.iterator();
}
+ @Override
public int compareTo(Match other) {
int diff = other.getTokenCount() - getTokenCount();
if (diff != 0) {
@@ -93,6 +98,7 @@ public class Match implements Comparable {
return getMark(1);
}
+ @Override
public String toString() {
return "Match: " + PMD.EOL + "tokenCount = " + tokenCount + PMD.EOL + "marks = " + markSet.size();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java
index 73918b1397..dc2d4ef38b 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/SimpleRenderer.java
@@ -41,7 +41,7 @@ public class SimpleRenderer implements Renderer {
}
rpt.append(PMD.EOL); // add a line to separate the source from the desc
- // above
+ // above
String source = match.getSourceCodeSlice();
@@ -60,6 +60,7 @@ public class SimpleRenderer implements Renderer {
rpt.append(source).append(PMD.EOL);
}
+ @Override
public String render(Iterator matches) {
StringBuilder rpt = new StringBuilder(300);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
index bd6c222fdb..b9a8302e63 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/TokenEntry.java
@@ -95,6 +95,7 @@ public class TokenEntry implements Comparable {
return this.index;
}
+ @Override
public int hashCode() {
return hashCode;
}
@@ -103,6 +104,7 @@ public class TokenEntry implements Comparable {
this.hashCode = hashCode;
}
+ @Override
public boolean equals(Object o) {
if (!(o instanceof TokenEntry)) {
return false;
@@ -111,6 +113,7 @@ public class TokenEntry implements Comparable {
return other.hashCode == hashCode;
}
+ @Override
public int compareTo(TokenEntry other) {
return getIndex() - other.getIndex();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Tokenizer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Tokenizer.java
index 6041ec7d25..77e2de54d9 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Tokenizer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/Tokenizer.java
@@ -19,7 +19,7 @@ public interface Tokenizer {
/**
* Enables or disabled skipping of blocks like a pre-processor. It is a
* boolean property. The default value is true
.
- *
+ *
* @see #OPTION_SKIP_BLOCKS_PATTERN
*/
String OPTION_SKIP_BLOCKS = "net.sourceforge.pmd.cpd.Tokenizer.skipBlocks";
@@ -28,7 +28,7 @@ public interface Tokenizer {
* property and contains of two parts, separated by {@code |}. The first
* part is the start pattern, the second part is the ending pattern. Default
* value is "{@code #if 0|#endif}".
- *
+ *
* @see #DEFAULT_SKIP_BLOCKS_PATTERN
*/
String OPTION_SKIP_BLOCKS_PATTERN = "net.sourceforge.pmd.cpd.Tokenizer.skipBlocksPattern";
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/VSRenderer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/VSRenderer.java
index ddea976914..8e80a783b7 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/VSRenderer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/VSRenderer.java
@@ -10,6 +10,7 @@ import net.sourceforge.pmd.PMD;
public class VSRenderer implements Renderer {
+ @Override
public String render(Iterator matches) {
StringBuilder buffer = new StringBuilder(300);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/XMLRenderer.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/XMLRenderer.java
index b6cea67524..14c28f458c 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/XMLRenderer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/XMLRenderer.java
@@ -23,7 +23,7 @@ import org.w3c.dom.Element;
/**
* @author Philippe T'Seyen - original implementation
* @author Romain Pelisse - javax.xml implementation
- *
+ *
*/
public final class XMLRenderer implements Renderer {
@@ -38,7 +38,7 @@ public final class XMLRenderer implements Renderer {
/**
* Creates a XML Renderer with a specific output encoding.
- *
+ *
* @param encoding
* the encoding to use or null. If null, default (platform
* dependent) encoding is used.
@@ -85,6 +85,7 @@ public final class XMLRenderer implements Renderer {
}
}
+ @Override
public String render(Iterator matches) {
Document doc = createDocument();
Element root = doc.createElement("pmd-cpd");
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/DCD.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/DCD.java
index 35366a531c..5f94569407 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/DCD.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/DCD.java
@@ -95,6 +95,7 @@ public class DCD {
// Basic filter
FilenameFilter javaFilter = new FilenameFilter() {
+ @Override
public boolean accept(File dir, String name) {
// Recurse on directories
if (new File(dir, name).isDirectory()) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/UsageNodeVisitor.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/UsageNodeVisitor.java
index 0cba65d91a..9d543cb201 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/UsageNodeVisitor.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/UsageNodeVisitor.java
@@ -110,6 +110,7 @@ public class UsageNodeVisitor extends NodeVisitorAdapter {
private final Options options = new Options();
+ @Override
public Object visit(UsageGraph usageGraph, Object data) {
System.out.println("----------------------------------------");
super.visit(usageGraph, data);
@@ -117,6 +118,7 @@ public class UsageNodeVisitor extends NodeVisitorAdapter {
return data;
}
+ @Override
public Object visit(ClassNode classNode, Object data) {
boolean log = true;
if (options.isIgnoreClassAnonymous() && classNode.getType().isAnonymousClass()) {
@@ -131,6 +133,7 @@ public class UsageNodeVisitor extends NodeVisitorAdapter {
}
}
+ @Override
public Object visit(FieldNode fieldNode, Object data) {
if (fieldNode.getUsers().isEmpty()) {
boolean log = true;
@@ -152,6 +155,7 @@ public class UsageNodeVisitor extends NodeVisitorAdapter {
return super.visit(fieldNode, data);
}
+ @Override
public Object visit(ConstructorNode constructorNode, Object data) {
if (constructorNode.getUsers().isEmpty()) {
boolean log = true;
@@ -190,6 +194,7 @@ public class UsageNodeVisitor extends NodeVisitorAdapter {
&& method.getParameterTypes()[0].getComponentType().equals(java.lang.String.class);
}
+ @Override
public Object visit(MethodNode methodNode, Object data) {
if (methodNode.getUsers().isEmpty()) {
boolean log = true;
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNode.java
index 2285430f7f..72b8ab5e70 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNode.java
@@ -31,6 +31,7 @@ public class ClassNode implements NodeVisitorAcceptor, Comparable {
this.name = name;
}
+ @Override
public Object accept(NodeVisitor visitor, Object data) {
visitor.visitFields(this, data);
visitor.visitConstructors(this, data);
@@ -107,10 +108,12 @@ public class ClassNode implements NodeVisitorAcceptor, Comparable {
return methodNodes != null ? methodNodes : Collections.emptyList();
}
+ @Override
public int compareTo(ClassNode that) {
return this.name.compareTo(that.name);
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof ClassNode) {
return this.name.equals(((ClassNode) obj).name);
@@ -118,6 +121,7 @@ public class ClassNode implements NodeVisitorAcceptor, Comparable {
return false;
}
+ @Override
public int hashCode() {
return name.hashCode();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNodeComparator.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNodeComparator.java
index e913ea538a..1053396d49 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNodeComparator.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ClassNodeComparator.java
@@ -17,6 +17,7 @@ public final class ClassNodeComparator implements Comparator {
private ClassNodeComparator() {
}
+ @Override
public int compare(Object obj1, Object obj2) {
if (obj1 instanceof String && obj2 instanceof String) {
return ((String) obj1).compareTo((String) obj2);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ConstructorNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ConstructorNode.java
index c44d0db941..6f2c6b1319 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ConstructorNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/ConstructorNode.java
@@ -33,6 +33,7 @@ public class ConstructorNode extends MemberNode>
return ClassLoaderUtil.INIT.equals(name);
}
+ @Override
public Constructor> getMember() {
if (ClassLoaderUtil.CLINIT.equals(name)) {
return null;
@@ -50,6 +51,7 @@ public class ConstructorNode extends MemberNode>
}
}
+ @Override
public String toStringLong() {
if (ClassLoaderUtil.CLINIT.equals(name)) {
return name;
@@ -58,6 +60,7 @@ public class ConstructorNode extends MemberNode>
}
}
+ @Override
public int compareTo(ConstructorNode that) {
// Order by name
int cmp = this.getName().compareTo(that.getName());
@@ -78,6 +81,7 @@ public class ConstructorNode extends MemberNode>
return cmp;
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof ConstructorNode) {
ConstructorNode that = (ConstructorNode) obj;
@@ -85,4 +89,12 @@ public class ConstructorNode extends MemberNode>
}
return false;
}
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.pmd.dcd.graph.MemberNode#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/FieldNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/FieldNode.java
index 0f9e5f2029..9722fbc6da 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/FieldNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/FieldNode.java
@@ -22,6 +22,7 @@ public class FieldNode extends MemberNode {
getMember();
}
+ @Override
public Field getMember() {
Field field = fieldReference == null ? null : fieldReference.get();
if (field == null) {
@@ -31,10 +32,12 @@ public class FieldNode extends MemberNode {
return field;
}
+ @Override
public int compareTo(FieldNode that) {
return this.name.compareTo(that.name);
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof FieldNode) {
FieldNode that = (FieldNode) obj;
@@ -42,4 +45,12 @@ public class FieldNode extends MemberNode {
}
return false;
}
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.pmd.dcd.graph.MemberNode#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java
index 32a784f2d6..2df26997ad 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNode.java
@@ -13,7 +13,7 @@ import java.util.List;
* Represents a Class Member in a UsageGraph.
*/
public abstract class MemberNode, T extends Member>
- implements NodeVisitorAcceptor, Comparable {
+ implements NodeVisitorAcceptor, Comparable {
protected final ClassNode classNode;
protected final String name;
@@ -32,6 +32,7 @@ public abstract class MemberNode, T extends Member>
this.desc = desc;
}
+ @Override
public Object accept(NodeVisitor visitor, Object data) {
visitor.visitUses(this, data);
visitor.visitUsers(this, data);
@@ -78,6 +79,7 @@ public abstract class MemberNode, T extends Member>
return users != null ? users : Collections.emptyList();
}
+ @Override
public String toString() {
return name + " " + desc;
}
@@ -86,8 +88,6 @@ public abstract class MemberNode, T extends Member>
return getMember().toString();
}
- public abstract boolean equals(Object that);
-
@SuppressWarnings("PMD.SuspiciousEqualsMethodName")
public boolean equals(S that) {
return equals(that.name, that.desc);
@@ -97,7 +97,47 @@ public abstract class MemberNode, T extends Member>
return this.name.equals(name) && this.desc.equals(desc);
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
public int hashCode() {
- return name.hashCode() + desc.hashCode();
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((desc == null) ? 0 : desc.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ MemberNode other = (MemberNode) obj;
+ if (desc == null) {
+ if (other.desc != null) {
+ return false;
+ }
+ } else if (!desc.equals(other.desc)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ return true;
}
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNodeComparator.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNodeComparator.java
index feff208922..23455143d8 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNodeComparator.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MemberNodeComparator.java
@@ -17,6 +17,7 @@ public final class MemberNodeComparator implements Comparator {
private MemberNodeComparator() {
}
+ @Override
public int compare(MemberNode node1, MemberNode node2) {
if (node1 instanceof FieldNode) {
if (node2 instanceof FieldNode) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MethodNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MethodNode.java
index 15b94faf2a..67a4c656b2 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MethodNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/MethodNode.java
@@ -25,6 +25,7 @@ public class MethodNode extends MemberNode {
// getMember();
}
+ @Override
public Method getMember() {
Method method = methodReference == null ? null : methodReference.get();
if (method == null) {
@@ -37,6 +38,7 @@ public class MethodNode extends MemberNode {
return method;
}
+ @Override
public int compareTo(MethodNode that) {
// Order by method name
int cmp = this.getName().compareTo(that.getName());
@@ -57,6 +59,7 @@ public class MethodNode extends MemberNode {
return cmp;
}
+ @Override
public boolean equals(Object obj) {
if (obj instanceof MethodNode) {
MethodNode that = (MethodNode) obj;
@@ -64,4 +67,12 @@ public class MethodNode extends MemberNode {
}
return false;
}
+
+ /* (non-Javadoc)
+ * @see net.sourceforge.pmd.dcd.graph.MemberNode#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/NodeVisitorAdapter.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/NodeVisitorAdapter.java
index 93e85a47e9..bbabb24f84 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/NodeVisitorAdapter.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/NodeVisitorAdapter.java
@@ -13,14 +13,17 @@ import java.util.List;
*/
public class NodeVisitorAdapter implements NodeVisitor {
+ @Override
public Object visit(UsageGraph usageGraph, Object data) {
return usageGraph.accept(this, data);
}
+ @Override
public Object visit(ClassNode classNode, Object data) {
return classNode.accept(this, data);
}
+ @Override
public Object visitFields(ClassNode classNode, Object data) {
for (FieldNode fieldNode : classNode.getFieldNodes()) {
visit(fieldNode, data);
@@ -28,10 +31,12 @@ public class NodeVisitorAdapter implements NodeVisitor {
return data;
}
+ @Override
public Object visit(FieldNode fieldNode, Object data) {
return fieldNode.accept(this, data);
}
+ @Override
public Object visitConstructors(ClassNode classNode, Object data) {
for (ConstructorNode constructorNode : classNode.getConstructorNodes()) {
visit(constructorNode, data);
@@ -39,10 +44,12 @@ public class NodeVisitorAdapter implements NodeVisitor {
return data;
}
+ @Override
public Object visit(ConstructorNode constructorNode, Object data) {
return constructorNode.accept(this, data);
}
+ @Override
public Object visitMethods(ClassNode classNode, Object data) {
for (MethodNode methodNode : classNode.getMethodNodes()) {
visit(methodNode, data);
@@ -50,10 +57,12 @@ public class NodeVisitorAdapter implements NodeVisitor {
return data;
}
+ @Override
public Object visit(MethodNode methodNode, Object data) {
return methodNode.accept(this, data);
}
+ @Override
public Object visitUses(MemberNode memberNode, Object data) {
for (MemberNode use : (List) memberNode.getUses()) {
this.visitUse(use, data);
@@ -61,10 +70,12 @@ public class NodeVisitorAdapter implements NodeVisitor {
return data;
}
+ @Override
public Object visitUse(MemberNode memberNode, Object data) {
return data;
}
+ @Override
public Object visitUsers(MemberNode memberNode, Object data) {
for (MemberNode user : (List) memberNode.getUsers()) {
this.visitUser(user, data);
@@ -72,6 +83,7 @@ public class NodeVisitorAdapter implements NodeVisitor {
return data;
}
+ @Override
public Object visitUser(MemberNode memberNode, Object data) {
return data;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraph.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraph.java
index 33129e453a..544f62a226 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraph.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraph.java
@@ -54,6 +54,7 @@ public class UsageGraph implements NodeVisitorAcceptor {
this.classFilter = classFilter;
}
+ @Override
public Object accept(NodeVisitor visitor, Object data) {
for (ClassNode classNode : classNodes) {
visitor.visit(classNode, data);
@@ -124,7 +125,7 @@ public class UsageGraph implements NodeVisitorAcceptor {
user.addUse(use);
}
- private final void checkClassName(String className) {
+ private void checkClassName(String className) {
// Make sure it's not in byte code internal format, or file system path.
if (className.indexOf('/') >= 0 || className.indexOf('\\') >= 0) {
throw new IllegalArgumentException("Invalid class name: " + className);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraphBuilder.java b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraphBuilder.java
index af56adcfb8..5fbcd31c61 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraphBuilder.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/dcd/graph/UsageGraphBuilder.java
@@ -80,7 +80,7 @@ public class UsageGraphBuilder {
private final PrintVisitor p;
private String className;
- public MyClassVisitor() {
+ MyClassVisitor() {
super(Opcodes.ASM5);
p = new PrintVisitor();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java
index bb9e437b93..cd702f081c 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java
@@ -10,27 +10,32 @@ import net.sourceforge.pmd.lang.dfa.DFAGraphRule;
/**
* This is a generic implementation of the LanguageVersionHandler interface.
- *
+ *
* @see LanguageVersionHandler
*/
public abstract class AbstractLanguageVersionHandler implements LanguageVersionHandler {
+ @Override
public DataFlowHandler getDataFlowHandler() {
return DataFlowHandler.DUMMY;
}
+ @Override
public XPathHandler getXPathHandler() {
return XPathHandler.DUMMY;
}
+ @Override
public ParserOptions getDefaultParserOptions() {
return new ParserOptions();
}
+ @Override
public VisitorStarter getDataFlowFacade() {
return VisitorStarter.DUMMY;
}
+ @Override
public VisitorStarter getSymbolFacade() {
return VisitorStarter.DUMMY;
}
@@ -40,14 +45,17 @@ public abstract class AbstractLanguageVersionHandler implements LanguageVersionH
return VisitorStarter.DUMMY;
}
+ @Override
public VisitorStarter getTypeResolutionFacade(ClassLoader classLoader) {
return VisitorStarter.DUMMY;
}
+ @Override
public VisitorStarter getDumpFacade(final Writer writer, final String prefix, final boolean recurse) {
return VisitorStarter.DUMMY;
}
+ @Override
public DFAGraphRule getDFAGraphRule() {
return null;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractParser.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractParser.java
index 85e22df6f7..93fa30f49e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractParser.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractParser.java
@@ -8,7 +8,7 @@ import java.io.Reader;
/**
* This is a generic implementation of the Parser interface.
- *
+ *
* @see Parser
*/
public abstract class AbstractParser implements Parser {
@@ -18,10 +18,12 @@ public abstract class AbstractParser implements Parser {
this.parserOptions = parserOptions;
}
+ @Override
public ParserOptions getParserOptions() {
return parserOptions;
}
+ @Override
public TokenManager getTokenManager(String fileName, Reader source) {
TokenManager tokenManager = createTokenManager(source);
tokenManager.setFileName(fileName);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java
index 0d0c20d926..8b7827c247 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/BaseLanguageModule.java
@@ -84,6 +84,7 @@ public abstract class BaseLanguageModule implements Language {
return versions != null && versions.containsKey(version);
}
+ @Override
public LanguageVersion getVersion(String versionName) {
if (versions != null) {
return versions.get(versionName);
@@ -108,10 +109,12 @@ public abstract class BaseLanguageModule implements Language {
@Override
public boolean equals(Object obj) {
- if (obj == null)
+ if (obj == null) {
return false;
- if (!(obj instanceof BaseLanguageModule))
+ }
+ if (!(obj instanceof BaseLanguageModule)) {
return false;
+ }
BaseLanguageModule other = (BaseLanguageModule) obj;
return name.equals(other.name);
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/DataFlowHandler.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/DataFlowHandler.java
index e2420e729c..4ee375057a 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/DataFlowHandler.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/DataFlowHandler.java
@@ -12,10 +12,12 @@ import net.sourceforge.pmd.lang.dfa.DataFlowNode;
public interface DataFlowHandler {
DataFlowHandler DUMMY = new DataFlowHandler() {
+ @Override
public DataFlowNode createDataFlowNode(List dataFlow, Node node) {
return null;
}
+ @Override
public Class extends Node> getLabelStatementNodeClass() {
return null;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/Language.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/Language.java
index 1e5d0ac02e..b638af8998 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/Language.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/Language.java
@@ -33,7 +33,7 @@ public interface Language extends Comparable {
/**
* Get the full name of this Language. This is generally the name of this
* Language without the use of acronyms.
- *
+ *
* @return The full name of this Language.
*/
String getName();
@@ -41,21 +41,21 @@ public interface Language extends Comparable {
/**
* Get the short name of this Language. This is the commonly used short form
* of this Language's name, perhaps an acronym.
- *
+ *
* @return The short name of this Language.
*/
String getShortName();
/**
* Get the terse name of this Language. This is used for Rule configuration.
- *
+ *
* @return The terse name of this Language.
*/
String getTerseName();
/**
* Get the list of file extensions associated with this Language.
- *
+ *
* @return List of file extensions.
*/
List getExtensions();
@@ -63,7 +63,7 @@ public interface Language extends Comparable {
/**
* Returns whether the given Language handles the given file extension. The
* comparison is done ignoring case.
- *
+ *
* @param extension
* A file extension.
* @return true
if this Language handles this extension,
@@ -74,7 +74,7 @@ public interface Language extends Comparable {
/**
* Get the RuleChainVisitor implementation class used when visiting the AST
* structure for this Rules for this Language.
- *
+ *
* @return The RuleChainVisitor class.
* @see net.sourceforge.pmd.lang.rule.RuleChainVisitor
*/
@@ -82,7 +82,7 @@ public interface Language extends Comparable {
/**
* Gets the list of supported LanguageVersion for this Language.
- *
+ *
* @return The LanguageVersion for this Language.
*/
List getVersions();
@@ -91,7 +91,7 @@ public interface Language extends Comparable {
/**
* Get the LanguageVersion for the version string from this Language.
- *
+ *
* @param version
* The language version string.
* @return The corresponding LanguageVersion, null
if the
@@ -103,7 +103,7 @@ public interface Language extends Comparable {
* Get the current PMD defined default LanguageVersion for this Language.
* This is an arbitrary choice made by the PMD product, and can change
* between PMD releases. Every Language has a default version.
- *
+ *
* @return The current default LanguageVersion for this Language.
*/
LanguageVersion getDefaultVersion();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageFilenameFilter.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageFilenameFilter.java
index a546ff8696..7a7ca02169 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageFilenameFilter.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageFilenameFilter.java
@@ -23,7 +23,7 @@ public class LanguageFilenameFilter implements FilenameFilter {
/**
* Create a LanguageFilenameFilter for a single Language.
- *
+ *
* @param language
* The Language.
*/
@@ -33,7 +33,7 @@ public class LanguageFilenameFilter implements FilenameFilter {
/**
* Create a LanguageFilenameFilter for a List of Languages.
- *
+ *
* @param languages
* The List of Languages.
*/
@@ -44,6 +44,7 @@ public class LanguageFilenameFilter implements FilenameFilter {
/**
* Check if a file should be checked by PMD. {@inheritDoc}
*/
+ @Override
public boolean accept(File dir, String name) {
// Any source file should have a '.' in its name...
int lastDotIndex = name.lastIndexOf('.');
@@ -62,6 +63,7 @@ public class LanguageFilenameFilter implements FilenameFilter {
return false;
}
+ @Override
public String toString() {
StringBuilder buffer = new StringBuilder("(Extension is one of: ");
for (Language language : languages) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageRegistry.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageRegistry.java
index 34d4673256..8b91e25f0e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageRegistry.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageRegistry.java
@@ -112,7 +112,7 @@ public final class LanguageRegistry {
/**
* A utility method to find the Languages which have Rule support.
- *
+ *
* @return A List of Languages with Rule support.
*/
public static List findWithRuleSupport() {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersion.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersion.java
index 32667c0fbc..2da37bc700 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersion.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersion.java
@@ -34,7 +34,7 @@ public class LanguageVersion implements Comparable {
/**
* Get the name of this LanguageVersion. This is Language name appended with
* the LanguageVersion version if not an empty String.
- *
+ *
* @return The name of this LanguageVersion.
*/
public String getName() {
@@ -44,7 +44,7 @@ public class LanguageVersion implements Comparable {
/**
* Get the short name of this LanguageVersion. This is Language short name
* appended with the LanguageVersion version if not an empty String.
- *
+ *
* @return The short name of this LanguageVersion.
*/
public String getShortName() {
@@ -54,7 +54,7 @@ public class LanguageVersion implements Comparable {
/**
* Get the terse name of this LanguageVersion. This is Language terse name
* appended with the LanguageVersion version if not an empty String.
- *
+ *
* @return The terse name of this LanguageVersion.
*/
public String getTerseName() {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionDiscoverer.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionDiscoverer.java
index 4eef60d879..d0c1ec9b56 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionDiscoverer.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionDiscoverer.java
@@ -19,7 +19,7 @@ public class LanguageVersionDiscoverer {
/**
* Set the given LanguageVersion as the current default for it's Language.
- *
+ *
* @param languageVersion
* The new default for the Language.
* @return The previous default version for the language.
@@ -35,7 +35,7 @@ public class LanguageVersionDiscoverer {
/**
* Get the current default LanguageVersion for the given Language.
- *
+ *
* @param language
* The Language.
* @return The current default version for the language.
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionHandler.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionHandler.java
index 33a2632ec9..4642ea7898 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionHandler.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageVersionHandler.java
@@ -34,7 +34,7 @@ public interface LanguageVersionHandler {
/**
* Get the default ParserOptions.
- *
+ *
* @return ParserOptions
*/
ParserOptions getDefaultParserOptions();
@@ -62,7 +62,7 @@ public interface LanguageVersionHandler {
/**
* Get the SymbolFacade.
- *
+ *
* @param classLoader
* A ClassLoader to use for resolving Types.
* @return VisitorStarter
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/Parser.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/Parser.java
index 9238a77935..8cbd404a8a 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/Parser.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/Parser.java
@@ -23,7 +23,7 @@ public interface Parser {
/**
* Get a TokenManager for the given source.
- *
+ *
* @param fileName
* The file name being parsed (may be null
).
* @param source
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/VisitorStarter.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/VisitorStarter.java
index 023bea2ad2..56c1151ab2 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/VisitorStarter.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/VisitorStarter.java
@@ -8,7 +8,7 @@ import net.sourceforge.pmd.lang.ast.Node;
/**
* Interface for starting an implementation of the visitors for ASTs.
- *
+ *
* @author pieter_van_raemdonck - Application Engineers NV/SA - www.ae.be
*/
public interface VisitorStarter {
@@ -19,6 +19,7 @@ public interface VisitorStarter {
* nothing.
*/
VisitorStarter DUMMY = new VisitorStarter() {
+ @Override
public void start(Node rootNode) {
// does nothing - dummy implementation.
}
@@ -26,7 +27,7 @@ public interface VisitorStarter {
/**
* Start the visitor, given the root-node of the AST.
- *
+ *
* @param rootNode
* The root node of the AST
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/XPathHandler.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/XPathHandler.java
index 1603e17a19..323182f616 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/XPathHandler.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/XPathHandler.java
@@ -6,9 +6,10 @@ package net.sourceforge.pmd.lang;
import org.jaxen.Navigator;
-import net.sf.saxon.sxpath.IndependentContext;
import net.sourceforge.pmd.lang.xpath.Initializer;
+import net.sf.saxon.sxpath.IndependentContext;
+
/**
* Interface for performing Language specific XPath handling, such as
* initialization and navigation.
@@ -16,12 +17,15 @@ import net.sourceforge.pmd.lang.xpath.Initializer;
public interface XPathHandler {
XPathHandler DUMMY = new XPathHandler() {
+ @Override
public void initialize() {
}
+ @Override
public void initialize(IndependentContext context) {
}
+ @Override
public Navigator getNavigator() {
return null;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AbstractNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AbstractNode.java
index 86f4027f73..fec86b965a 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AbstractNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/AbstractNode.java
@@ -395,7 +395,7 @@ public abstract class AbstractNode implements Node {
}
/**
- *
+ *
* @param types
* @return boolean
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/Node.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/Node.java
index 7a31753665..9c123b71bc 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/Node.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/Node.java
@@ -45,7 +45,7 @@ public interface Node {
/**
* Sets the index of this node from the perspective of its parent. This
* means: this.jjtGetParent().jjtGetChild(index) == this.
- *
+ *
* @param index
* the child index
*/
@@ -197,7 +197,7 @@ public interface Node {
/**
* Get the user data associated with this node. By default there is no data,
* unless it has been set via {@link #setUserData(Object)}.
- *
+ *
* @return The user data set on this node.
*/
Object getUserData();
@@ -212,7 +212,7 @@ public interface Node {
* This API is most useful for external applications looking to leverage
* PMD's robust support for AST structures, in which case application
* specific annotations on the AST nodes can be quite useful.
- *
+ *
* @param userData
* The data to set on this node.
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SourceCodePositioner.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SourceCodePositioner.java
index cb1852f635..152185bd2f 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SourceCodePositioner.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/SourceCodePositioner.java
@@ -10,7 +10,7 @@ import java.util.Arrays;
* Calculates from an absolute offset in the source file the line/column
* coordinate. This is needed as Rhino only offers absolute positions for each
* node. Some other languages like XML and Apex use this, too.
- *
+ *
* Idea from:
* http://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/javascript/jscomp/SourceFile.java
*/
@@ -49,7 +49,7 @@ public class SourceCodePositioner {
insertionPoint += 1;
insertionPoint *= -1;
lineNumber = insertionPoint - 1; // take the insertion point one
- // before
+ // before
}
return lineNumber + 1; // 1-based line numbers
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AbstractASTXPathHandler.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AbstractASTXPathHandler.java
index 720b9345ab..c645338204 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AbstractASTXPathHandler.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AbstractASTXPathHandler.java
@@ -6,12 +6,14 @@ package net.sourceforge.pmd.lang.ast.xpath;
import org.jaxen.Navigator;
-import net.sf.saxon.sxpath.IndependentContext;
import net.sourceforge.pmd.lang.Language;
import net.sourceforge.pmd.lang.XPathHandler;
+import net.sf.saxon.sxpath.IndependentContext;
+
public abstract class AbstractASTXPathHandler implements XPathHandler {
+ @Override
public Navigator getNavigator() {
return new DocumentNavigator();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java
index b7142abd2b..07a0eaa3cc 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/Attribute.java
@@ -73,6 +73,7 @@ public class Attribute {
return parent;
}
+ @Override
public String toString() {
return name + ":" + getValue() + ":" + parent;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AttributeAxisIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AttributeAxisIterator.java
index 8cc4da92ab..71f8e3998d 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AttributeAxisIterator.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/AttributeAxisIterator.java
@@ -20,7 +20,7 @@ public class AttributeAxisIterator implements Iterator {
public Method method;
public String name;
- public MethodWrapper(Method m) {
+ MethodWrapper(Method m) {
this.method = m;
this.name = truncateMethodName(m.getName());
}
@@ -71,6 +71,7 @@ public class AttributeAxisIterator implements Iterator {
this.currObj = getNextAttribute();
}
+ @Override
public Attribute next() {
if (currObj == null) {
throw new IndexOutOfBoundsException();
@@ -80,10 +81,12 @@ public class AttributeAxisIterator implements Iterator {
return ret;
}
+ @Override
public boolean hasNext() {
return currObj != null;
}
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/NodeIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/NodeIterator.java
index c85c3523f1..7f1cb1867a 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/NodeIterator.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/NodeIterator.java
@@ -20,10 +20,12 @@ public abstract class NodeIterator implements Iterator {
this.node = getFirstNode(contextNode);
}
+ @Override
public boolean hasNext() {
return node != null;
}
+ @Override
public Node next() {
if (node == null) {
throw new NoSuchElementException();
@@ -33,6 +35,7 @@ public abstract class NodeIterator implements Iterator {
return ret;
}
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AbstractNodeInfo.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AbstractNodeInfo.java
index b13bd65b14..a04c381191 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AbstractNodeInfo.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AbstractNodeInfo.java
@@ -126,6 +126,15 @@ public class AbstractNodeInfo implements VirtualNode, SiblingCountingNode {
return false;
}
+ @Override
+ public int hashCode() {
+ if (this.getUnderlyingNode() != null) {
+ return super.hashCode() + 31 * this.getUnderlyingNode().hashCode();
+ } else {
+ return super.hashCode();
+ }
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeAxisIterator.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeAxisIterator.java
index 34e7735710..5062efbee4 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeAxisIterator.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeAxisIterator.java
@@ -4,9 +4,10 @@
package net.sourceforge.pmd.lang.ast.xpath.saxon;
+import net.sourceforge.pmd.lang.ast.xpath.Attribute;
+
import net.sf.saxon.om.Navigator;
import net.sf.saxon.om.SequenceIterator;
-import net.sourceforge.pmd.lang.ast.xpath.Attribute;
/**
* This is an Attribute axis iterator.
@@ -18,7 +19,7 @@ public class AttributeAxisIterator extends Navigator.BaseEnumeration {
/**
* Create an iterator over the Attribute axis for the given ElementNode.
- *
+ *
* @see net.sourceforge.pmd.lang.ast.xpath.AttributeAxisIterator
*/
public AttributeAxisIterator(ElementNode startNodeInfo) {
@@ -29,6 +30,7 @@ public class AttributeAxisIterator extends Navigator.BaseEnumeration {
/**
* {@inheritDoc}
*/
+ @Override
public SequenceIterator getAnother() {
return new AttributeAxisIterator(startNodeInfo);
}
@@ -36,6 +38,7 @@ public class AttributeAxisIterator extends Navigator.BaseEnumeration {
/**
* {@inheritDoc}
*/
+ @Override
public void advance() {
if (this.iterator.hasNext()) {
Attribute attribute = this.iterator.next();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeNode.java
index 923ce1096b..624250ef3f 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/AttributeNode.java
@@ -4,6 +4,8 @@
package net.sourceforge.pmd.lang.ast.xpath.saxon;
+import net.sourceforge.pmd.lang.ast.xpath.Attribute;
+
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.SequenceIterator;
import net.sf.saxon.trans.XPathException;
@@ -13,7 +15,6 @@ import net.sf.saxon.value.EmptySequence;
import net.sf.saxon.value.Int64Value;
import net.sf.saxon.value.StringValue;
import net.sf.saxon.value.Value;
-import net.sourceforge.pmd.lang.ast.xpath.Attribute;
/**
* A Saxon OM Attribute node for an AST Node Attribute.
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/DocumentNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/DocumentNode.java
index 08d5be1c69..e1de476a16 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/DocumentNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/DocumentNode.java
@@ -8,6 +8,8 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import net.sourceforge.pmd.lang.ast.Node;
+
import net.sf.saxon.om.Axis;
import net.sf.saxon.om.AxisIterator;
import net.sf.saxon.om.DocumentInfo;
@@ -15,7 +17,6 @@ import net.sf.saxon.om.Navigator;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.SingleNodeIterator;
import net.sf.saxon.type.Type;
-import net.sourceforge.pmd.lang.ast.Node;
/**
* A Saxon OM Document node for an AST Node.
@@ -35,10 +36,10 @@ public class DocumentNode extends AbstractNodeInfo implements DocumentInfo {
/**
* Construct a DocumentNode, with the given AST Node serving as the root
* ElementNode.
- *
+ *
* @param node
* The root AST Node.
- *
+ *
* @see ElementNode
*/
public DocumentNode(Node node) {
@@ -48,6 +49,7 @@ public class DocumentNode extends AbstractNodeInfo implements DocumentInfo {
/**
* {@inheritDoc}
*/
+ @Override
public String[] getUnparsedEntity(String name) {
throw createUnsupportedOperationException("DocumentInfo.getUnparsedEntity(String)");
}
@@ -55,6 +57,7 @@ public class DocumentNode extends AbstractNodeInfo implements DocumentInfo {
/**
* {@inheritDoc}
*/
+ @Override
public Iterator getUnparsedEntityNames() {
throw createUnsupportedOperationException("DocumentInfo.getUnparsedEntityNames()");
}
@@ -62,6 +65,7 @@ public class DocumentNode extends AbstractNodeInfo implements DocumentInfo {
/**
* {@inheritDoc}
*/
+ @Override
public NodeInfo selectID(String id) {
throw createUnsupportedOperationException("DocumentInfo.selectID(String)");
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/ElementNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/ElementNode.java
index 1813defa98..aa3d815a57 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/ElementNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/ast/xpath/saxon/ElementNode.java
@@ -4,6 +4,8 @@
package net.sourceforge.pmd.lang.ast.xpath.saxon;
+import net.sourceforge.pmd.lang.ast.Node;
+
import net.sf.saxon.om.Axis;
import net.sf.saxon.om.AxisIterator;
import net.sf.saxon.om.DocumentInfo;
@@ -13,7 +15,6 @@ import net.sf.saxon.om.NodeArrayIterator;
import net.sf.saxon.om.NodeInfo;
import net.sf.saxon.om.SingleNodeIterator;
import net.sf.saxon.type.Type;
-import net.sourceforge.pmd.lang.ast.Node;
/**
* A Saxon OM Element type node for an AST Node.
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/AbstractDataFlowNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/AbstractDataFlowNode.java
index 9406a312dd..f19a940a2e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/AbstractDataFlowNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/AbstractDataFlowNode.java
@@ -44,6 +44,7 @@ public abstract class AbstractDataFlowNode implements DataFlowNode {
this.line = node.getBeginLine();
}
+ @Override
public void addPathToChild(DataFlowNode child) {
DataFlowNode thisChild = child;
// TODO - throw an exception if already contained in children list?
@@ -53,12 +54,14 @@ public abstract class AbstractDataFlowNode implements DataFlowNode {
}
}
+ @Override
public boolean removePathToChild(DataFlowNode child) {
DataFlowNode thisChild = child;
thisChild.getParents().remove(this);
return this.children.remove(thisChild);
}
+ @Override
public void reverseParentPathsTo(DataFlowNode destination) {
while (!parents.isEmpty()) {
DataFlowNode parent = parents.get(0);
@@ -67,14 +70,17 @@ public abstract class AbstractDataFlowNode implements DataFlowNode {
}
}
+ @Override
public int getLine() {
return this.line;
}
+ @Override
public void setType(int type) {
this.type.set(type);
}
+ @Override
public boolean isType(int intype) {
try {
return type.get(intype);
@@ -84,26 +90,32 @@ public abstract class AbstractDataFlowNode implements DataFlowNode {
return false;
}
+ @Override
public Node getNode() {
return this.node;
}
+ @Override
public List getChildren() {
return this.children;
}
+ @Override
public List getParents() {
return this.parents;
}
+ @Override
public List getFlow() {
return this.dataFlow;
}
+ @Override
public int getIndex() {
return this.dataFlow.indexOf(this);
}
+ @Override
public void setVariableAccess(List variableAccess) {
if (this.variableAccess.isEmpty()) {
this.variableAccess = variableAccess;
@@ -112,6 +124,7 @@ public abstract class AbstractDataFlowNode implements DataFlowNode {
}
}
+ @Override
public List getVariableAccess() {
return this.variableAccess;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Linker.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Linker.java
index 3feecf96e3..db043ce071 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Linker.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Linker.java
@@ -159,18 +159,18 @@ public class Linker {
/*
* for(int i = cList.indexOf(node)-1;i>=0;i--) { IDataFlowNode n
* = (IDataFlowNode)cList.get(i);
- *
+ *
* if(n.isType(NodeType.FOR_UPDATE) ||
* n.isType(NodeType.FOR_EXPR) || n.isType(NodeType.WHILE_EXPR))
* {
*/
/*
* while(..) { while(...) { ... } continue; }
- *
+ *
* Without this Expression he continues the second WHILE loop.
* The continue statement and the while loop have to be in
* different scopes.
- *
+ *
* TODO An error occurs if "continue" is even nested in scopes
* other than local loop scopes, like "if". The result is, that
* the data flow isn't build right and the pathfinder runs in
@@ -180,31 +180,30 @@ public class Linker {
* if(n.getNode().getScope().equals(node.getNode().getScope()))
* { System.err.println("equals"); continue; } else {
* System.err.println("don't equals"); }
- *
+ *
* //remove all children (should contain only one child)
* node.removePathToChild
* ((IDataFlowNode)node.getChildren().get(0));
- *
+ *
* node.addPathToChild(n); cbrStack.remove(0); break;
- *
+ *
* }else if(n.isType(NodeType.DO_BEFOR_FIRST_STATEMENT)) {
- *
+ *
* IDataFlowNode inode =
* (IDataFlowNode)n.getFlow().get(n.getIndex()1);
- *
+ *
* for(int j=0;j stackList) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/LinkerException.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/LinkerException.java
index 8dc63c2783..a1300d7f03 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/LinkerException.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/LinkerException.java
@@ -11,10 +11,8 @@ public class LinkerException extends Exception {
private static final long serialVersionUID = 3238380880636634352L;
public LinkerException() {
- super("An error occured by computing the data flow paths"); // TODO
- // redefinition
- // |
- // accurate?
+ // TODO redefinition | accurate?
+ super("An error occured by computing the data flow paths");
}
public LinkerException(String message) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/NodeType.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/NodeType.java
index dc5a842d4a..3469ab02fb 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/NodeType.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/NodeType.java
@@ -47,6 +47,7 @@ public class NodeType {
// Poor Man's Enum until we convert the class to real enum
private static final Map TYPE_MAP = new HashMap<>();
+
static {
TYPE_MAP.put(NodeType.IF_EXPR, "IF_EXPR");
TYPE_MAP.put(NodeType.IF_LAST_STATEMENT, "IF_LAST_STATEMENT");
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/SequenceChecker.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/SequenceChecker.java
index 95e4b1f0d8..3abc4f8947 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/SequenceChecker.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/SequenceChecker.java
@@ -34,11 +34,11 @@ public class SequenceChecker {
private int type;
private boolean lastStep;
- public Status(int type) {
+ Status(int type) {
this(type, false);
}
- public Status(int type, boolean lastStep) {
+ Status(int type, boolean lastStep) {
this.type = type;
this.lastStep = lastStep;
}
@@ -48,7 +48,7 @@ public class SequenceChecker {
}
/**
- *
+ *
* @param type
* candidate
* @return valid Status or null if NodeType is not a valid transition
@@ -180,7 +180,7 @@ public class SequenceChecker {
/*
* Walk through the bracesList attempting to identify the first
* contiguous graph of Nodes from the initial Status to a final Status.
- *
+ *
* There are 2 loop indexes:- i which ranges through the bracesList:
* this may be reset l serves as a control to cope with invalid lists of
* StackObjects, preventing infinite loops within the SequenceChecker.
@@ -211,9 +211,8 @@ public class SequenceChecker {
LOGGER.finer("aktStatus is NULL (lookAhead): Invalid transition");
LOGGER.exiting(this.getClass().getCanonicalName(), "run", false);
return false;
- }
- // Cope with incorrect bracesList contents
- else if (l > maximumIterations) {
+ } else if (l > maximumIterations) {
+ // Cope with incorrect bracesList contents
if (LOGGER.isLoggable(Level.SEVERE)) {
LOGGER.severe("aktStatus is NULL: maximum Iterations exceeded, abort " + i);
}
@@ -229,10 +228,10 @@ public class SequenceChecker {
}
continue;
}
- } else { // This NodeType _is_ a valid transition from the previous
- // State
- if (aktStatus.isLastStep() && !aktStatus.hasMoreSteps()) { // Terminal
- // State
+ } else {
+ // This NodeType _is_ a valid transition from the previous State
+ if (aktStatus.isLastStep() && !aktStatus.hasMoreSteps()) {
+ // Terminal State
this.lastIndex = i;
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.finest("aktStatus is NOT NULL: lastStep reached and no moreSteps - firstIndex="
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StackObject.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StackObject.java
index 6bb65b60cb..92a1377391 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StackObject.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StackObject.java
@@ -23,6 +23,7 @@ public class StackObject {
return this.type;
}
+ @Override
public String toString() {
return ("StackObject: type=" + NodeType.stringFromType(type) + "(" + type + "), node=" + node.toString());
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StartOrEndDataFlowNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StartOrEndDataFlowNode.java
index cf50e8ce5e..0eb7f33f98 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StartOrEndDataFlowNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/StartOrEndDataFlowNode.java
@@ -16,6 +16,7 @@ public class StartOrEndDataFlowNode extends AbstractDataFlowNode {
this.isStartNode = isStartNode;
}
+ @Override
public String toString() {
return isStartNode ? "Start node" : "End node";
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Structure.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Structure.java
index d0d60ab1e5..2adfeac5c1 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Structure.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/Structure.java
@@ -95,7 +95,7 @@ public class Structure {
}
/**
- *
+ *
* @return formatted dump of the DFA Structure's
*/
public String dump() {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java
index 6b100b349d..dca5da4676 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/VariableAccess.java
@@ -48,6 +48,7 @@ public class VariableAccess {
return variableName;
}
+ @Override
public String toString() {
if (isDefinition()) {
return "Definition(" + variableName + ")";
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/DAAPathFinder.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/DAAPathFinder.java
index 47117a3018..e8dc4773a0 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/DAAPathFinder.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/DAAPathFinder.java
@@ -12,7 +12,7 @@ import net.sourceforge.pmd.lang.dfa.NodeType;
/**
* Finds all paths of a data flow. Each loop will be 0 or 2 times traversed -> 2
* paths. This is special to the data flow anomaly analysis.
- *
+ *
* @since Created on 09.08.2004
* @author raik
*/
@@ -144,9 +144,8 @@ public class DAAPathFinder {
}
} else {
DataFlowNode inode = currentPath.getLast();
- DataFlowNode child = inode.getChildren().get(0); // TODO ????
- // IMPORTANT -
- // ERROR?
+ // TODO ???? IMPORTANT - ERROR?
+ DataFlowNode child = inode.getChildren().get(0);
this.currentPath.addLast(child);
}
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/Executable.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/Executable.java
index 4a9f0bafb5..fefde71b15 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/Executable.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/pathfinder/Executable.java
@@ -6,7 +6,7 @@ package net.sourceforge.pmd.lang.dfa.pathfinder;
/**
* Created on 09.08.2004
- *
+ *
* @author raik
*
* Will be executed if PathFinder finds a path.
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ClassNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ClassNode.java
index 4bff911d37..747be9e52a 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ClassNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ClassNode.java
@@ -16,6 +16,7 @@ public class ClassNode extends AbstractReportNode {
return className;
}
+ @Override
public boolean equalsNode(AbstractReportNode arg0) {
if (!(arg0 instanceof ClassNode)) {
return false;
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/PackageNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/PackageNode.java
index a6429550c9..24d2e9ac5a 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/PackageNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/PackageNode.java
@@ -16,6 +16,7 @@ public class PackageNode extends AbstractReportNode {
return this.packageName;
}
+ @Override
public boolean equalsNode(AbstractReportNode arg0) {
if (!(arg0 instanceof PackageNode)) {
return false;
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportHTMLPrintVisitor.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportHTMLPrintVisitor.java
index 7983fca6a7..dbee8e1e93 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportHTMLPrintVisitor.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportHTMLPrintVisitor.java
@@ -84,6 +84,7 @@ public class ReportHTMLPrintVisitor extends ReportVisitor {
* contains the name of the class, Package - represents a package and
* contains the name(s) of the package.
*/
+ @Override
public void visit(AbstractReportNode node) {
/*
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportTree.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportTree.java
index f2dc2ce480..18d58771d1 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportTree.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ReportTree.java
@@ -18,15 +18,18 @@ public class ReportTree implements Iterable {
private AbstractReportNode iterNode = rootNode;
private boolean hasNextFlag;
+ @Override
public void remove() {
throw new UnsupportedOperationException();
}
+ @Override
public boolean hasNext() {
hasNextFlag = true;
return getNext() != null;
}
+ @Override
public RuleViolation next() {
if (!hasNextFlag) {
getNext();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ViolationNode.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ViolationNode.java
index 1958b746bf..184d7d701c 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ViolationNode.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/dfa/report/ViolationNode.java
@@ -18,6 +18,7 @@ public class ViolationNode extends AbstractReportNode {
return ruleViolation;
}
+ @Override
public boolean equalsNode(AbstractReportNode arg0) {
if (!(arg0 instanceof ViolationNode)) {
return false;
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractDelegateRule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractDelegateRule.java
index 351ab41dfc..a173fe43c5 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractDelegateRule.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractDelegateRule.java
@@ -33,30 +33,37 @@ public abstract class AbstractDelegateRule implements Rule {
return rule;
}
+ @Override
public Language getLanguage() {
return rule.getLanguage();
}
+ @Override
public void setLanguage(Language language) {
rule.setLanguage(language);
}
+ @Override
public LanguageVersion getMinimumLanguageVersion() {
return rule.getMinimumLanguageVersion();
}
+ @Override
public void setMinimumLanguageVersion(LanguageVersion minimumlanguageVersion) {
rule.setMinimumLanguageVersion(minimumlanguageVersion);
}
+ @Override
public void setMaximumLanguageVersion(LanguageVersion maximumlanguageVersion) {
rule.setMaximumLanguageVersion(maximumlanguageVersion);
}
+ @Override
public LanguageVersion getMaximumLanguageVersion() {
return rule.getMaximumLanguageVersion();
}
+ @Override
public boolean isDeprecated() {
return rule.isDeprecated();
}
@@ -64,158 +71,197 @@ public abstract class AbstractDelegateRule implements Rule {
/**
* @see PropertySource#dysfunctionReason()
*/
+ @Override
public String dysfunctionReason() {
return rule.dysfunctionReason();
}
+ @Override
public Set> ignoredProperties() {
return rule.ignoredProperties();
}
+ @Override
public void setDeprecated(boolean deprecated) {
rule.setDeprecated(deprecated);
}
+ @Override
public String getName() {
return rule.getName();
}
+ @Override
public void setName(String name) {
rule.setName(name);
}
+ @Override
public String getSince() {
return rule.getSince();
}
+ @Override
public void setSince(String since) {
rule.setSince(since);
}
+ @Override
public String getRuleClass() {
return rule.getRuleClass();
}
+ @Override
public void setRuleClass(String ruleClass) {
rule.setRuleClass(ruleClass);
}
+ @Override
public String getRuleSetName() {
return rule.getRuleSetName();
}
+ @Override
public void setRuleSetName(String name) {
rule.setRuleSetName(name);
}
+ @Override
public String getMessage() {
return rule.getMessage();
}
+ @Override
public void setMessage(String message) {
rule.setMessage(message);
}
+ @Override
public String getDescription() {
return rule.getDescription();
}
+ @Override
public void setDescription(String description) {
rule.setDescription(description);
}
+ @Override
public List getExamples() {
return rule.getExamples();
}
+ @Override
public void addExample(String example) {
rule.addExample(example);
}
+ @Override
public String getExternalInfoUrl() {
return rule.getExternalInfoUrl();
}
+ @Override
public void setExternalInfoUrl(String url) {
rule.setExternalInfoUrl(url);
}
+ @Override
public RulePriority getPriority() {
return rule.getPriority();
}
+ @Override
public void setPriority(RulePriority priority) {
rule.setPriority(priority);
}
+ @Override
public ParserOptions getParserOptions() {
return rule.getParserOptions();
}
+ @Override
public void definePropertyDescriptor(PropertyDescriptor> propertyDescriptor) throws IllegalArgumentException {
rule.definePropertyDescriptor(propertyDescriptor);
}
+ @Override
public PropertyDescriptor> getPropertyDescriptor(String name) {
return rule.getPropertyDescriptor(name);
}
+ @Override
public List> getPropertyDescriptors() {
return rule.getPropertyDescriptors();
}
+ @Override
public T getProperty(PropertyDescriptor propertyDescriptor) {
return rule.getProperty(propertyDescriptor);
}
+ @Override
public void setProperty(PropertyDescriptor propertyDescriptor, T value) {
rule.setProperty(propertyDescriptor, value);
}
+ @Override
public Map, Object> getPropertiesByPropertyDescriptor() {
return rule.getPropertiesByPropertyDescriptor();
}
+ @Override
public void setUsesDFA() {
rule.setUsesDFA();
}
+ @Override
public boolean usesDFA() {
return rule.usesDFA();
}
+ @Override
public void setUsesTypeResolution() {
rule.setUsesTypeResolution();
}
+ @Override
public boolean usesTypeResolution() {
return rule.usesTypeResolution();
}
+ @Override
public boolean usesRuleChain() {
return rule.usesRuleChain();
}
+ @Override
public List getRuleChainVisits() {
return rule.getRuleChainVisits();
}
+ @Override
public void addRuleChainVisit(Class extends Node> nodeClass) {
rule.addRuleChainVisit(nodeClass);
}
+ @Override
public void addRuleChainVisit(String astNodeName) {
rule.addRuleChainVisit(astNodeName);
}
+ @Override
public void start(RuleContext ctx) {
rule.start(ctx);
}
+ @Override
public void apply(List extends Node> nodes, RuleContext ctx) {
rule.apply(nodes, ctx);
}
+ @Override
public void end(RuleContext ctx) {
rule.end(ctx);
}
@@ -223,6 +269,7 @@ public abstract class AbstractDelegateRule implements Rule {
/**
* @see Rule#hasDescriptor(PropertyDescriptor)
*/
+ @Override
public boolean hasDescriptor(PropertyDescriptor> descriptor) {
return rule.hasDescriptor(descriptor);
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRule.java
index 3cb8e42342..9f08f48f85 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRule.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRule.java
@@ -79,6 +79,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getLanguage()
*/
+ @Override
public Language getLanguage() {
return language;
}
@@ -86,6 +87,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setLanguage(net.sourceforge.pmd.lang.Language)
*/
+ @Override
public void setLanguage(Language language) {
if (this.language != null && this instanceof ImmutableLanguage && !this.language.equals(language)) {
throw new UnsupportedOperationException("The Language for Rule class " + this.getClass().getName()
@@ -97,6 +99,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getMinimumLanguageVersion()
*/
+ @Override
public LanguageVersion getMinimumLanguageVersion() {
return minimumLanguageVersion;
}
@@ -104,6 +107,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setMinimumLanguageVersion(net.sourceforge.pmd.lang.LanguageVersion)
*/
+ @Override
public void setMinimumLanguageVersion(LanguageVersion minimumLanguageVersion) {
this.minimumLanguageVersion = minimumLanguageVersion;
}
@@ -111,6 +115,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getMaximumLanguageVersion()
*/
+ @Override
public LanguageVersion getMaximumLanguageVersion() {
return maximumLanguageVersion;
}
@@ -118,6 +123,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setMaximumLanguageVersion(net.sourceforge.pmd.lang.LanguageVersion)
*/
+ @Override
public void setMaximumLanguageVersion(LanguageVersion maximumLanguageVersion) {
this.maximumLanguageVersion = maximumLanguageVersion;
}
@@ -125,6 +131,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#isDeprecated()
*/
+ @Override
public boolean isDeprecated() {
return deprecated;
}
@@ -132,6 +139,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setDeprecated(boolean)
*/
+ @Override
public void setDeprecated(boolean deprecated) {
this.deprecated = deprecated;
}
@@ -139,6 +147,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getName()
*/
+ @Override
public String getName() {
return name;
}
@@ -146,6 +155,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setName(String)
*/
+ @Override
public void setName(String name) {
this.name = name;
}
@@ -153,6 +163,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getSince()
*/
+ @Override
public String getSince() {
return since;
}
@@ -160,6 +171,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setSince(String)
*/
+ @Override
public void setSince(String since) {
this.since = since;
}
@@ -167,6 +179,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getRuleClass()
*/
+ @Override
public String getRuleClass() {
return ruleClass;
}
@@ -174,6 +187,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setRuleClass(String)
*/
+ @Override
public void setRuleClass(String ruleClass) {
this.ruleClass = ruleClass;
}
@@ -181,6 +195,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getRuleSetName()
*/
+ @Override
public String getRuleSetName() {
return ruleSetName;
}
@@ -188,6 +203,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setRuleSetName(String)
*/
+ @Override
public void setRuleSetName(String ruleSetName) {
this.ruleSetName = ruleSetName;
}
@@ -195,6 +211,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getMessage()
*/
+ @Override
public String getMessage() {
return message;
}
@@ -202,6 +219,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setMessage(String)
*/
+ @Override
public void setMessage(String message) {
this.message = message;
}
@@ -209,6 +227,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getDescription()
*/
+ @Override
public String getDescription() {
return description;
}
@@ -216,6 +235,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setDescription(String)
*/
+ @Override
public void setDescription(String description) {
this.description = description;
}
@@ -223,6 +243,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getExamples()
*/
+ @Override
public List getExamples() {
// TODO Needs to be externally immutable
return examples;
@@ -231,6 +252,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#addExample(String)
*/
+ @Override
public void addExample(String example) {
examples.add(example);
}
@@ -238,6 +260,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getExternalInfoUrl()
*/
+ @Override
public String getExternalInfoUrl() {
return externalInfoUrl;
}
@@ -245,6 +268,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setExternalInfoUrl(String)
*/
+ @Override
public void setExternalInfoUrl(String externalInfoUrl) {
this.externalInfoUrl = externalInfoUrl;
}
@@ -252,6 +276,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getPriority()
*/
+ @Override
public RulePriority getPriority() {
return priority;
}
@@ -259,6 +284,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setPriority(RulePriority)
*/
+ @Override
public void setPriority(RulePriority priority) {
this.priority = priority;
}
@@ -266,9 +292,10 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* This implementation returns a new instance of {@link ParserOptions} using
* default settings.
- *
+ *
* @see Rule#setPriority(RulePriority)
*/
+ @Override
public ParserOptions getParserOptions() {
return new ParserOptions();
}
@@ -276,6 +303,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setUsesDFA()
*/
+ @Override
public void setUsesDFA() {
usesDFA = true;
}
@@ -283,6 +311,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#usesDFA()
*/
+ @Override
public boolean usesDFA() {
return usesDFA;
}
@@ -290,6 +319,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#setUsesTypeResolution()
*/
+ @Override
public void setUsesTypeResolution() {
usesTypeResolution = true;
}
@@ -297,6 +327,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#usesTypeResolution()
*/
+ @Override
public boolean usesTypeResolution() {
return usesTypeResolution;
}
@@ -304,6 +335,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#usesRuleChain()
*/
+ @Override
public boolean usesRuleChain() {
return !getRuleChainVisits().isEmpty();
}
@@ -311,6 +343,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#getRuleChainVisits()
*/
+ @Override
public List getRuleChainVisits() {
return ruleChainVisits;
}
@@ -318,6 +351,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#addRuleChainVisit(Class)
*/
+ @Override
public void addRuleChainVisit(Class extends Node> nodeClass) {
if (!nodeClass.getSimpleName().startsWith("AST")) {
throw new IllegalArgumentException("Node class does not start with 'AST' prefix: " + nodeClass);
@@ -328,6 +362,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#addRuleChainVisit(String)
*/
+ @Override
public void addRuleChainVisit(String astNodeName) {
if (!ruleChainVisits.contains(astNodeName)) {
ruleChainVisits.add(astNodeName);
@@ -337,6 +372,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#start(RuleContext)
*/
+ @Override
public void start(RuleContext ctx) {
// Override as needed
}
@@ -344,6 +380,7 @@ public abstract class AbstractRule extends AbstractPropertySource implements Rul
/**
* @see Rule#end(RuleContext)
*/
+ @Override
public void end(RuleContext ctx) {
// Override as needed
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleChainVisitor.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleChainVisitor.java
index 65afadef04..f9122dacb4 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleChainVisitor.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleChainVisitor.java
@@ -40,6 +40,7 @@ public abstract class AbstractRuleChainVisitor implements RuleChainVisitor {
/**
* @see RuleChainVisitor#add(RuleSet, Rule)
*/
+ @Override
public void add(RuleSet ruleSet, Rule rule) {
if (!ruleSetRules.containsKey(ruleSet)) {
@@ -51,6 +52,7 @@ public abstract class AbstractRuleChainVisitor implements RuleChainVisitor {
/**
* @see RuleChainVisitor#visitAll(List, RuleContext)
*/
+ @Override
public void visitAll(List nodes, RuleContext ctx) {
initialize();
clear();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleViolationFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleViolationFactory.java
index f2c5eef885..048304bb8b 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleViolationFactory.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/AbstractRuleViolationFactory.java
@@ -28,6 +28,7 @@ public abstract class AbstractRuleViolationFactory implements RuleViolationFacto
}
}
+ @Override
public void addViolation(RuleContext ruleContext, Rule rule, Node node, String message, Object[] args) {
String formattedMessage = cleanup(message, args);
@@ -35,6 +36,7 @@ public abstract class AbstractRuleViolationFactory implements RuleViolationFacto
ruleContext.getReport().addRuleViolation(createRuleViolation(rule, ruleContext, node, formattedMessage));
}
+ @Override
public void addViolation(RuleContext ruleContext, Rule rule, Node node, String message, int beginLine, int endLine,
Object[] args) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java
index e3122ccc29..adee83c793 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ImportWrapper.java
@@ -45,6 +45,7 @@ public class ImportWrapper {
this.isStaticDemand = isStaticDemand;
}
+ @Override
public boolean equals(Object other) {
if (other == null) {
return false;
@@ -74,6 +75,7 @@ public class ImportWrapper {
return i.getName().equals(name);
}
+ @Override
public int hashCode() {
if (name == null) {
return fullname.hashCode();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/MockRule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/MockRule.java
index f64cfce39d..93c8239be9 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/MockRule.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/MockRule.java
@@ -39,6 +39,7 @@ public class MockRule extends AbstractRule {
setRuleSetName(ruleSetName);
}
+ @Override
public void apply(List extends Node> nodes, RuleContext ctx) {
}
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ParametricRuleViolation.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ParametricRuleViolation.java
index 1634603f93..7c34e20f60 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ParametricRuleViolation.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/ParametricRuleViolation.java
@@ -113,50 +113,62 @@ public class ParametricRuleViolation implements RuleViolation {
}
}
+ @Override
public Rule getRule() {
return rule;
}
+ @Override
public String getDescription() {
return expandVariables(description);
}
+ @Override
public boolean isSuppressed() {
return suppressed;
}
+ @Override
public String getFilename() {
return filename;
}
+ @Override
public int getBeginLine() {
return beginLine;
}
+ @Override
public int getBeginColumn() {
return beginColumn;
}
+ @Override
public int getEndLine() {
return endLine;
}
+ @Override
public int getEndColumn() {
return endColumn;
}
+ @Override
public String getPackageName() {
return packageName;
}
+ @Override
public String getClassName() {
return className;
}
+ @Override
public String getMethodName() {
return methodName;
}
+ @Override
public String getVariableName() {
return variableName;
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleChainVisitor.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleChainVisitor.java
index 0fb583a0bd..f2425dbbcc 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleChainVisitor.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleChainVisitor.java
@@ -18,7 +18,7 @@ import net.sourceforge.pmd.lang.ast.Node;
public interface RuleChainVisitor {
/**
* Add the given rule to the visitor.
- *
+ *
* @param ruleSet
* The RuleSet to which the rule belongs.
* @param rule
@@ -29,7 +29,7 @@ public interface RuleChainVisitor {
/**
* Visit all the given Nodes provided using the given RuleContext. Every
* Rule added will visit the AST as appropriate.
- *
+ *
* @param nodes
* The Nodes to visit.
* @param ctx
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleViolationFactory.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleViolationFactory.java
index 9ad7cf56dc..fb95d15ee0 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleViolationFactory.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/RuleViolationFactory.java
@@ -15,7 +15,7 @@ import net.sourceforge.pmd.lang.ast.Node;
public interface RuleViolationFactory {
/**
* Adds a violation to the report.
- *
+ *
* @param ruleContext
* the RuleContext
* @param rule
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java
index 1e7265f587..1f93807c80 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/XPathRule.java
@@ -4,6 +4,10 @@
package net.sourceforge.pmd.lang.rule;
+import static net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery.XPATH_1_0;
+import static net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery.XPATH_1_0_COMPATIBILITY;
+import static net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery.XPATH_2_0;
+
import java.util.List;
import net.sourceforge.pmd.PropertySource;
@@ -16,10 +20,6 @@ import net.sourceforge.pmd.lang.rule.xpath.SaxonXPathRuleQuery;
import net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery;
import net.sourceforge.pmd.util.StringUtil;
-import static net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery.XPATH_1_0;
-import static net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery.XPATH_1_0_COMPATIBILITY;
-import static net.sourceforge.pmd.lang.rule.xpath.XPathRuleQuery.XPATH_2_0;
-
/**
* Rule that tries to match an XPath expression against a DOM view of an AST.
*
@@ -55,6 +55,7 @@ public class XPathRule extends AbstractRule {
/**
* Apply the rule to all nodes.
*/
+ @Override
public void apply(List extends Node> nodes, RuleContext ctx) {
for (Node node : nodes) {
evaluate(node, ctx);
@@ -116,6 +117,7 @@ public class XPathRule extends AbstractRule {
/**
* @see PropertySource#dysfunctionReason()
*/
+ @Override
public String dysfunctionReason() {
return hasXPathExpression() ? null : "Missing xPath expression";
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractEnumeratedProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractEnumeratedProperty.java
index 6dddbc8c9c..2754396cf1 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractEnumeratedProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractEnumeratedProperty.java
@@ -42,7 +42,7 @@ public abstract class AbstractEnumeratedProperty extends AbstractProperty<
/**
* Method selectionsIn.
- *
+ *
* @param items
* String[]
* @param selectionIndices
@@ -66,6 +66,7 @@ public abstract class AbstractEnumeratedProperty extends AbstractProperty<
/**
* @return String
*/
+ @Override
protected String defaultAsString() {
return isMultiValue() ? (String) defaultValue() : asDelimitedString(defaultValue(), '|');
@@ -73,7 +74,7 @@ public abstract class AbstractEnumeratedProperty extends AbstractProperty<
/**
* Method nonLegalValueMsgFor.
- *
+ *
* @param value
* Object
* @return String
@@ -84,7 +85,7 @@ public abstract class AbstractEnumeratedProperty extends AbstractProperty<
/**
* Method choiceFrom.
- *
+ *
* @param label
* String
* @return E
@@ -100,6 +101,7 @@ public abstract class AbstractEnumeratedProperty extends AbstractProperty<
/**
* @see net.sourceforge.pmd.PropertyDescriptor#choices()
*/
+ @Override
public Object[][] choices() {
if (choices != null) {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiNumericProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiNumericProperty.java
index 2c530ea616..e0eaeb0736 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiNumericProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiNumericProperty.java
@@ -5,7 +5,7 @@
package net.sourceforge.pmd.lang.rule.properties;
/**
- *
+ *
* @author Brian Remedios
* @param
*/
@@ -13,7 +13,7 @@ public abstract class AbstractMultiNumericProperty extends AbstractNumericPro
/**
* Constructor for AbstractMultiNumericProperty.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -44,6 +44,7 @@ public abstract class AbstractMultiNumericProperty extends AbstractNumericPro
/**
* @return String
*/
+ @Override
protected String defaultAsString() {
return asDelimitedString(defaultValue());
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiPackagedProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiPackagedProperty.java
index b986172a32..63f1c1d6bc 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiPackagedProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractMultiPackagedProperty.java
@@ -5,7 +5,7 @@
package net.sourceforge.pmd.lang.rule.properties;
/**
- *
+ *
* @author Brian Remedios
* @param
*/
@@ -15,7 +15,7 @@ public abstract class AbstractMultiPackagedProperty extends AbstractPackagedP
/**
* Constructor for AbstractMultiPackagedProperty.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -44,6 +44,7 @@ public abstract class AbstractMultiPackagedProperty extends AbstractPackagedP
/**
* @return String
*/
+ @Override
protected String defaultAsString() {
return asDelimitedString(defaultValue());
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractNumericProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractNumericProperty.java
index 044114b420..7c2c22c2e2 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractNumericProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractNumericProperty.java
@@ -4,18 +4,18 @@
package net.sourceforge.pmd.lang.rule.properties;
+import static net.sourceforge.pmd.PropertyDescriptorFields.MAX;
+import static net.sourceforge.pmd.PropertyDescriptorFields.MIN;
+
import java.util.Map;
import net.sourceforge.pmd.NumericPropertyDescriptor;
import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescriptorFactory;
-import static net.sourceforge.pmd.PropertyDescriptorFields.MAX;
-import static net.sourceforge.pmd.PropertyDescriptorFields.MIN;
-
/**
* Maintains a pair of boundary limit values between which all values managed by
* the subclasses must fit.
- *
+ *
* @author Brian Remedios
* @param
*/
@@ -29,7 +29,7 @@ public abstract class AbstractNumericProperty extends AbstractScalarProperty<
.expectedFieldTypesWith(new String[] { MIN, MAX }, new Boolean[] { Boolean.TRUE, Boolean.TRUE });
/**
- *
+ *
* @param theName
* @param theDescription
* @param lower
@@ -52,10 +52,11 @@ public abstract class AbstractNumericProperty extends AbstractScalarProperty<
/**
* Returns the minimum value that instances of the property can have
- *
+ *
* @return The minimum value.
* @see net.sourceforge.pmd.NumericPropertyDescriptor#lowerLimit()
*/
+ @Override
public Number lowerLimit() {
return lowerLimit;
}
@@ -63,16 +64,18 @@ public abstract class AbstractNumericProperty extends AbstractScalarProperty<
/**
* @return String
*/
+ @Override
protected String defaultAsString() {
return defaultValue().toString();
}
/**
* Returns the maximum value that instances of the property can have
- *
+ *
* @return The maximum value.
* @see net.sourceforge.pmd.NumericPropertyDescriptor#upperLimit()
*/
+ @Override
public Number upperLimit() {
return upperLimit;
}
@@ -89,11 +92,12 @@ public abstract class AbstractNumericProperty extends AbstractScalarProperty<
/**
* Returns a string describing any error the value may have when
* characterized by the receiver.
- *
+ *
* @param value
* Object
* @return String
*/
+ @Override
protected String valueErrorFor(Object value) {
double number = ((Number) value).doubleValue();
@@ -107,10 +111,11 @@ public abstract class AbstractNumericProperty extends AbstractScalarProperty<
/**
* Method addAttributesTo.
- *
+ *
* @param attributes
* Map
*/
+ @Override
protected void addAttributesTo(Map attributes) {
super.addAttributesTo(attributes);
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractPackagedProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractPackagedProperty.java
index 7e603c06c4..77769b4642 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractPackagedProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractPackagedProperty.java
@@ -4,20 +4,20 @@
package net.sourceforge.pmd.lang.rule.properties;
+import static net.sourceforge.pmd.PropertyDescriptorFields.LEGAL_PACKAGES;
+
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescriptorFactory;
-import static net.sourceforge.pmd.PropertyDescriptorFields.LEGAL_PACKAGES;
-
/**
* Concrete subclasses manage items that reside within namespaces per the design
* of the Java language. Rule developers can limit the range of permissible
* items by specifying portions of their package names in the constructor. If
* the legalPackageNames value is set to null then no restrictions are made.
- *
+ *
* @author Brian Remedios
* @param
*/
@@ -31,7 +31,7 @@ public abstract class AbstractPackagedProperty extends AbstractProperty {
.expectedFieldTypesWith(new String[] { LEGAL_PACKAGES }, new Boolean[] { Boolean.FALSE });
/**
- *
+ *
* @param theName
* @param theDescription
* @param theDefault
@@ -67,7 +67,7 @@ public abstract class AbstractPackagedProperty extends AbstractProperty {
/**
* @return String
*/
- private final String delimitedPackageNames() {
+ private String delimitedPackageNames() {
if (legalPackageNames == null || legalPackageNames.length == 0) {
return "";
@@ -87,7 +87,7 @@ public abstract class AbstractPackagedProperty extends AbstractProperty {
/**
* Evaluates the names of the items against the allowable name prefixes. If
* one or more do not have valid prefixes then an exception will be thrown.
- *
+ *
* @param item
* @param legalNamePrefixes
* @throws IllegalArgumentException
@@ -130,7 +130,7 @@ public abstract class AbstractPackagedProperty extends AbstractProperty {
/**
* Method itemTypeName.
- *
+ *
* @return String
*/
protected abstract String itemTypeName();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractProperty.java
index c9fa1e90c8..5502a9b5e2 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractProperty.java
@@ -4,6 +4,10 @@
package net.sourceforge.pmd.lang.rule.properties;
+import static net.sourceforge.pmd.PropertyDescriptorFields.DEFAULT_VALUE;
+import static net.sourceforge.pmd.PropertyDescriptorFields.DESCRIPTION;
+import static net.sourceforge.pmd.PropertyDescriptorFields.NAME;
+
import java.util.HashMap;
import java.util.Map;
@@ -12,10 +16,6 @@ import net.sourceforge.pmd.PropertyDescriptorFields;
import net.sourceforge.pmd.Rule;
import net.sourceforge.pmd.util.StringUtil;
-import static net.sourceforge.pmd.PropertyDescriptorFields.DEFAULT_VALUE;
-import static net.sourceforge.pmd.PropertyDescriptorFields.DESCRIPTION;
-import static net.sourceforge.pmd.PropertyDescriptorFields.NAME;
-
/**
*
* @author Brian Remedios
@@ -47,7 +47,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* Constructor for AbstractPMDProperty.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -102,6 +102,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public char multiValueDelimiter() {
return multiValueDelimiter;
}
@@ -109,6 +110,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public String name() {
return name;
}
@@ -116,6 +118,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public String description() {
return description;
}
@@ -123,13 +126,14 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public T defaultValue() {
return defaultValue;
}
/**
* Method defaultHasNullValue.
- *
+ *
* @return boolean
*/
protected boolean defaultHasNullValue() {
@@ -153,6 +157,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public boolean isMultiValue() {
return false;
}
@@ -160,6 +165,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public boolean isRequired() {
return isRequired;
}
@@ -167,6 +173,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public float uiOrder() {
return uiOrder;
}
@@ -186,13 +193,14 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public String asDelimitedString(T values) {
return asDelimitedString(values, multiValueDelimiter());
}
/**
* Return the specified values as a single string using the delimiter.
- *
+ *
* @param values
* Object
* @param delimiter
@@ -229,6 +237,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public int compareTo(PropertyDescriptor> otherProperty) {
float otherOrder = otherProperty.uiOrder();
return (int) (otherOrder - uiOrder);
@@ -237,6 +246,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public String errorFor(Object value) {
String typeError = typeErrorFor(value);
@@ -328,6 +338,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public String propertyErrorFor(Rule rule) {
Object realValue = rule.getProperty(this);
if (realValue == null && !isRequired()) {
@@ -339,6 +350,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public Object[][] choices() {
return null;
}
@@ -346,6 +358,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* {@inheritDoc}
*/
+ @Override
public int preferredRowCount() {
return 1;
}
@@ -419,6 +432,7 @@ public abstract class AbstractProperty implements PropertyDescriptor {
/**
* @return Map
*/
+ @Override
public Map attributeValuesById() {
Map values = new HashMap<>();
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractScalarProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractScalarProperty.java
index 93a4447639..66fdc1c67e 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractScalarProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/AbstractScalarProperty.java
@@ -9,7 +9,7 @@ import net.sourceforge.pmd.util.StringUtil;
/**
* No, subclasses are not necessarily scalar per se, they're just easy to parse
* without error. If you can come up with a better name...
- *
+ *
* @author Brian Remedios
* @param
*/
@@ -17,7 +17,7 @@ public abstract class AbstractScalarProperty extends AbstractProperty {
/**
* Constructor for AbstractScalarProperty.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -58,6 +58,7 @@ public abstract class AbstractScalarProperty extends AbstractProperty {
* @throws IllegalArgumentException
* @see net.sourceforge.pmd.PropertyDescriptor#valueFrom(String)
*/
+ @Override
@SuppressWarnings("unchecked")
public T valueFrom(String valueString) throws IllegalArgumentException {
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanMultiProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanMultiProperty.java
index eb9efe3a4b..27a71b6f7f 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanMultiProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanMultiProperty.java
@@ -11,13 +11,14 @@ import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescripto
/**
* Defines a property type that supports multiple Boolean values.
- *
+ *
* @author Brian Remedios
*/
public class BooleanMultiProperty extends AbstractScalarProperty {
public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory(
String[].class) {
+ @Override
public BooleanMultiProperty createWith(Map valuesById) {
char delimiter = delimiterIn(valuesById);
return new BooleanMultiProperty(nameIn(valuesById), descriptionIn(valuesById),
@@ -27,7 +28,7 @@ public class BooleanMultiProperty extends AbstractScalarProperty {
/**
* Constructor for BooleanMultiProperty that allows for multiple values.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -45,6 +46,7 @@ public class BooleanMultiProperty extends AbstractScalarProperty {
* @return Class
* @see net.sourceforge.pmd.PropertyDescriptor#type()
*/
+ @Override
public Class type() {
return Boolean[].class;
}
@@ -60,11 +62,12 @@ public class BooleanMultiProperty extends AbstractScalarProperty {
/**
* Creates and returns a Boolean instance from a raw string
- *
+ *
* @param value
* String
* @return Object
*/
+ @Override
protected Object createFrom(String value) {
return Boolean.valueOf(value);
}
@@ -74,6 +77,7 @@ public class BooleanMultiProperty extends AbstractScalarProperty {
* int
* @return Object[]
*/
+ @Override
protected Boolean[] arrayFor(int size) {
return new Boolean[size];
}
@@ -81,6 +85,7 @@ public class BooleanMultiProperty extends AbstractScalarProperty {
/**
* @return String
*/
+ @Override
protected String defaultAsString() {
return asDelimitedString(defaultValue());
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanProperty.java
index ef5022e070..6a03a0fc93 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/BooleanProperty.java
@@ -11,7 +11,7 @@ import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescripto
/**
* Defines a property type that supports single Boolean values.
- *
+ *
* @author Brian Remedios
*/
public class BooleanProperty extends AbstractScalarProperty {
@@ -19,6 +19,7 @@ public class BooleanProperty extends AbstractScalarProperty {
public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory(
Boolean.class) {
+ @Override
public BooleanProperty createWith(Map valuesById) {
return new BooleanProperty(nameIn(valuesById), descriptionIn(valuesById),
Boolean.valueOf(defaultValueIn(valuesById)), 0f);
@@ -27,7 +28,7 @@ public class BooleanProperty extends AbstractScalarProperty {
/**
* Constructor for BooleanProperty limited to a single value.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -44,7 +45,7 @@ public class BooleanProperty extends AbstractScalarProperty {
/**
* Constructor for BooleanProperty limited to a single value. Converts
* default argument string into a boolean.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -62,6 +63,7 @@ public class BooleanProperty extends AbstractScalarProperty {
* @return Class
* @see net.sourceforge.pmd.PropertyDescriptor#type()
*/
+ @Override
public Class type() {
return Boolean.class;
}
@@ -69,17 +71,19 @@ public class BooleanProperty extends AbstractScalarProperty {
/**
* @return String
*/
+ @Override
protected String defaultAsString() {
return Boolean.toString(defaultValue());
}
/**
* Creates and returns a Boolean instance from a raw string
- *
+ *
* @param value
* String
* @return Object
*/
+ @Override
protected Object createFrom(String value) {
return Boolean.valueOf(value);
}
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterMultiProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterMultiProperty.java
index afc51b1890..cf89bffb85 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterMultiProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterMultiProperty.java
@@ -12,7 +12,7 @@ import net.sourceforge.pmd.util.StringUtil;
/**
* Defines a property type that supports multiple Character values.
- *
+ *
* @author Brian Remedios
*/
public class CharacterMultiProperty extends AbstractProperty {
@@ -20,6 +20,7 @@ public class CharacterMultiProperty extends AbstractProperty {
public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory(
Character[].class) {
+ @Override
public CharacterMultiProperty createWith(Map valuesById) {
char delimiter = delimiterIn(valuesById);
return new CharacterMultiProperty(nameIn(valuesById), descriptionIn(valuesById),
@@ -29,7 +30,7 @@ public class CharacterMultiProperty extends AbstractProperty {
/**
* Constructor for CharacterProperty.
- *
+ *
* @param theName
* String
* @param theDescription
@@ -59,6 +60,7 @@ public class CharacterMultiProperty extends AbstractProperty {
* @return Class
* @see net.sourceforge.pmd.PropertyDescriptor#type()
*/
+ @Override
public Class type() {
return Character[].class;
}
@@ -70,6 +72,7 @@ public class CharacterMultiProperty extends AbstractProperty {
* @throws IllegalArgumentException
* @see net.sourceforge.pmd.PropertyDescriptor#valueFrom(String)
*/
+ @Override
public Character[] valueFrom(String valueString) throws IllegalArgumentException {
String[] values = StringUtil.substringsOf(valueString, multiValueDelimiter());
diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterProperty.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterProperty.java
index db38be5cb8..2c86ae36e5 100644
--- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterProperty.java
+++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/rule/properties/CharacterProperty.java
@@ -11,7 +11,7 @@ import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescripto
/**
* Defines a property type that supports single Character values.
- *
+ *
* @author Brian Remedios
*/
public class CharacterProperty extends AbstractProperty {
@@ -19,6 +19,7 @@ public class CharacterProperty extends AbstractProperty {
public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory(
Character.class) {
+ @Override
public CharacterProperty createWith(Map valuesById) {
return new CharacterProperty(nameIn(valuesById), descriptionIn(valuesById),
defaultValueIn(valuesById) != null ? new Character(defaultValueIn(valuesById).charAt(0)) : null,
@@ -28,7 +29,7 @@ public class CharacterProperty extends AbstractProperty