26-April-2024 - 7.1.0
The PMD team is pleased to announce PMD 7.1.0.
This is a minor release.
Table Of Contents
- 🚀 New and noteworthy
- More robust CPD reports
- ✨ New Rules
- 🌟 Rule Changes
- 🐛 Fixed Issues
- 🚨 API Changes
- Deprecated methods
- ✨ External Contributions
- 📈 Stats
🚀 New and noteworthy
More robust CPD reports
There were a number of circumstances, specially around (but not limited to) literal sequences, were CPD would
report duplicate overlapping or partially overlapping matches. These have now been fixed, and CPD will report
only the longest non-overlapping duplicate.
These improvements apply to all supported languages, irrespective of supported flags.
✨ New Rules
- The new Java rule
UnnecessaryVarargsArrayCreation
reports explicit array creation
when a varargs is expected. This is more heavy to read and could be simplified. - The new Java rule
ConfusingArgumentToVarargsMethod
reports some confusing situations
where a varargs method is called with an inexact argument type. These may end up in a mismatch between the expected
parameter type and the actual value. - The new Java rule
LambdaCanBeMethodReference
reports lambda expressions that can be replaced
with a method reference. Please read the documentation of the rule for more info. This rule is now part of the Quickstart
ruleset.
🌟 Rule Changes
JUnitTestsShouldIncludeAssert
andJUnitTestContainsTooManyAsserts
have a new property namedextraAssertMethodNames
. With this property, you can configure which additional static
methods should be considered as valid verification methods. This allows to use custom mocking or assertion libraries.
🐛 Fixed Issues
- core
- cli
- doc
- #4901: [doc] Improve documentation on usage of violationSuppressXPath
- apex
- #4418: [apex] ASTAnnotation.getImage() does not return value as written in the class
- apex-errorprone
- #3953: [apex] EmptyCatchBlock false positive with formal (doc) comments
- cpp
- #2438: [cpp] Repeated Duplication blocks
- java
- java-bestpractices
- #1084: [java] Allow JUnitTestsShouldIncludeAssert to configure verification methods
- #3216: [java] New rule: UnnecessaryVarargsArrayCreation
- #4435: [java] [7.0-rc1] UnusedAssignment for used field
- #4569: [java] ForLoopCanBeForeach reports on loop
for (int i = 0; i < list.size(); i += 2)
- #4618: [java] UnusedAssignment false positive with conditional assignments of fields
- java-codestyle
- #4602: [java] UnnecessaryImport: false positives with static imports
- #4785: [java] False Positive: PMD Incorrectly report violation for UnnecessaryImport
- #4779: [java] Examples in documentation of MethodArgumentCanBeFinal do not trigger the rule
- #4881: [java] ClassNamingConventions: interfaces are identified as abstract classes (regression in 7.0.0)
- java-design
- java-errorprone
- #2056: [java] CloseResource false-positive with URLClassLoader in cast expression
- #4751: [java] PMD crashes when analyzing CloseResource Rule
- #4928: [java] EmptyCatchBlock false negative when allowCommentedBlocks=true
- #4948: [java] ImplicitSwitchFallThrough: False-positive with nested switch statements
- java-performance
- pom-errorprone
- #4388: [pom] InvalidDependencyTypes doesn't consider dependencies at all
- misc
- #4967: Fix reproducible build issues with 7.0.0
🚨 API Changes
Deprecated methods
- pmd-java
ASTLambdaExpression#getBlock
andASTLambdaExpression#getExpression
SingularFieldRule#mayBeSingular
has been deprecated for
removal. The method is only useful for the rule itself and shouldn't be used otherwise.
✨ External Contributions
- #4864: Fix #1084 [Java] add extra assert method names to Junit rules - Erwan Moutymbo (@emouty)
- #4894: Fix #4791 Error caused by space in JDK path - Scrates1 (@Scrates1)
📈 Stats
- 205 commits
- 71 closed tickets & PRs
- Days since last release: 34