Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
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
- Fixed Issues
- API Changes
- External Contributions
New and noteworthy
Kotlin support for CPD
- The new Java rule
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.
exceptionfileof the rule
has been deprecated and will be removed with 7.0.0. Please use
- #1284: [doc] Keep record of every currently deprecated API
- #1318: [test] Kotlin DSL to ease test writing
- #1328: [ci] Building docs for release fails
- #1341: [doc] Documentation Error with Regex Properties
- #1468: [doc] Missing escaping leads to XSS
- #1471: [core] XMLRenderer: ProcessingErrors from exceptions without a message missing
- #1477: [core] Analysis cache fails with wildcard classpath entries
- #1460: [java] Intermittent PMD failure : PMD processing errors while no violations reported
- #1512: [java] InvalidSlf4jMessageFormatRule causes NPE in lambda and static blocks
- #1454: [plsql] ParseException for IF/CASE statement with >=, <=, !=
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
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
is being replaced by the simpler
PropertyBuilder. Their APIs enjoy a high degree of source compatibility.
Concrete property classes like
all be deprecated until 7.0.0. Their usages should be replaced by direct usage of the
Instead of spreading properties across countless classes, the utility class
from 7.0.0 on the only provider for property descriptor builders. Each current property type will be replaced
by a corresponding method on
- Its multi-valued counterpart,
BooleanMultiProperty, is not replaced, because it doesn't have a use case.
- Its multi-valued counterpart,
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.
and the related builders (in
net.sourceforge.pmd.properties.builders) 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
which will allow virtually any constraint to be defined, and improve documentation and error reporting. The
PropertyTypeId#isPropertyPackagedare also deprecated.
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#isMultiValuewill be removed
Changes to the PropertyDescriptor interface
preferredRowCountis deprecated with no intended replacement. It was never implemented, and does not belong
in this interface. The methods
compareTo(PropertyDescriptor)are deprecated for the
same reason. These methods mix presentation logic with business logic and are not necessary for PropertyDescriptors to work.
PropertyDescriptorwill not extend
Comparable<PropertyDescriptor>anymore come 7.0.0.
- The method
propertyErrorForis deprecated and will be removed with no intended
replacement. It's really just a shortcut for
(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.
typeare 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,
typewill 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.
errorForis deprecated as its return type will be changed to
Optional<String>with the shift to Java 8.
The implementation of the adapters for the XPath engines Saxon and Jaxen (package
are now deprecated. They'll be moved to an internal package come 7.0.0. Only
Attributeremains public API.
PropertyDescriptorBuilderConversionWrapper, and the methods
These were used to read and write properties to and from XML, but were not intended as public API.
All classes from
net.sourceforge.pmd.lang.java.metrics.impl.visitorsare 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,
JavaParserVisitorAdaptershould be directly subclassed.
All classes from
net.sourceforge.pmd.properties.moduleswill be removed.
getVariableNameon 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
though, so you should iterate on each declared variable. See #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.
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:
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. Consequently, the following APIs are deprecated for
- #1384: [java] New Rule - UseUnderscoresInNumericLiterals - RajeshR
- #1424: [doc] #1341 Updating Regex Values in default Value Property - avishvat
- #1428: [core] Upgrading JCommander from 1.48 to 1.72 - Thunderforge
- #1430: [doc] Who really knows regex? - Dem Pilafian
- #1434: [java] JUnitTestsShouldIncludeAssert: Recognize AssertJ soft assertions as valid assert statements - Loïc Ledoyen
- #1439: [java] Avoid FileInputStream and FileOutputStream - reudismam
- #1441: [kotlin] [cpd] Added CPD support for Kotlin - Maikel Steneker
- #1447: [fortran] Use diamond operator in impl - reudismam
- #1453: [java] Adding the fix for #1440. Showing correct message for CommentDefaultAccessmodifier. - Rohit Kumar
- #1457: [java] Adding test for Issue #647 - orimarko
- #1464: [doc] Fix XSS on documentation web page - Maxime Robert
- #1469: [core] Configurable max loops in DAAPathFinder - Alberto Fernández
- #1494: [java] 1151: Rephrase ImmutableField documentation in design.xml - Robbie Martinus
- #1504: [java] NPE in InvalidSlf4jMessageFormatRule if a logger call with a variable as parameter is not inside a method or constructor - kris-scheibe