09-December-2018 - 6.10.0
The PMD team is pleased to announce PMD 6.10.0.
This is a minor release.
Table Of Contents
* New and noteworthy
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#new-and-noteworthy>
o Kotlin support for CPD
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#kotlin-support-for-cpd>
o New Rules <https://pmd.github.io/2018/12/09/PMD-6.10.0/#new-rules>
o Modified Rules
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#modified-rules>
* Fixed Issues <https://pmd.github.io/2018/12/09/PMD-6.10.0/#fixed-issues>
* API Changes <https://pmd.github.io/2018/12/09/PMD-6.10.0/#api-changes>
o Properties framework
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#properties-framework>
+ Changes to how you define properties
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#changes-to-how-you-define-properties>
+ Architectural simplifications
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#architectural-simplifications>
+ Changes to the PropertyDescriptor interface
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#changes-to-the-propertydescriptor-interface>
o Deprecated APIs
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#deprecated-apis>
+ For internalization
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#for-internalization>
+ For removal
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#for-removal>
* External Contributions
<https://pmd.github.io/2018/12/09/PMD-6.10.0/#external-contributions>
New and noteworthy
Kotlin support for CPD
Thanks to Maikel Steneker <https://github.com/maikelsteneker>, CPD now
supports Kotlin <https://kotlinlang.org/>. This means, you can use CPD
to find duplicated code in your Kotlin projects.
New Rules
* The new Java rule |UseUnderscoresInNumericLiterals|
<https://pmd.github.io/pmd-6.10.0/pmd_rules_java_codestyle.html#useunderscoresinnumericliterals>
(|java-codestyle|) verifies that numeric literals over a given
length (4 chars by default, but configurable) are using underscores
every 3 digits for readability. The rule only applies to Java 7+
codebases.
Modified Rules
*
The Java rule |JUnitTestsShouldIncludeAssert|
<https://pmd.github.io/pmd-6.10.0/pmd_rules_java_bestpractices.html#junittestsshouldincludeassert>
(|java-bestpractices|) now also detects Soft Assertions
<https://github.com/joel-costigliola/assertj-core>.
*
The property |exceptionfile| of the rule |AvoidDuplicateLiterals|
<https://pmd.github.io/pmd-6.10.0/pmd_rules_java_errorprone.html#avoidduplicateliterals>
(|java-errorprone|) has been deprecated and will be removed with
7.0.0. Please use |exceptionList| instead.
Fixed Issues
* all
o #1284 <https://github.com/pmd/pmd/issues/1284>: [doc] Keep
record of every currently deprecated API
o #1318 <https://github.com/pmd/pmd/issues/1318>: [test] Kotlin
DSL to ease test writing
o #1328 <https://github.com/pmd/pmd/issues/1328>: [ci] Building
docs for release fails
o #1341 <https://github.com/pmd/pmd/issues/1341>: [doc]
Documentation Error with Regex Properties
o #1468 <https://github.com/pmd/pmd/issues/1468>: [doc] Missing
escaping leads to XSS
o #1471 <https://github.com/pmd/pmd/issues/1471>: [core]
XMLRenderer: ProcessingErrors from exceptions without a message
missing
o #1477 <https://github.com/pmd/pmd/issues/1477>: [core] Analysis
cache fails with wildcard classpath entries
* java
o #1460 <https://github.com/pmd/pmd/issues/1460>: [java]
Intermittent PMD failure : PMD processing errors while no
violations reported
* java-bestpractices
o #647 <https://github.com/pmd/pmd/issues/647>: [java]
JUnitTestsShouldIncludeAssertRule should support
|this.exception| as well as just |exception|
o #1435 <https://github.com/pmd/pmd/issues/1435>: [java]
JUnitTestsShouldIncludeAssert: Support AssertJ soft assertions
* java-codestyle
o #1232 <https://github.com/pmd/pmd/issues/1232>: [java] Detector
for large numbers not separated by _
o #1372 <https://github.com/pmd/pmd/issues/1372>: [java] false
positive for UselessQualifiedThis
o #1440 <https://github.com/pmd/pmd/issues/1440>: [java]
CommentDefaultAccessModifierRule shows incorrect message
* java-design
o #1151 <https://github.com/pmd/pmd/issues/1151>: [java]
ImmutableField false positive with multiple constructors
o #1483 <https://github.com/pmd/pmd/issues/1483>: [java] Cyclo
metric should count conditions of for statements correctly
* java-errorprone
o #1512 <https://github.com/pmd/pmd/issues/1512>: [java]
InvalidSlf4jMessageFormatRule causes NPE in lambda and static blocks
* plsql
o #1454 <https://github.com/pmd/pmd/issues/1454>: [plsql]
ParseException for IF/CASE statement with >=, <=, !=
API Changes
Properties framework
The properties framework is about to get a lifting, and for that reason,
we need to deprecate a lot of APIs to remove them in 7.0.0. The proposed
changes to the API are described on the wiki
<https://github.com/pmd/pmd/wiki/Property-framework-7-0-0>
Changes to how you define properties
*
Construction of property descriptors has been possible through
builders since 6.0.0. The 7.0.0 API will only allow construction
through builders. The builder hierarchy, currently found in the
package |net.sourceforge.pmd.properties.builders|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/builders/package-summary.html#>,
is being replaced by the simpler |PropertyBuilder|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyBuilder.html#>.
Their APIs enjoy a high degree of source compatibility.
*
Concrete property classes like |IntegerProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/IntegerProperty.html#>
and |StringMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/StringMultiProperty.html#>
will gradually all be deprecated until 7.0.0. Their usages should be
replaced by direct usage of the |PropertyDescriptor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#>
interface, e.g. |PropertyDescriptor<Integer>| or
|PropertyDescriptor<List<String>>|.
*
Instead of spreading properties across countless classes, the
utility class |PropertyFactory|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#>
will become from 7.0.0 on the only provider for property descriptor
builders. Each current property type will be replaced by a
corresponding method on |PropertyFactory|:
o |IntegerProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/IntegerProperty.html#>
is replaced by |PropertyFactory#intProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#intProperty%28java.lang.String%29>
+ |IntegerMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/IntegerMultiProperty.html#>
is replaced by |PropertyFactory#intListProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#intListProperty%28java.lang.String%29>
o |FloatProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/FloatProperty.html#>
and |DoubleProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/DoubleProperty.html#>
are both replaced by |PropertyFactory#doubleProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#doubleProperty%28java.lang.String%29>.
Having a separate property for floats wasn’t that useful.
+ Similarly, |FloatMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/FloatMultiProperty.html#>
and |DoubleMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/DoubleMultiProperty.html#>
are replaced by |PropertyFactory#doubleListProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#doubleListProperty%28java.lang.String%29>.
o |StringProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/StringProperty.html#>
is replaced by |PropertyFactory#stringProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#stringProperty%28java.lang.String%29>
+ |StringMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/StringMultiProperty.html#>
is replaced by |PropertyFactory#stringListProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#stringListProperty%28java.lang.String%29>
o
|RegexProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/RegexProperty.html#>
is replaced by |PropertyFactory#regexProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#regexProperty%28java.lang.String%29>
o |EnumeratedProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/EnumeratedProperty.html#>
is replaced by |PropertyFactory#enumProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#enumProperty%28java.lang.String,java.util.Map%29>
+ |EnumeratedProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/EnumeratedProperty.html#>
is replaced by |PropertyFactory#enumListProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#enumListProperty%28java.lang.String,java.util.Map%29>
o |BooleanProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/BooleanProperty.html#>
is replaced by |PropertyFactory#booleanProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#booleanProperty%28java.lang.String%29>
+ Its multi-valued counterpart, |BooleanMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/BooleanMultiProperty.html#>,
is not replaced, because it doesn’t have a use case.
o |CharacterProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/CharacterProperty.html#>
is replaced by |PropertyFactory#charProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#charProperty%28java.lang.String%29>
+ |CharacterMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/CharacterMultiProperty.html#>
is replaced by |PropertyFactory#charListProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#charListProperty%28java.lang.String%29>
o |LongProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/LongProperty.html#>
is replaced by |PropertyFactory#longIntProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#longIntProperty%28java.lang.String%29>
+ |LongMultiProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/LongMultiProperty.html#>
is replaced by |PropertyFactory#longIntListProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyFactory.html#longIntListProperty%28java.lang.String%29>
o |MethodProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/MethodProperty.html#>,
|FileProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/FileProperty.html#>,
|TypeProperty|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/TypeProperty.html#>
and their multi-valued counterparts are discontinued for lack of
a use-case, and have no planned replacement in 7.0.0 for now.
Here’s an example:
|// Before 7.0.0, these are equivalent: IntegerProperty myProperty = new
IntegerProperty("score", "Top score value", 1, 100, 40, 3.0f);
IntegerProperty myProperty = IntegerProperty.named("score").desc("Top
score value").range(1, 100).defaultValue(40).uiOrder(3.0f); // They both
map to the following in 7.0.0 PropertyDescriptor<Integer> myProperty =
PropertyFactory.intProperty("score").desc("Top score
value").require(inRange(1, 100)).defaultValue(40); |
You’re highly encouraged to migrate to using this new API as soon as
possible, to ease your migration to 7.0.0.
Architectural simplifications
*
|EnumeratedPropertyDescriptor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/EnumeratedPropertyDescriptor.html#>,
|NumericPropertyDescriptor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/NumericPropertyDescriptor.html#>,
|PackagedPropertyDescriptor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PackagedPropertyDescriptor.html#>,
and the related builders (in
|net.sourceforge.pmd.properties.builders|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/builders/package-summary.html#>)
will be removed. These specialized interfaces allowed additional
constraints to be enforced on the value of a property, but made the
property class hierarchy very large and impractical to maintain.
Their functionality will be mapped uniformly to |PropertyConstraint|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/constraints/PropertyConstraint.html#>s,
which will allow virtually any constraint to be defined, and improve
documentation and error reporting. The related methods
|PropertyTypeId#isPropertyNumeric|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyTypeId.html#isPropertyNumeric%28%29>
and |PropertyTypeId#isPropertyPackaged|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyTypeId.html#isPropertyPackaged%28%29>
are also deprecated.
*
|MultiValuePropertyDescriptor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/MultiValuePropertyDescriptor.html#>
and |SingleValuePropertyDescriptor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/SingleValuePropertyDescriptor.html#>
are deprecated. 7.0.0 will introduce a new XML syntax which will
remove the need for such a divide between single- and multi-valued
properties. The method |PropertyDescriptor#isMultiValue|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#isMultiValue%28%29>
will be removed accordingly.
Changes to the PropertyDescriptor interface
* |preferredRowCount|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#preferredRowCount%28%29>
is deprecated with no intended replacement. It was never
implemented, and does not belong in this interface. The methods
|uiOrder|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#uiOrder%28%29>
and |compareTo(PropertyDescriptor)| are deprecated for the same
reason. These methods mix presentation logic with business logic and
are not necessary for PropertyDescriptors to work.
|PropertyDescriptor| will not extend
|Comparable<PropertyDescriptor>| anymore come 7.0.0.
* The method |propertyErrorFor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#propertyErrorFor%28net.sourceforge.pmd.Rule%29>
is deprecated and will be removed with no intended replacement. It’s
really just a shortcut for |prop.errorFor(rule.getProperty(prop))|.
* |T ||valueFrom(String)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#valueFrom%28java.lang.String%29>
and |String ||asDelimitedString|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#asDelimitedString%28java.lang.Object%29>|(T)|
are deprecated and will be removed. These were used to serialize and
deserialize properties to/from a string, but 7.0.0 will introduce a
more flexible XML syntax which will make them obsolete.
* |isMultiValue|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#isMultiValue%28%29>
and |type|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#type%28%29>
are deprecated and won’t be replaced. The new XML syntax will remove
the need for a divide between multi- and single-value properties,
and will allow arbitrary types to be represented. Since arbitrary
types may be represented, |type| will become obsolete as it can’t
represent generic types, which will nevertheless be representable
with the XML syntax. It was only used for documentation, but a new
way to document these properties exhaustively will be added with 7.0.0.
* |errorFor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#errorFor%28java.lang.Object%29>
is deprecated as its return type will be changed to
|Optional<String>| with the shift to Java 8.
Deprecated APIs
For internalization
*
The implementation of the adapters for the XPath engines Saxon and
Jaxen (package |net.sourceforge.pmd.lang.ast.xpath|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/ast/xpath/package-summary.html#>)
are now deprecated. They’ll be moved to an internal package come
7.0.0. Only |Attribute|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/ast/xpath/Attribute.html#>
remains public API.
*
The classes |PropertyDescriptorField|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptorField.html#>,
|PropertyDescriptorBuilderConversionWrapper|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/builders/PropertyDescriptorBuilderConversionWrapper.html#>,
and the methods |PropertyDescriptor#attributeValuesById|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#attributeValuesById>,
|PropertyDescriptor#isDefinedExternally|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyDescriptor.html#isDefinedExternally%28%29>
and |PropertyTypeId#getFactory|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/PropertyTypeId.html#getFactory%28%29>.
These were used to read and write properties to and from XML, but
were not intended as public API.
*
The class |ValueParserConstants|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/ValueParserConstants.html#>
and the interface |ValueParser|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/ValueParser.html#>.
*
All classes from
|net.sourceforge.pmd.lang.java.metrics.impl.visitors|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/metrics/impl/visitors/package-summary.html#>
are now considered internal API. They’re deprecated and will be
moved into an internal package with 7.0.0. To implement your own
metrics visitors, |JavaParserVisitorAdapter|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorAdapter.html#>
should be directly subclassed.
*
|LanguageVersionHandler#getDataFlowHandler()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getDataFlowHandler%28%29>,
|LanguageVersionHandler#getDFAGraphRule()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getDFAGraphRule%28%29>
*
|VisitorStarter|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/VisitorStarter.html#>
For removal
*
All classes from |net.sourceforge.pmd.properties.modules|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/properties/modules/package-summary.html#>
will be removed.
*
The interface |Dimensionable|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/Dimensionable.html#>
has been deprecated. It gets in the way of a grammar change for
7.0.0 and won’t be needed anymore (see #997
<https://github.com/pmd/pmd/issues/997>).
*
Several methods from |ASTLocalVariableDeclaration|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/ASTLocalVariableDeclaration.html#>
and |ASTFieldDeclaration|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/ASTFieldDeclaration.html#>
have also been deprecated:
o
|ASTFieldDeclaration|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/ASTFieldDeclaration.html#>
won’t be a |TypeNode|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/TypeNode.html#>
come 7.0.0, so |getType|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/ASTFieldDeclaration.html#getType%28%29>
and |getTypeDefinition|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/ASTFieldDeclaration.html#getTypeDefinition%28%29>
are deprecated.
o
The method |getVariableName| on those two nodes will be removed,
too.
All these are deprecated because those nodes may declare several
variables at once, possibly with different types (and obviously with
different names). They both implement
|Iterator<||ASTVariableDeclaratorId|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/ASTVariableDeclaratorId.html#>|>|
though, so you should iterate on each declared variable. See #910
<https://github.com/pmd/pmd/issues/910>.
*
Visitor decorators are now deprecated and will be removed in PMD
7.0.0. They were originally a way to write composable visitors, used
in the metrics framework, but they didn’t prove cost-effective.
o In |net.sourceforge.pmd.lang.java.ast|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/package-summary.html#>:
|JavaParserDecoratedVisitor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/JavaParserDecoratedVisitor.html#>,
|JavaParserControllessVisitor|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/JavaParserControllessVisitor.html#>,
|JavaParserControllessVisitorAdapter|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/JavaParserControllessVisitorAdapter.html#>,
and |JavaParserVisitorDecorator|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-java/6.10.0/net/sourceforge/pmd/lang/java/ast/JavaParserVisitorDecorator.html#>
are deprecated with no intended replacement.
*
The LanguageModules of several languages, that only support CPD
execution, have been deprecated. These languages are not fully
supported by PMD, so having a language module does not make sense.
The functionality of CPD is not affected by this change. The
following classes have been deprecated and will be removed with PMD
7.0.0:
o |CppHandler|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-cpp/6.10.0/net/sourceforge/pmd/lang/cpp/CppHandler.html#>
o |CppLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-cpp/6.10.0/net/sourceforge/pmd/lang/cpp/CppLanguageModule.html#>
o |CppParser|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-cpp/6.10.0/net/sourceforge/pmd/lang/cpp/CppParser.html#>
o |CsLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-cs/6.10.0/net/sourceforge/pmd/lang/cs/CsLanguageModule.html#>
o |FortranLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-fortran/6.10.0/net/sourceforge/pmd/lang/fortran/FortranLanguageModule.html#>
o |GroovyLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-groovy/6.10.0/net/sourceforge/pmd/lang/groovy/GroovyLanguageModule.html#>
o |MatlabHandler|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-matlab/6.10.0/net/sourceforge/pmd/lang/matlab/MatlabHandler.html#>
o |MatlabLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-matlab/6.10.0/net/sourceforge/pmd/lang/matlab/MatlabLanguageModule.html#>
o |MatlabParser|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-matlab/6.10.0/net/sourceforge/pmd/lang/matlab/MatlabParser.html#>
o |ObjectiveCHandler|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-objectivec/6.10.0/net/sourceforge/pmd/lang/objectivec/ObjectiveCHandler.html#>
o |ObjectiveCLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-objectivec/6.10.0/net/sourceforge/pmd/lang/objectivec/ObjectiveCLanguageModule.html#>
o |ObjectiveCParser|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-objectivec/6.10.0/net/sourceforge/pmd/lang/objectivec/ObjectiveCParser.html#>
o |PhpLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-php/6.10.0/net/sourceforge/pmd/lang/php/PhpLanguageModule.html#>
o |PythonHandler|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-python/6.10.0/net/sourceforge/pmd/lang/python/PythonHandler.html#>
o |PythonLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-python/6.10.0/net/sourceforge/pmd/lang/python/PythonLanguageModule.html#>
o |PythonParser|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-python/6.10.0/net/sourceforge/pmd/lang/python/PythonParser.html#>
o |RubyLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-ruby/6.10.0/net/sourceforge/pmd/lang/ruby/RubyLanguageModule.html#>
o |ScalaLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-scala/6.10.0/net/sourceforge/pmd/lang/scala/ScalaLanguageModule.html#>
o |SwiftLanguageModule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-swift/6.10.0/net/sourceforge/pmd/lang/swift/SwiftLanguageModule.html#>
*
Optional AST processing stages like symbol table, type resolution or
data-flow analysis will be reified in 7.0.0 to factorise common
logic and make them extensible. Further explanations about this
change can be found on #1426 <https://github.com/pmd/pmd/pull/1426>.
Consequently, the following APIs are deprecated for removal:
o In |Rule|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/Rule.html#>:
|isDfa()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/Rule.html#isDfa%28%29>,
|isTypeResolution()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/Rule.html#isTypeResolution%28%29>,
|isMultifile()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/Rule.html#isMultifile%28%29>
and their respective setters.
o In |RuleSet|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSet.html#>:
|usesDFA(Language)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSet.html#usesDFA%28net.sourceforge.pmd.lang.Language%29>,
|usesTypeResolution(Language)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSet.html#usesTypeResolution%28net.sourceforge.pmd.lang.Language%29>,
|usesMultifile(Language)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSet.html#usesMultifile%28net.sourceforge.pmd.lang.Language%29>
o In |RuleSets|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSets.html#>:
|usesDFA(Language)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSets.html#usesDFA%28net.sourceforge.pmd.lang.Language%29>,
|usesTypeResolution(Language)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSets.html#usesTypeResolution%28net.sourceforge.pmd.lang.Language%29>,
|usesMultifile(Language)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/RuleSets.html#usesMultifile%28net.sourceforge.pmd.lang.Language%29>
o In |LanguageVersionHandler|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#>:
|getDataFlowFacade()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getDataFlowFacade%28%29>,
|getSymbolFacade()|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getSymbolFacade%28%29>,
|getSymbolFacade(ClassLoader)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getSymbolFacade%28java.lang.ClassLoader%29>,
|getTypeResolutionFacade(ClassLoader)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getTypeResolutionFacade%28java.lang.ClassLoader%29>,
|getQualifiedNameResolutionFacade(ClassLoader)|
<https://javadoc.io/page/net.sourceforge.pmd/pmd-core/6.10.0/net/sourceforge/pmd/lang/LanguageVersionHandler.html#getQualifiedNameResolutionFacade%28java.lang.ClassLoader%29>
External Contributions
* #1384 <https://github.com/pmd/pmd/pull/1384>: [java] New Rule -
UseUnderscoresInNumericLiterals - RajeshR
<https://github.com/rajeshggwp>
* #1424 <https://github.com/pmd/pmd/pull/1424>: [doc] #1341 Updating
Regex Values in default Value Property - avishvat
<https://github.com/vishva007>
* #1428 <https://github.com/pmd/pmd/pull/1428>: [core] Upgrading
JCommander from 1.48 to 1.72 - Thunderforge
<https://github.com/Thunderforge>
* #1430 <https://github.com/pmd/pmd/pull/1430>: [doc] Who really knows
regex? - Dem Pilafian <https://github.com/dpilafian>
* #1434 <https://github.com/pmd/pmd/pull/1434>: [java]
JUnitTestsShouldIncludeAssert: Recognize AssertJ soft assertions as
valid assert statements - Loïc Ledoyen <https://github.com/ledoyen>
* #1439 <https://github.com/pmd/pmd/pull/1439>: [java] Avoid
FileInputStream and FileOutputStream - reudismam
<https://github.com/reudismam>
* #1441 <https://github.com/pmd/pmd/pull/1441>: [kotlin] [cpd] Added
CPD support for Kotlin - Maikel Steneker
<https://github.com/maikelsteneker>
* #1447 <https://github.com/pmd/pmd/pull/1447>: [fortran] Use diamond
operator in impl - reudismam <https://github.com/reudismam>
* #1453 <https://github.com/pmd/pmd/pull/1453>: [java] Adding the fix
for #1440. Showing correct message for CommentDefaultAccessmodifier.
- Rohit Kumar <https://github.com/stationeros>
* #1457 <https://github.com/pmd/pmd/pull/1457>: [java] Adding test for
Issue #647 - orimarko <https://github.com/orimarko>
* #1464 <https://github.com/pmd/pmd/pull/1464>: [doc] Fix XSS on
documentation web page - Maxime Robert <https://github.com/marob>
* #1469 <https://github.com/pmd/pmd/pull/1469>: [core] Configurable
max loops in DAAPathFinder - Alberto Fernández
<https://github.com/albfernandez>
* #1494 <https://github.com/pmd/pmd/pull/1494>: [java] 1151: Rephrase
ImmutableField documentation in design.xml - Robbie Martinus
<https://github.com/rmartinus>
* #1504 <https://github.com/pmd/pmd/pull/1504>: [java] NPE in
InvalidSlf4jMessageFormatRule if a logger call with a variable as
parameter is not inside a method or constructor - kris-scheibe
<https://github.com/kris-scheibe>
|