--- title: Old Release Notes permalink: pmd_release_notes_old.html --- Previous versions of PMD can be downloaded here: https://github.com/pmd/pmd/releases ## 25-March-2023 - 7.0.0-rc1 We're excited to bring you the next major version of PMD! Since this is a big release, we provide here only a concise version of the release notes. We prepared a separate page with the full [Detailed Release Notes for PMD 7.0.0](https://pmd.github.io/pmd-7.0.0-rc1/pmd_release_notes_pmd7.html).
PMD 7.0.0 is finally almost ready. In order to gather feedback, we are going to ship a couple of release candidates. These are officially available on GitHub and Maven Central and can be used as usual (e.g. as a dependency). We encourage you to try out the new features, but keep in mind that we may introduce API breaking changes between the release candidates. It should be stable enough if you don't use custom rules.
We have still some tasks planned for the next release candidates. You can see the progress in PMD 7 Tracking Issue #3898.
If you find any problem or difficulty while updating from PMD 6, please provide feedback via our issue tracker. That way we can improve the experience for all.
GoLanguageModule
#### Java
* Support for Java 18 preview language features have been removed. The version "18-preview" is no longer available.
* The experimental class `net.sourceforge.pmd.lang.java.ast.ASTGuardedPattern` has been removed.
### External Contributions
* [#4384](https://github.com/pmd/pmd/pull/4384): \[swift] Add more swift 5.x support (#unavailable mainly) - [Richard B.](https://github.com/kenji21) (@kenji21)
* [#4390](https://github.com/pmd/pmd/pull/4390): Add support for T-SQL using Antlr4 lexer - [Paul Guyot](https://github.com/pguyot) (@pguyot)
* [#4392](https://github.com/pmd/pmd/pull/4392): \[java] Fix #4393 MissingStaticMethodInNonInstantiatableClass: Fix false-positive for field-only class - [Dawid Ciok](https://github.com/dawiddc) (@dawiddc)
### Stats
* 40 commits
* 11 closed tickets & PRs
* Days since last release: 28
## 28-January-2023 - 6.54.0
The PMD team is pleased to announce PMD 6.54.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [New report format html-report-v2.xslt](#new-report-format-html-report-v2.xslt)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [PMD CLI](#pmd-cli)
* [Deprecated APIs](#deprecated-apis)
* [For removal](#for-removal)
* [Internal APIs](#internal-apis)
* [Experimental APIs](#experimental-apis)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### New report format html-report-v2.xslt
Thanks to @mohan-chinnappan-n a new PMD report format has been added which features a data table
with charting functions. It uses an XSLT stylesheet to convert PMD's XML format into HTML.
See [the example report](report-examples/html-report-v2.html).
### Fixed Issues
* apex-bestpractices
* [#2669](https://github.com/pmd/pmd/issues/2669): \[apex] UnusedLocalVariable false positive in dynamic SOQL
* core
* [#4026](https://github.com/pmd/pmd/issues/4026): \[cli] Filenames printed as absolute paths in the report despite parameter `--short-names`
* [#4279](https://github.com/pmd/pmd/issues/4279): \[core] Can not set ruleset property value to empty
* [#4329](https://github.com/pmd/pmd/pull/4329): \[core] Refactor usage of snakeyaml
* [#4340](https://github.com/pmd/pmd/issues/4340): \[core] Allow to filter found matches in CPDReport
* java
* [#4364](https://github.com/pmd/pmd/issues/4364): \[java] Parsing error with textblock containing quote followed by two backslashes
* testing
* [#4236](https://github.com/pmd/pmd/issues/4236): \[test] kotest logs look broken
### API Changes
#### PMD CLI
* PMD now supports a new `--relativize-paths-with` flag (or short `-z`), which replaces `--short-names`.
It serves the same purpose: Shortening the pathnames in the reports. However, with the new flag it's possible
to explicitly define one or more pathnames that should be used as the base when creating relative paths.
The old flag `--short-names` is deprecated.
#### Deprecated APIs
##### For removal
* ApexRootNode#getApexVersion
has been deprecated for removal. The version returned is
always `Version.CURRENT`, as the apex compiler integration doesn't use additional information which Apex version
actually is used. Therefore, this method can't be used to determine the Apex version of the project
that is being analyzed.
* CPDConfiguration#setEncoding
and
CPDConfiguration#getEncoding
. Use the methods
getSourceEncoding
and
setSourceEncoding
instead. Both are available
for `CPDConfiguration` which extends `AbstractConfiguration`.
* BaseCLITest
and BaseCPDCLITest
have been deprecated for removal without
replacement. CLI tests should be done in pmd-core only (and in PMD7 in pmd-cli). Individual language modules
shouldn't need to test the CLI integration logic again. Instead, the individual language modules should test their
functionality as unit tests.
* CPDConfiguration.LanguageConverter
* FileCollector#addZipFile
has been deprecated. It is replaced
by FileCollector#addZipFileWithContent
which directly adds the
content of the zip file for analysis.
* PMDConfiguration#setReportShortNames
and
PMDConfiguration#isReportShortNames
have been deprecated for removal.
Use PMDConfiguration#addRelativizeRoot
instead.
##### Internal APIs
* CSVWriter
* Some fields in AbstractAntTestHelper
##### Experimental APIs
* CPDReport has a new method which limited mutation of a given report:
* filterMatches
creates a new CPD report
with some matches removed with a given predicate based filter.
### External Contributions
* [#4110](https://github.com/pmd/pmd/pull/4110): \[apex] Feature/unused variable bind false positive with dynamic SOQL - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot)
* [#4125](https://github.com/pmd/pmd/pull/4125): \[core] New report format html-report-v2.xslt to provide html with datatable and chart features - [Mohan Chinnappan](https://github.com/mohan-chinnappan-n) - (@mohan-chinnappan-n)
* [#4280](https://github.com/pmd/pmd/pull/4280): \[apex] Deprecate ApexRootNode.getApexVersion - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google)
* [#4285](https://github.com/pmd/pmd/pull/4285): \[java] CommentDefaultAccessModifier - add co.elastic.clients.util.VisibleForTesting as default suppressed annotation - [Matthew Luckam](https://github.com/mluckam) (@mluckam)
### Stats
* 107 commits
* 19 closed tickets & PRs
* Days since last release: 27
## 31-December-2022 - 6.53.0
The PMD team is pleased to announce PMD 6.53.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Modified rules](#modified-rules)
* [Deprecated rules](#deprecated-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Deprecated APIs](#deprecated-apis)
* [For removal](#for-removal)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### Modified rules
* The Java rule [`UnusedPrivateField`](https://pmd.github.io/pmd-6.53.0/pmd_rules_java_bestpractices.html#unusedprivatefield) has a new property `reportForAnnotations`.
This is a list of fully qualified names of the annotation types that should be reported anyway. If an unused field
has any of these annotations, then it is reported. If it has any other annotation, then it is still considered
to be used and is not reported.
#### Deprecated rules
* The Java rules [`ExcessiveClassLength`](https://pmd.github.io/pmd-6.53.0/pmd_rules_java_design.html#excessiveclasslength) and [`ExcessiveMethodLength`](https://pmd.github.io/pmd-6.53.0/pmd_rules_java_design.html#excessivemethodlength)
have been deprecated. The rule [`NcssCount`](https://pmd.github.io/pmd-6.53.0/pmd_rules_java_design.html#ncsscount) can be used instead.
The deprecated rules will be removed with PMD 7.0.0.
* The Java rule [`EmptyStatementNotInLoop`](https://pmd.github.io/pmd-6.53.0/pmd_rules_java_errorprone.html#emptystatementnotinloop) is deprecated.
Use the rule [`UnnecessarySemicolon`](https://pmd.github.io/pmd-6.53.0/pmd_rules_java_codestyle.html#unnecessarysemicolon) instead.
Note: Actually it was announced to be deprecated since 6.46.0 but the rule was not marked as deprecated yet.
This has been done now.
### Fixed Issues
* core
* [#4248](https://github.com/pmd/pmd/issues/4248): \[core] Can't analyze sources in zip files
* apex-security
* [#4146](https://github.com/pmd/pmd/issues/4146): \[apex] ApexCRUDViolation: Recognize User Mode in SOQL + DML
* java
* [#4266](https://github.com/pmd/pmd/issues/4266): \[java] PMD fails to process a record with lambda in compact constructor
* java-bestpractices
* [#4166](https://github.com/pmd/pmd/issues/4166): \[java] UnusedPrivateField doesn't find annotated unused private fields anymore
* [#4250](https://github.com/pmd/pmd/issues/4250): \[java] WhileLoopWithLiteralBoolean - false negative with complex expressions still occurs in PMD 6.52.0
* java-design
* [#2127](https://github.com/pmd/pmd/issues/2127): \[java] Deprecate rules ExcessiveClassLength and ExcessiveMethodLength
* java-errorprone
* [#4164](https://github.com/pmd/pmd/issues/4164): \[java]\[doc] AvoidAssertAsIdentifier and AvoidEnumAsIdentifier - clarify use case
* java-multithreading
* [#4210](https://github.com/pmd/pmd/issues/4210): \[java] DoNotUseThreads report duplicate warnings
### API Changes
#### Deprecated APIs
##### For removal
These classes / APIs have been deprecated and will be removed with PMD 7.0.0.
* ExcessiveLengthRule
(Java)
### External Contributions
* [#4244](https://github.com/pmd/pmd/pull/4244): \[apex] ApexCRUDViolation: user mode and system mode with test cases added - [Tarush Singh](https://github.com/Tarush-Singh35) (@Tarush-Singh35)
* [#4274](https://github.com/pmd/pmd/pull/4274): \[java] Fix finding lambda scope in record compact constructor - [kdebski85](https://github.com/kdebski85) (@kdebski85)
### Stats
* 43 commits
* 17 closed tickets & PRs
* Days since last release: 35
## 26-November-2022 - 6.52.0
The PMD team is pleased to announce PMD 6.52.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [New rules](#new-rules)
* [Renamed rules](#renamed-rules)
* [Modified rules](#modified-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [PMD CLI](#pmd-cli)
* [CPD CLI](#cpd-cli)
* [Linux run.sh parameters](#linux-run.sh-parameters)
* [Deprecated API](#deprecated-api)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### New rules
* The new Java rule [`InvalidJavaBean`](https://pmd.github.io/pmd-6.52.0/pmd_rules_java_design.html#invalidjavabean) identifies beans, that don't follow the [JavaBeans API specification](https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/),
like beans with missing getters or setters.
```xml
PMD
and PMD.StatusCode
- PMD 7 will ship with a revamped CLI split from pmd-core. To programmatically launch analysis you can use PmdAnalysis
.
- PMDConfiguration#getAllInputPaths
- It is now superseded by PMDConfiguration#getInputPathList
- PMDConfiguration#setInputPaths
- It is now superseded by PMDConfiguration#setInputPathList
- PMDConfiguration#addInputPath
- It is now superseded by PMDConfiguration#addInputPath
- PMDConfiguration#getInputFilePath
- It is now superseded by PMDConfiguration#getInputFile
- PMDConfiguration#getIgnoreFilePath
- It is now superseded by PMDConfiguration#getIgnoreFile
- PMDConfiguration#setInputFilePath
- It is now superseded by PMDConfiguration#setInputFilePath
- PMDConfiguration#setIgnoreFilePath
- It is now superseded by PMDConfiguration#setIgnoreFilePath
- PMDConfiguration#getInputUri
- It is now superseded by PMDConfiguration#getUri
- PMDConfiguration#setInputUri
- It is now superseded by PMDConfiguration#setInputUri
- PMDConfiguration#getReportFile
- It is now superseded by PMDConfiguration#getReportFilePath
- PMDConfiguration#setReportFile
- It is now superseded by PMDConfiguration#setReportFile
- PMDConfiguration#isStressTest
and PMDConfiguration#setStressTest
- Will be removed with no replacement.
- PMDConfiguration#isBenchmark
and PMDConfiguration#setBenchmark
- Will be removed with no replacement, the CLI will still support it.
- CPD
and CPD.StatusCode
- PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time.
* In order to reduce the dependency on Apex Jorje classes, the method DataType#fromBasicType
has been deprecated. The equivalent method fromTypeName
should be used instead.
### External Contributions
* [#4184](https://github.com/pmd/pmd/pull/4184): \[java]\[doc] TestClassWithoutTestCases - fix small typo in description - [Valery Yatsynovich](https://github.com/valfirst) (@valfirst)
* [#4198](https://github.com/pmd/pmd/pull/4198): \[doc] Add supported CPD languages - [Jeroen van Wilgenburg](https://github.com/jvwilge) (@jvwilge)
* [#4202](https://github.com/pmd/pmd/pull/4202): \[java] Fix #4200 and #4201: ClassWithOnlyPrivateConstructorsShouldBeFinal, CommentDefaultAccessModifier: Exclude lombok @Value annotation - [Lynn](https://github.com/LynnBroe) (@LynnBroe)
* [#4205](https://github.com/pmd/pmd/pull/4205): \[doc] Clarify Scala support (no built-in rules) - [Eldrick Wega](https://github.com/Eldrick19) (@Eldrick19)
* [#4226](https://github.com/pmd/pmd/pull/4226): \[visualforce] Replace uses of Jorje types in pmd-visualforce - [Aaron Hurst](https://github.com/aaronhurst-google) (@aaronhurst-google)
* [#4227](https://github.com/pmd/pmd/pull/4227): \[java] Fix #4225 MissingStaticMethodInNonInstantiatableClass: Exclude lombok's @NoArgsConstructor annotation - [Lynn](https://github.com/LynnBroe) (@LynnBroe)
* [#4228](https://github.com/pmd/pmd/pull/4228): \[java] Fix #4224 MissingStaticMethodInNonInstantiatableClass: Exclude lombok's UtilityClass - [Lynn](https://github.com/LynnBroe) (@LynnBroe)
* [#4232](https://github.com/pmd/pmd/pull/4232): \[doc] Fixing typos - [Andreas Deininger](https://github.com/deining) (@deining)
### Stats
* 96 commits
* 40 closed tickets & PRs
* Days since last release: 28
## 29-October-2022 - 6.51.0
The PMD team is pleased to announce PMD 6.51.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [New Rules](#new-rules)
* [Modified Rules](#modified-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### New Rules
* The new Apex rule [`ApexUnitTestClassShouldHaveRunAs`](https://pmd.github.io/pmd-6.51.0/pmd_rules_apex_bestpractices.html#apexunittestclassshouldhaverunas) ensures that unit tests
use [System.runAs()](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_runas.htm)
at least once. This makes the tests more robust, and independent from the user running it.
```xml
ASTAssignmentExpression#getOperator
* ASTBinaryExpression#getOperator
* ASTBooleanExpression#getOperator
* ASTPostfixExpression#getOperator
* ASTPrefixExpression#getOperator
All these classes have now a new `getOp()` method. Existing code should be refactored to use this method instead.
It returns the new enums, like AssignmentOperator
, and avoids
the dependency to Jorje.
### External Contributions
* [#4081](https://github.com/pmd/pmd/pull/4081): \[apex] Remove Jorje leaks outside `ast` package - [@eklimo](https://github.com/eklimo)
* [#4083](https://github.com/pmd/pmd/pull/4083): \[java] UnnecessaryImport false positive for on-demand imports of nested classes (fix for #4082) - [@abyss638](https://github.com/abyss638)
* [#4092](https://github.com/pmd/pmd/pull/4092): \[apex] Implement ApexQualifiableNode for ASTUserEnum - [@aaronhurst-google](https://github.com/aaronhurst-google)
* [#4095](https://github.com/pmd/pmd/pull/4095): \[core] CPD: Added begin and end token to XML reports - [@pacvz](https://github.com/pacvz)
* [#4097](https://github.com/pmd/pmd/pull/4097): \[apex] ApexUnitTestClassShouldHaveAssertsRule: Support new Assert class (Apex v56.0) - [@tprouvot](https://github.com/tprouvot)
* [#4104](https://github.com/pmd/pmd/pull/4104): \[doc] Add MegaLinter in the list of integrations - [@nvuillam](https://github.com/nvuillam)
### Stats
* 49 commits
* 10 closed tickets & PRs
* Days since last release: 32
## 30-July-2022 - 6.48.0
The PMD team is pleased to announce PMD 6.48.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Java 19 Support](#java-19-support)
* [Gherkin support](#gherkin-support)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [CPD CLI](#cpd-cli)
* [Rule Test Framework](#rule-test-framework)
* [Deprecated API](#deprecated-api)
* [Experimental APIs](#experimental-apis)
* [Internal API](#internal-api)
* [Financial Contributions](#financial-contributions)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### Java 19 Support
This release of PMD brings support for Java 19. There are no new standard language features.
PMD supports [JEP 427: Pattern Matching for switch (Third Preview)](https://openjdk.org/jeps/427) and
[JEP 405: Record Patterns (Preview)](https://openjdk.org/jeps/405) as preview language features.
In order to analyze a project with PMD that uses these language features,
you'll need to enable it via the environment variable `PMD_JAVA_OPTS` and select the new language
version `19-preview`:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd -language java -version 19-preview ...
Note: Support for Java 17 preview language features have been removed. The version "17-preview" is no longer available.
#### Gherkin support
Thanks to the contribution from [Anne Brouwers](https://github.com/ASBrouwers) PMD now has CPD support
for the [Gherkin](https://cucumber.io/docs/gherkin/) language. It is used to defined test cases for the
[Cucumber](https://cucumber.io/) testing tool for behavior-driven development.
Being based on a proper Antlr grammar, CPD can:
* ignore comments
* honor [comment-based suppressions](pmd_userdocs_cpd.html#suppression)
### Fixed Issues
* apex
* [#4056](https://github.com/pmd/pmd/pull/4056): \[apex] ApexSOQLInjection: Add support count query
* core
* [#3796](https://github.com/pmd/pmd/issues/3796): \[core] CPD should also provide a `--debug` flag
* [#4021](https://github.com/pmd/pmd/pull/4021): \[core] CPD: Add total number of tokens to XML reports
* [#4031](https://github.com/pmd/pmd/issues/4031): \[core] If report is written to stdout, stdout should not be closed
* [#4051](https://github.com/pmd/pmd/issues/4051): \[doc] Additional rulesets are not listed in documentation
* [#4053](https://github.com/pmd/pmd/pull/4053): \[core] Allow building PMD under Java 18+
* java
* [#4015](https://github.com/pmd/pmd/issues/4015): \[java] Support JDK 19
* java-bestpractices
* [#3455](https://github.com/pmd/pmd/issues/3455): \[java] WhileLoopWithLiteralBoolean - false negative with complex expressions
* java-design
* [#3729](https://github.com/pmd/pmd/issues/3729): \[java] TooManyMethods ignores "real" methods which are named like getters or setters
* [#3949](https://github.com/pmd/pmd/issues/3949): \[java] FinalFieldCouldBeStatic - false negative with unnecessary parenthesis
* java-performance
* [#3625](https://github.com/pmd/pmd/issues/3625): \[java] AddEmptyString - false negative with empty var
* lua
* [#4061](https://github.com/pmd/pmd/pull/4061): \[lua] Fix several related Lua parsing issues found when using CPD
* test
* [#3302](https://github.com/pmd/pmd/pull/3302): \[test] Improve xml test schema
* [#3758](https://github.com/pmd/pmd/issues/3758): \[test] Move pmd-test to java 8
* [#3976](https://github.com/pmd/pmd/pull/3976): \[test] Extract xml schema module
### API Changes
#### CPD CLI
* CPD has a new CLI option `--debug`. This option has the same behavior as in PMD. It enables more verbose
logging output.
#### Rule Test Framework
* The module "pmd-test", which contains support classes to write rule tests, now **requires Java 8**. If you depend on
this module for testing your own custom rules, you'll need to make sure to use at least Java 8.
* The new module "pmd-test-schema" contains now the XSD schema and the code to parse the rule test XML files. The
schema has been extracted in order to easily share it with other tools like the Rule Designer or IDE plugins.
* Test schema changes:
* The attribute `isRegressionTest` of `test-code` is deprecated. The new
attribute `disabled` should be used instead for defining whether a rule test should be skipped or not.
* The attributes `reinitializeRule` and `useAuxClasspath` of `test-code` are deprecated and assumed true.
They will not be replaced.
* The new attribute `focused` of `test-code` allows disabling all tests except the focused one temporarily.
* More information about the rule test framework can be found in the documentation:
[Testing your rules](pmd_userdocs_extending_testing.html)
#### Deprecated API
* The experimental Java AST class ASTGuardedPattern
has been deprecated and
will be removed. It was introduced for Java 17 and Java 18 Preview as part of pattern matching for switch,
but it is no longer supported with Java 19 Preview.
* The interface CPDRenderer
is deprecated. For custom CPD renderers
the new interface CPDReportRenderer
should be used.
* The class TestDescriptor
is deprecated, replaced with RuleTestDescriptor
.
* Many methods of RuleTst
have been deprecated as internal API.
#### Experimental APIs
* To support the Java preview language features "Pattern Matching for Switch" and "Record Patterns", the following
AST nodes have been introduced as experimental:
* ASTSwitchGuard
* ASTRecordPattern
* ASTComponentPatternList
#### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
* CPDConfiguration#setRenderer
* CPDConfiguration#setCPDRenderer
* CPDConfiguration#getRenderer
* CPDConfiguration#getCPDRenderer
* CPDConfiguration#getRendererFromString
* CPDConfiguration#getCPDRendererFromString
* CPDRendererAdapter
### Financial Contributions
Many thanks to our sponsors:
* [Matt Hargett](https://github.com/matthargett) (@matthargett)
### External Contributions
* [#3984](https://github.com/pmd/pmd/pull/3984): \[java] Fix AddEmptyString false-negative issue - [@LiGaOg](https://github.com/LiGaOg)
* [#3988](https://github.com/pmd/pmd/pull/3988): \[java] Modify WhileLoopWithLiteralBoolean to meet the missing case #3455 - [@VoidxHoshi](https://github.com/VoidxHoshi)
* [#3992](https://github.com/pmd/pmd/pull/3992): \[java] FinalFieldCouldBeStatic - fix false negative with unnecessary parenthesis - [@dalizi007](https://github.com/dalizi007)
* [#3994](https://github.com/pmd/pmd/pull/3994): \[java] TooManyMethods - improve getter/setter detection (#3729) - [@341816041](https://github.com/341816041)
* [#4017](https://github.com/pmd/pmd/pull/4017): Add Gherkin support to CPD - [@ASBrouwers](https://github.com/ASBrouwers)
* [#4021](https://github.com/pmd/pmd/pull/4021): \[core] CPD: Add total number of tokens to XML reports - [@maikelsteneker](https://github.com/maikelsteneker)
* [#4056](https://github.com/pmd/pmd/pull/4056): \[apex] ApexSOQLInjection: Add support count query - [@gwilymatgearset](https://github.com/gwilymatgearset)
* [#4061](https://github.com/pmd/pmd/pull/4061): \[lua] Fix several related Lua parsing issues found when using CPD - [@matthargett](https://github.com/matthargett)
### Stats
* 102 commits
* 26 closed tickets & PRs
* Days since last release: 35
## 25-June-2022 - 6.47.0
The PMD team is pleased to announce PMD 6.47.0.
This is a minor release.
### Table Of Contents
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### Fixed Issues
* core
* [#3999](https://github.com/pmd/pmd/issues/3999): \[cli] All files are analyzed despite parameter `--file-list`
* [#4009](https://github.com/pmd/pmd/issues/4009): \[core] Cannot build PMD with Temurin 17
* java-bestpractices
* [#3824](https://github.com/pmd/pmd/issues/3824): \[java] UnusedPrivateField: Do not flag fields annotated with @Version
* [#3825](https://github.com/pmd/pmd/issues/3825): \[java] UnusedPrivateField: Do not flag fields annotated with @Id or @EmbeddedId
* java-design
* [#3823](https://github.com/pmd/pmd/issues/3823): \[java] ImmutableField: Do not flag fields in @Entity
* [#3981](https://github.com/pmd/pmd/issues/3981): \[java] ImmutableField reports fields annotated with @Value (Spring)
* [#3998](https://github.com/pmd/pmd/issues/3998): \[java] ImmutableField reports fields annotated with @Captor (Mockito)
* [#4004](https://github.com/pmd/pmd/issues/4004): \[java] ImmutableField reports fields annotated with @GwtMock (GwtMockito) and @Spy (Mockito)
* [#4008](https://github.com/pmd/pmd/issues/4008): \[java] ImmutableField not reporting fields that are only initialized in the declaration
* [#4011](https://github.com/pmd/pmd/issues/4011): \[java] ImmutableField: Do not flag fields annotated with @Inject
* [#4020](https://github.com/pmd/pmd/issues/4020): \[java] ImmutableField reports fields annotated with @FindBy and @FindBys (Selenium)
* java-errorprone
* [#3936](https://github.com/pmd/pmd/issues/3936): \[java] AvoidFieldNameMatchingMethodName should consider enum class
* [#3937](https://github.com/pmd/pmd/issues/3937): \[java] AvoidDuplicateLiterals - uncompilable test cases
### API Changes
No changes.
### External Contributions
* [#3985](https://github.com/pmd/pmd/pull/3985): \[java] Fix false negative problem about Enum in AvoidFieldNameMatchingMethodName #3936 - [@Scrsloota](https://github.com/Scrsloota)
* [#3993](https://github.com/pmd/pmd/pull/3993): \[java] AvoidDuplicateLiterals - Add the method "buz" definition to test cases - [@dalizi007](https://github.com/dalizi007)
* [#4002](https://github.com/pmd/pmd/pull/4002): \[java] ImmutableField - Ignore fields annotated with @Value (Spring) or @Captor (Mockito) - [@jjlharrison](https://github.com/jjlharrison)
* [#4003](https://github.com/pmd/pmd/pull/4003): \[java] UnusedPrivateField - Ignore fields annotated with @Id/@EmbeddedId/@Version (JPA) or @Mock/@Spy/@MockBean (Mockito/Spring) - [@jjlharrison](https://github.com/jjlharrison)
* [#4006](https://github.com/pmd/pmd/pull/4006): \[doc] Fix eclipse plugin update site URL - [@shiomiyan](https://github.com/shiomiyan)
* [#4010](https://github.com/pmd/pmd/pull/4010): \[core] Bump kotlin to version 1.7.0 - [@maikelsteneker](https://github.com/maikelsteneker)
### Stats
* 45 commits
* 23 closed tickets & PRs
* Days since last release: 27
## 28-May-2022 - 6.46.0
The PMD team is pleased to announce PMD 6.46.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [CLI improvements](#cli-improvements)
* [C# Improvements](#c#-improvements)
* [New Rules](#new-rules)
* [Deprecated Rules](#deprecated-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Deprecated ruleset references](#deprecated-ruleset-references)
* [Deprecated API](#deprecated-api)
* [Internal API](#internal-api)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### CLI improvements
The PMD CLI now allows repeating the `--dir` (`-d`) and `--rulesets` (`-R`) options,
as well as providing several space-separated arguments to either of them. For instance:
```shell
pmd -d src/main/java src/test/java -R rset1.xml -R rset2.xml
```
This also allows globs to be used on the CLI if your shell supports shell expansion.
For instance, the above can be written
```shell
pmd -d src/*/java -R rset*.xml
```
Please use theses new forms instead of using comma-separated lists as argument to these options.
#### C# Improvements
When executing CPD on C# sources, the option `--ignore-annotations` is now supported as well.
It ignores C# attributes when detecting duplicated code. This option can also be enabled via
the CPD GUI. See [#3974](https://github.com/pmd/pmd/pull/3974) for details.
#### New Rules
This release ships with 2 new Java rules.
* [`EmptyControlStatement`](https://pmd.github.io/pmd-6.46.0/pmd_rules_java_codestyle.html#emptycontrolstatement) reports many instances of empty things, e.g. control statements whose
body is empty, as well as empty initializers.
EmptyControlStatement also works for empty `for` and `do` loops, while there were previously
no corresponding rules.
This new rule replaces the rules EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock,
EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, and EmptyWhileStmt.
```xml
toString
is now deprecated. The format of this
method will remain the same until PMD 7. The deprecation is intended to steer users
away from relying on this format, as it may be changed in PMD 7.
- getInputPaths
and
setInputPaths
are now deprecated.
A new set of methods have been added, which use lists and do not rely on comma splitting.
#### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
- CPDCommandLineInterface
has been internalized. In order to execute CPD either
CPD#run
or CPD#main
should be used.
- Several members of BaseCPDCLITest
have been deprecated with replacements.
- The methods Formatter#start
,
Formatter#end
, Formatter#getRenderer
,
and Formatter#isNoOutputSupplied
have been internalized.
### External Contributions
* [#3961](https://github.com/pmd/pmd/pull/3961): \[java] Fix #3954 - NPE in UseCollectionIsEmptyRule with record - [@flyhard](https://github.com/flyhard)
* [#3964](https://github.com/pmd/pmd/pull/3964): \[java] Fix #3874 - ImmutableField: fix mockito/spring false positives - [@lukelukes](https://github.com/lukelukes)
* [#3974](https://github.com/pmd/pmd/pull/3974): \[cs] Add option to ignore C# attributes (annotations) - [@maikelsteneker](https://github.com/maikelsteneker)
### Stats
* 92 commits
* 30 closed tickets & PRs
* Days since last release: 28
## 30-April-2022 - 6.45.0
The PMD team is pleased to announce PMD 6.45.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [PMD User Survey](#pmd-user-survey)
* [Support for HTML](#support-for-html)
* [New rules](#new-rules)
* [Modified rules](#modified-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Experimental APIs](#experimental-apis)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### PMD User Survey
Help shape the future of PMD by telling us how you use it.
Our little survey is still open in case you didn't participate yet.
Please participate in our survey at Report#filterViolations
creates a new report with
some violations removed with a given predicate based filter.
* Report#union
can combine two reports into a single new Report.
* net.sourceforge.pmd.util.Predicate
will be replaced in PMD7 with the standard Predicate interface from java8.
* The module `pmd-html` is entirely experimental right now. Anything in the package
`net.sourceforge.pmd.lang.html` should be used cautiously.
### External Contributions
* [#3883](https://github.com/pmd/pmd/pull/3883): \[doc] Improve side bar by Adding Release Date - [@jasonqiu98](https://github.com/jasonqiu98)
* [#3910](https://github.com/pmd/pmd/pull/3910): \[java] UnusedPrivateField - Allow the ignored fieldnames to be configurable - [@laoseth](https://github.com/laoseth)
* [#3928](https://github.com/pmd/pmd/pull/3928): \[plsql] Fix plsql parsing error in parenthesis groups - [@LiGaOg](https://github.com/LiGaOg)
* [#3935](https://github.com/pmd/pmd/pull/3935): \[plsql] Fix parser exception in EXECUTE IMMEDIATE BULK COLLECT #3687 - [@Scrsloota](https://github.com/Scrsloota)
* [#3938](https://github.com/pmd/pmd/pull/3938): \[java] Modify SimplifiedTernary to meet the missing case #3603 - [@VoidxHoshi](https://github.com/VoidxHoshi)
* [#3943](https://github.com/pmd/pmd/pull/3943): chore: Set permissions for GitHub actions - [@naveensrinivasan](https://github.com/naveensrinivasan)
### Stats
* 97 commits
* 31 closed tickets & PRs
* Days since last release: 33
## 27-March-2022 - 6.44.0
The PMD team is pleased to announce PMD 6.44.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [PMD User Survey](#pmd-user-survey)
* [Java 18 Support](#java-18-support)
* [Better XML XPath support](#better-xml-xpath-support)
* [New XPath functions](#new-xpath-functions)
* [New programmatic API](#new-programmatic-api)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Deprecated API](#deprecated-api)
* [Experimental APIs](#experimental-apis)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### PMD User Survey
Help shape the future of PMD by telling us how you use it.
Please participate in our survey at DomXPathRule
is intended to replace
usage of the `XPathRule` for XML rules. This rule executes the XPath query in a different
way, which sticks to the XPath specification. This means the expression is interpreted
the same way in PMD as in all other XPath development tools that stick to the standard.
You can for instance test the expression in an online XPath editor.
Prefer using this class to define XPath rules: replace the value of the `class`
attribute with `net.sourceforge.pmd.lang.xml.rule.DomXPathRule` like so:
```xml
DomXPathRule
for information about the differences with `XPathRule` and examples.
`XPathRule` is still perfectly supported for all other languages, including Apex and Java.
#### New XPath functions
The new XPath functions `pmd:startLine`, `pmd:endLine`, `pmd:startColumn`,
and `pmd:endColumn` are now available in XPath rules for all languages. They
replace the node attributes `@BeginLine`, `@EndLine` and such. These attributes
will be deprecated in a future release.
Please refer to [the documentation](https://pmd.github.io/latest/pmd_userdocs_extending_writing_xpath_rules.html#pmd-extension-functions) of these functions for more information, including usage samples.
Note that the function `pmd:endColumn` returns an exclusive index, while the
attribute `@EndColumn` is inclusive. This is for forward compatibility with PMD 7,
which uses exclusive end indices.
#### New programmatic API
This release introduces a new programmatic API to replace the inflexible PMD
class.
Programmatic execution of PMD should now be done with a PMDConfiguration
and a PmdAnalysis
, for instance:
```java
PMDConfiguration config = new PMDConfiguration();
config.setDefaultLanguageVersion(LanguageRegistry.findLanguageByTerseName("java").getVersion("11"));
config.setInputPaths("src/main/java");
config.prependAuxClasspath("target/classes");
config.setMinimumPriority(RulePriority.HIGH);
config.addRuleSet("rulesets/java/quickstart.xml");
config.setReportFormat("xml");
config.setReportFile("target/pmd-report.xml");
try (PmdAnalysis pmd = PmdAnalysis.create(config)) {
// note: don't use `config` once a PmdAnalysis has been created.
// optional: add more rulesets
pmd.addRuleSet(pmd.newRuleSetLoader().loadFromResource("custom-ruleset.xml"));
// optional: add more files
pmd.files().addFile(Paths.get("src", "main", "more-java", "ExtraSource.java"));
// optional: add more renderers
pmd.addRenderer(renderer);
// or just call PMD
pmd.performAnalysis();
}
```
The `PMD` class still supports methods related to CLI execution: `runPmd` and `main`.
All other members are now deprecated for removal.
The CLI itself remains compatible, if you run PMD via command-line, no action is required on your part.
### Fixed Issues
* apex
* [#3817](https://github.com/pmd/pmd/pull/3817): \[apex] Add designer bindings to display main attributes
* apex-performance
* [#3773](https://github.com/pmd/pmd/pull/3773): \[apex] EagerlyLoadedDescribeSObjectResult false positives with SObjectField.getDescribe()
* core
* [#2693](https://github.com/pmd/pmd/issues/2693): \[ci] Add integration tests with real open-source projects
* [#3299](https://github.com/pmd/pmd/issues/3299): \[core] Deprecate system properties of PMDCommandLineInterface
* java
* [#3809](https://github.com/pmd/pmd/issues/3809): \[java] Support JDK 18
* doc
* [#2504](https://github.com/pmd/pmd/issues/2504): \[doc] Improve "Edit me on github" button
* [#3812](https://github.com/pmd/pmd/issues/3812): \[doc] Documentation website table of contents broken on pages with many subheadings
* java-design
* [#3850](https://github.com/pmd/pmd/issues/3850): \[java] ImmutableField - false negative when field assigned in constructor conditionally
* [#3851](https://github.com/pmd/pmd/issues/3851): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal - false negative when a compilation unit contains two class declarations
* xml
* [#2766](https://github.com/pmd/pmd/issues/2766): \[xml] XMLNS prefix is not pre-declared in xpath query
* [#3863](https://github.com/pmd/pmd/issues/3863): \[xml] Make XPath rules work exactly as in the XPath spec
### API Changes
#### Deprecated API
* Several members of PMD
have been newly deprecated, including:
- `PMD#EOL`: use `System#lineSeparator()`
- `PMD#SUPPRESS_MARKER`: use DEFAULT_SUPPRESS_MARKER
- `PMD#processFiles`: use the [new programmatic API](#new-programmatic-api)
- `PMD#getApplicableFiles`: is internal
* PMDConfiguration#prependClasspath
is deprecated
in favour of prependAuxClasspath
.
* PMDConfiguration#setRuleSets
and
getRuleSets
are deprecated. Use instead
setRuleSets
,
addRuleSet
,
and getRuleSetPaths
.
* Several members of BaseCLITest
have been deprecated with replacements.
* Several members of PMDCommandLineInterface
have been explicitly deprecated.
The whole class however was deprecated long ago already with 6.30.0. It is internal API and should
not be used.
* In modelica, the rule classes AmbiguousResolutionRule
and ConnectUsingNonConnector
have been deprecated,
since they didn't comply to the usual rule class naming conventions yet.
The replacements are in the subpackage `bestpractices`.
#### Experimental APIs
* Together with the [new programmatic API](#new-programmatic-api) the interface
TextFile
has been added as *experimental*. It intends
to replace DataSource
and SourceCode
in the long term.
This interface will change in PMD 7 to support read/write operations
and other things. You don't need to use it in PMD 6, as FileCollector
decouples you from this. A file collector is available through PmdAnalysis#files
.
### External Contributions
* [#3773](https://github.com/pmd/pmd/pull/3773): \[apex] EagerlyLoadedDescribeSObjectResult false positives with SObjectField.getDescribe() - [@filiprafalowicz](https://github.com/filiprafalowicz)
* [#3811](https://github.com/pmd/pmd/pull/3811): \[doc] Improve "Edit me on github" button - [@btjiong](https://github.com/btjiong)
* [#3836](https://github.com/pmd/pmd/pull/3836): \[doc] Make TOC scrollable when too many subheadings - [@JerritEic](https://github.com/JerritEic)
### Stats
* 124 commits
* 23 closed tickets & PRs
* Days since last release: 29
## 26-February-2022 - 6.43.0
The PMD team is pleased to announce PMD 6.43.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Deprecated API](#deprecated-api)
* [Internal API](#internal-api)
* [Changed API](#changed-api)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
### Fixed Issues
* core
* [#3427](https://github.com/pmd/pmd/issues/3427): \[core] Stop printing CLI usage text when exiting due to invalid parameters
* [#3768](https://github.com/pmd/pmd/issues/3768): \[core] SARIF formatter reports multiple locations when it should report multiple results
* doc
* [#2502](https://github.com/pmd/pmd/issues/2502): \[doc] Add floating table-of-contents (toc) on the right
* [#3807](https://github.com/pmd/pmd/pull/3807): \[doc] Document Ant Task parameter `threads`
* java
* [#3698](https://github.com/pmd/pmd/issues/3697): \[java] Parsing error with try-with-resources and qualified resource
* java-bestpractices
* [#3605](https://github.com/pmd/pmd/issues/3605): \[java] SwitchStmtsShouldHaveDefault triggered when default case is present
* java-codestyle
* [#278](https://github.com/pmd/pmd/issues/278): \[java] ConfusingTernary should treat `!= null` as positive condition
* java-performance
* [#3374](https://github.com/pmd/pmd/issues/3374): \[java] UseStringBufferForStringAppends: Wrong example in documentation
* misc
* [#3759](https://github.com/pmd/pmd/issues/3759): \[lang-test] Upgrade dokka maven plugin to 1.4.32
* plsql
* [#3746](https://github.com/pmd/pmd/issues/3746): \[plsql] Parsing exception "Less than or equal to/Greater than or equal to" operators in DML statements
### API Changes
#### Deprecated API
Some API deprecations were performed in core PMD classes, to improve compatibility with PMD 7.
- Report
: the constructor and other construction methods like addViolation or createReport
- RuleContext
: all constructors, getters and setters. A new set
of stable methods, matching those in PMD 7, was added to replace the `addViolation`
overloads of AbstractRule
. In PMD 7, `RuleContext` will
be the API to report violations, and it can already be used as such in PMD 6.
- The field configuration
is unused and will be removed.
#### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
- RuleSet
: methods that serve to apply rules, including `apply`, `start`, `end`, `removeDysfunctionalRules`
- AbstractAccumulatingRenderer#renderFileReport
is internal API
and should not be overridden in own renderers.
#### Changed API
It is now forbidden to report a violation:
- With a `null` node
- With a `null` message
- With a `null` set of format arguments (prefer a zero-length array)
Note that the message is set from the XML rule declaration, so this is only relevant
if you instantiate rules manually.
RuleContext
now requires setting the current rule before calling
apply
. This is
done automatically by `RuleSet#apply` and such. Creating and configuring a
`RuleContext` manually is strongly advised against, as the lifecycle of `RuleContext`
will change drastically in PMD 7.
### External Contributions
* [#3767](https://github.com/pmd/pmd/pull/3767): \[core] Update GUI.java - [Vyom Yadav](https://github.com/Vyom-Yadav)
* [#3804](https://github.com/pmd/pmd/pull/3804): \[doc] Add floating table of contents (issue #2502) - [JerritEic](https://github.com/JerritEic)
### Stats
* 49 commits
* 22 closed tickets & PRs
* Days since last release: 27
## 29-January-2022 - 6.42.0
The PMD team is pleased to announce PMD 6.42.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Javascript: Rhino updated to latest version 1.7.14](#javascript:-rhino-updated-to-latest-version-1.7.14)
* [New rules](#new-rules)
* [Modified rules](#modified-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### Javascript: Rhino updated to latest version 1.7.14
[Rhino](https://github.com/mozilla/rhino), the implementation of JavaScript we use
for parsing JavaScript code, has been updated to the latest version 1.7.14.
Now language features like template strings can be parsed. However Rhino does
not support all features of the latest EcmaScript standard.
#### New rules
* The new Java rule [`FinalParameterInAbstractMethod`](https://pmd.github.io/pmd-6.42.0/pmd_rules_java_codestyle.html#finalparameterinabstractmethod) detects parameters that are
declared as final in interfaces or abstract methods. Declaring the parameters as final is useless
because the implementation may choose to not respect it.
```xml
ASTCommentContainer
has been added to the Apex AST.
It provides a way to check whether a node contains at least one comment. Currently this is only implemented for
ASTCatchBlockStatement
and used by the rule
[`EmptyCatchBlock`](https://pmd.github.io/pmd-6.41.0-SNAPSHOT/pmd_rules_apex_errorprone.html#emptycatchblock).
This information is also available via XPath attribute `@ContainsComment`.
### External Contributions
* [#3538](https://github.com/pmd/pmd/pull/3538): \[apex] New rule EagerlyLoadedDescribeSObjectResult - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3549](https://github.com/pmd/pmd/pull/3549): \[java] Ignore AddEmptyString rule in annotations - [Stanislav Myachenkov](https://github.com/smyachenkov)
* [#3561](https://github.com/pmd/pmd/pull/3561): \[java] InvalidLogMessageFormat: False positive with message and exception in a block inside a lambda - [Nicolas Filotto](https://github.com/essobedo)
* [#3565](https://github.com/pmd/pmd/pull/3565): \[doc] Fix resource leak due to Files.walk - [lujiefsi](https://github.com/lujiefsi)
* [#3571](https://github.com/pmd/pmd/pull/3571): \[apex] Fix for #1089 - Added new configuration property additionalAssertMethodPattern to ApexUnitTestClassShouldHaveAssertsRule - [Scott Wells](https://github.com/SCWells72)
* [#3572](https://github.com/pmd/pmd/pull/3572): \[apex] Fix for #3566 - Added new configuration property reportMissingDescription to ApexDocRule - [Scott Wells](https://github.com/SCWells72)
* [#3573](https://github.com/pmd/pmd/pull/3573): \[apex] Fix for #3568 - Added new configuration properties reportEmptyPrivateNoArgConstructor and reportEmptyVirtualMethod to EmptyStatementBlock - [Scott Wells](https://github.com/SCWells72)
* [#3574](https://github.com/pmd/pmd/pull/3574): \[apex] Fix for #3569 - Added new configuration properties allowCommentedBlocks and allowExceptionNameRegex to EmptyCatchBlock - [Scott Wells](https://github.com/SCWells72)
* [#3575](https://github.com/pmd/pmd/pull/3575): \[apex] Fix for #3570 - Added new configuration property reportInForLoopInitializer to OneDeclarationPerLine - [Scott Wells](https://github.com/SCWells72)
* [#3577](https://github.com/pmd/pmd/pull/3577): \[apex] Fix for #3576 - Added new configuration properties \*AuthMethodPattern and \*AuthMethodTypeParamIndex to ApexCRUDViolation rule - [Scott Wells](https://github.com/SCWells72)
* [#3578](https://github.com/pmd/pmd/pull/3578): \[apex] ApexCRUDViolation: Documentation changes for #3576 - [Scott Wells](https://github.com/SCWells72)
* [#3580](https://github.com/pmd/pmd/pull/3580): \[doc] Release notes updates for the changes in issue #3569 - [Scott Wells](https://github.com/SCWells72)
* [#3581](https://github.com/pmd/pmd/pull/3581): \[apex] #3569 - Requested changes for code review feedback - [Scott Wells](https://github.com/SCWells72)
### Stats
* 72 commits
* 37 closed tickets & PRs
* Days since last release: 34
## 25-September-2021 - 6.39.0
The PMD team is pleased to announce PMD 6.39.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [All Contributors](#all-contributors)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### All Contributors
PMD follows the [All Contributors](https://allcontributors.org/) specification.
Contributions of any kind welcome!
See [credits](https://pmd.github.io/latest/pmd_projectdocs_credits.html) for our complete contributors list.
### Fixed Issues
* core
* [#3499](https://github.com/pmd/pmd/pull/3499): \[core] Fix XPath rulechain with combined node tests
* java-errorprone
* [#3493](https://github.com/pmd/pmd/pull/3493): \[java] AvoidAccessibilityAlteration: add tests and fix rule
* javascript
* [#3516](https://github.com/pmd/pmd/pull/3516): \[javascript] NPE while creating rule violation when specifying explicit line numbers
* plsql
* [#3487](https://github.com/pmd/pmd/issues/3487): \[plsql] Parsing exception OPEN ref_cursor_name FOR statement
* [#3515](https://github.com/pmd/pmd/issues/3515): \[plsql] Parsing exception SELECT...INTO on Associative Arrays Types
### API Changes
No changes.
### External Contributions
* [#3516](https://github.com/pmd/pmd/pull/3516): \[javascript] NPE while creating rule violation when specifying explicit line numbers - [Kevin Guerra](https://github.com/kevingnet)
### Stats
* 37 commits
* 10 closed tickets & PRs
* Days since last release: 27
## 28-August-2021 - 6.38.0
The PMD team is pleased to announce PMD 6.38.0.
This is a minor release.
### Table Of Contents
* [Fixed Issues](#fixed-issues)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### Fixed Issues
* apex
* [#3462](https://github.com/pmd/pmd/issues/3462): \[apex] SOQL performed in a for-each loop doesn't trigger ApexCRUDViolationRule
* [#3484](https://github.com/pmd/pmd/issues/3484): \[apex] ApexCRUDViolationRule maintains state across files
* core
* [#3446](https://github.com/pmd/pmd/issues/3446): \[core] Allow XPath rules to access the current file name
* java-bestpractices
* [#3403](https://github.com/pmd/pmd/issues/3403): \[java] MethodNamingConventions junit5TestPattern does not detect parameterized tests
### External Contributions
* [#3445](https://github.com/pmd/pmd/pull/3445): \[java] Fix #3403 about MethodNamingConventions and JUnit5 parameterized tests - [Cyril Sicard](https://github.com/CyrilSicard)
* [#3470](https://github.com/pmd/pmd/pull/3470): \[apex] Fix ApexCRUDViolationRule - add super call - [Josh Feingold](https://github.com/jfeingold35)
### Stats
* 32 commits
* 8 closed tickets & PRs
* Days since last release: 27
## 31-July-2021 - 6.37.0
The PMD team is pleased to announce PMD 6.37.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Java 17 Support](#java-17-support)
* [Updated PMD Designer](#updated-pmd-designer)
* [New rules](#new-rules)
* [Renamed rules](#renamed-rules)
* [Deprecated rules](#deprecated-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [PMD CLI](#pmd-cli)
* [Experimental APIs](#experimental-apis)
* [Internal API](#internal-api)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### Java 17 Support
This release of PMD brings support for Java 17. PMD supports [JEP 409: Sealed Classes](https://openjdk.java.net/jeps/409)
which has been promoted to be a standard language feature of Java 17.
PMD also supports [JEP 406: Pattern Matching for switch (Preview)](https://openjdk.java.net/jeps/406) as a preview
language feature. In order to analyze a project with PMD that uses these language features, you'll need to enable
it via the environment variable `PMD_JAVA_OPTS` and select the new language version `17-preview`:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd -language java -version 17-preview ...
Note: Support for Java 15 preview language features have been removed. The version "15-preview" is no longer available.
#### Updated PMD Designer
This PMD release ships a new version of the pmd-designer.
For the changes, see [PMD Designer Changelog](https://github.com/pmd/pmd-designer/releases/tag/6.37.0).
#### New rules
This release ships with 3 new Java rules.
* [`PrimitiveWrapperInstantiation`](https://pmd.github.io/pmd-6.37.0/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation) reports usages of primitive wrapper
constructors. They are deprecated since Java 9 and should not be used.
```xml
ASTClassOrInterfaceDeclaration#isSealed
,
ASTClassOrInterfaceDeclaration#isNonSealed
,
ASTClassOrInterfaceDeclaration#getPermittedSubclasses
* ASTPermitsList
#### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
* The inner class net.sourceforge.pmd.cpd.TokenEntry.State
is considered to be internal API.
It will probably be moved away with PMD 7.
### External Contributions
* [#3367](https://github.com/pmd/pmd/pull/3367): \[apex] Check SOQL CRUD on for loops - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3373](https://github.com/pmd/pmd/pull/3373): \[apex] Add ApexCRUDViolation support for database class, inline no-arg object construction DML and inline list initialization DML - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3385](https://github.com/pmd/pmd/pull/3385): \[core] CPD: Optimize --skip-lexical-errors option - [Woongsik Choi](https://github.com/woongsikchoi)
* [#3388](https://github.com/pmd/pmd/pull/3388): \[doc] Add Code Inspector in the list of tools - [Julien Delange](https://github.com/juli1)
* [#3417](https://github.com/pmd/pmd/pull/3417): \[core] Support forcing a specific language from the command-line - [Aidan Harding](https://github.com/aidan-harding)
### Stats
* 82 commits
* 29 closed tickets & PRs
* Days since last release: 35
## 26-June-2021 - 6.36.0
The PMD team is pleased to announce PMD 6.36.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Improved Incremental Analysis](#improved-incremental-analysis)
* [New rules](#new-rules)
* [Renamed rules](#renamed-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### Improved Incremental Analysis
[Incremental Analysis](https://pmd.github.io/pmd-6.36.0/pmd_userdocs_incremental_analysis.html) has long helped
our users obtain faster analysis results, however, its implementation tended to be too cautious in detecting
changes to the runtime and type resolution classpaths, producing more cache invalidations than necessary.
We have now improved the heuristics to remove several bogus invalidations, and slightly sped up the cache
usage along the way.
PMD will now ignore:
* Non class files in classpath and jar / zip files being referenced.
* Changes to the order of file entries within a jar / zip
* Changes to file metadata within jar / zip (ie: creation and modification time,
significant in multi-module / composite build projects where lateral artifacts are frequently recreated)
#### New rules
* The new Apex rule [`AvoidDebugStatements`](https://pmd.github.io/pmd-6.36.0/pmd_rules_apex_performance.html#avoiddebugstatements) finds usages of `System.debug` calls.
Debug statements contribute to longer transactions and consume Apex CPU time even when debug logs are not
being captured.
You can try out this rule like so:
```xml
PMD#doPMD
is deprecated.
Use PMD#runPMD
instead.
* PMD#run
is deprecated.
Use PMD#runPMD
instead.
* ThreadSafeReportListener
and the methods to use them in Report
(addListener
,
getListeners
, addListeners
)
are deprecated. This functionality will be replaced by another TBD mechanism in PMD 7.
### External Contributions
* [#3272](https://github.com/pmd/pmd/pull/3272): \[apex] correction for ApexUnitTestMethodShouldHaveIsTestAnnotation false positives - [William Brockhus](https://github.com/YodaDaCoda)
* [#3246](https://github.com/pmd/pmd/pull/3246): \[java] New Rule: MutableStaticState - [Vsevolod Zholobov](https://github.com/vszholobov)
* [#3247](https://github.com/pmd/pmd/pull/3247): \[java] New rule: JUnit5TestShouldBePackagePrivate - [Arnaud Jeansen](https://github.com/ajeans)
* [#3293](https://github.com/pmd/pmd/pull/3293): \[java] Cognitive Complexity Metric - [Denis Borovikov](https://github.com/borovikovd)
* [pmd.github.io#12](https://github.com/pmd/pmd.github.io/pull/12): Update quickstart.html - [Igor Lyadov](https://github.com/devigo)
### Stats
* 143 commits
* 53 closed tickets & PRs
* Days since last release: 34
## 24-April-2021 - 6.34.0
The PMD team is pleased to announce PMD 6.34.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [New rules](#new-rules)
* [Modified rules](#modified-rules)
* [Deprecated rules](#deprecated-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### New rules
* The new Java rule [`UseStandardCharsets`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_bestpractices.html#usestandardcharsets) finds usages of `Charset.forName`,
where `StandardCharsets` can be used instead.
This rule is also part of the Quickstart Ruleset (`rulesets/java/quickstart.xml`) for Java.
* The new Java rule [`UnnecessaryImport`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#unnecessaryimport) replaces the rules
[`UnusedImports`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_bestpractices.html#unusedimports), [`DuplicateImports`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#duplicateimports),
[`ImportFromSamePackage`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_errorprone.html#importfromsamepackage), and [`DontImportJavaLang`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#dontimportjavalang).
This rule is also part of the Quickstart Ruleset (`rulesets/java/quickstart.xml`) for Java.
#### Modified rules
* The Apex rule [`ApexCRUDViolation`](https://pmd.github.io/pmd-6.34.0/pmd_rules_apex_security.html#apexcrudviolation) does not ignore getters anymore and also flags
SOQL/SOSL/DML operations without access permission checks in getters. This will produce false positives now for
VF getter methods, but we can't reliably detect, whether a getter is a VF getter or not. In such cases,
the violation should be [suppressed](pmd_userdocs_suppressing_warnings.html).
#### Deprecated rules
* java-bestpractices
* [`UnusedImports`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_bestpractices.html#unusedimports): use the rule [`UnnecessaryImport`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#unnecessaryimport) instead
* java-codestyle
* [`DuplicateImports`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#duplicateimports): use the rule [`UnnecessaryImport`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#unnecessaryimport) instead
* [`DontImportJavaLang`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#dontimportjavalang): use the rule [`UnnecessaryImport`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#unnecessaryimport) instead
* java-errorprone
* [`ImportFromSamePackage`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_errorprone.html#importfromsamepackage): use the rule [`UnnecessaryImport`](https://pmd.github.io/pmd-6.34.0/pmd_rules_java_codestyle.html#unnecessaryimport) instead
### Fixed Issues
* apex-performance
* [#3198](https://github.com/pmd/pmd/pull/3198): \[apex] OperationWithLimitsInLoopRule: Support more limit consuming static method invocations
* apex-security
* [#3202](https://github.com/pmd/pmd/issues/3202): \[apex] ApexCRUDViolationRule fails to report CRUD violation on COUNT() queries
* [#3210](https://github.com/pmd/pmd/issues/3210): \[apex] ApexCRUDViolationRule false-negative on non-VF getter
* java-bestpractices
* [#3190](https://github.com/pmd/pmd/issues/3190): \[java] Use StandardCharsets instead of Charset.forName
* [#3224](https://github.com/pmd/pmd/issues/3224): \[java] UnusedAssignment crashes with nested records
* java-codestyle
* [#3128](https://github.com/pmd/pmd/issues/3128): \[java] New rule UnnecessaryImport, deprecate DuplicateImports, ImportFromSamePackage, UnusedImports
* java-errorprone
* [#2757](https://github.com/pmd/pmd/issues/2757): \[java] CloseResource: support Lombok's @Cleanup annotation
* [#3169](https://github.com/pmd/pmd/issues/3169): \[java] CheckSkipResult: NPE when using pattern bindings
### API Changes
No changes.
### External Contributions
* [#3193](https://github.com/pmd/pmd/pull/3193): \[java] New rule: UseStandardCharsets - [Andrea Aime](https://github.com/aaime)
* [#3198](https://github.com/pmd/pmd/pull/3198): \[apex] OperationWithLimitsInLoopRule: Support more limit consuming static method invocations - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3211](https://github.com/pmd/pmd/pull/3211): \[apex] ApexCRUDViolationRule: Do not assume method is VF getter to avoid CRUD checks - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3234](https://github.com/pmd/pmd/pull/3234): \[apex] ApexCRUDViolation: COUNT is indeed CRUD checkable since it exposes data (false-negative) - [Jonathan Wiesel](https://github.com/jonathanwiesel)
### Stats
* 74 commits
* 18 closed tickets & PRs
* Days since last release: 27
## 27-March-2021 - 6.33.0
The PMD team is pleased to announce PMD 6.33.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [PLSQL parsing exclusions](#plsql-parsing-exclusions)
* [Fixed Issues](#fixed-issues)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### PLSQL parsing exclusions
The PMD PLSQL parser might not parse every valid PL/SQL code without problems.
In order to still use PMD on such files, you can now mark certain lines for exclusion from
the parser. More information can be found in the [language specific documentation for PLSQL](pmd_languages_plsql.html).
### Fixed Issues
* apex-design
* [#3142](https://github.com/pmd/pmd/issues/3142): \[apex] ExcessiveClassLength multiple warning on the same class
* java
* [#3117](https://github.com/pmd/pmd/issues/3117): \[java] Infinite loop when parsing invalid code nested in lambdas
* [#3145](https://github.com/pmd/pmd/issues/3145): \[java] Parse exception when using "record" as variable name
* java-bestpractices
* [#3118](https://github.com/pmd/pmd/issues/3118): \[java] UnusedPrivateMethod false positive when passing in lombok.val as argument
* [#3144](https://github.com/pmd/pmd/issues/3144): \[java] GuardLogStatement can have more detailed example
* [#3155](https://github.com/pmd/pmd/pull/3155): \[java] GuardLogStatement: False negative with unguarded method call
* [#3160](https://github.com/pmd/pmd/issues/3160): \[java] MethodReturnsInternalArray does not consider static final fields and fields initialized with empty array
* java-errorprone
* [#2977](https://github.com/pmd/pmd/issues/2977): \[java] CloseResource: false positive with reassignment detection
* [#3146](https://github.com/pmd/pmd/issues/3146): \[java] InvalidLogMessageFormat detection failing when String.format used
* [#3148](https://github.com/pmd/pmd/issues/3148): \[java] CloseResource false positive with Objects.nonNull
* [#3165](https://github.com/pmd/pmd/issues/3165): \[java] InvalidLogMessageFormat detection failing when String.format used in a variable
* java-performance
* [#2427](https://github.com/pmd/pmd/issues/2427): \[java] ConsecutiveLiteralAppend false-positive with builder inside lambda
* [#3152](https://github.com/pmd/pmd/issues/3152): \[java] ConsecutiveLiteralAppends and InsufficientStringBufferDeclaration: FP with switch expressions
* plsql
* [#195](https://github.com/pmd/pmd/issues/195): \[plsql] Ampersand '&' causes PMD processing error in sql file - Lexical error in file
### External Contributions
* [#3161](https://github.com/pmd/pmd/pull/3161): \[plsql] Add support for lexical parameters in SQL*Plus scripts, allow excluding lines which the parser does not understand - [Henning von Bargen](https://github.com/hvbtup)
* [#3167](https://github.com/pmd/pmd/pull/3167): \[java] Minor typo in quickstart ruleset - [Austin Tice](https://github.com/AustinTice)
### Stats
* 49 commits
* 27 closed tickets & PRs
* Days since last release: 28
## 27-February-2021 - 6.32.0
The PMD team is pleased to announce PMD 6.32.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Java 16 Support](#java-16-support)
* [Modified Rules](#modified-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Experimental APIs](#experimental-apis)
* [Internal API](#internal-api)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### Java 16 Support
This release of PMD brings support for Java 16. PMD supports [JEP 394: Pattern Matching for instanceof](https://openjdk.java.net/jeps/394) and [JEP 395: Records](https://openjdk.java.net/jeps/395). Both have been promoted
to be a standard language feature of Java 16.
PMD also supports [JEP 397: Sealed Classes (Second Preview)](https://openjdk.java.net/jeps/397) as a preview
language feature. In order to analyze a project with PMD that uses these language features, you'll need to enable
it via the environment variable `PMD_JAVA_OPTS` and select the new language version `16-preview`:
export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd -language java -version 16-preview ...
Note: Support for Java 14 preview language features have been removed. The version "14-preview" is no longer available.
#### Modified Rules
* The Apex rule [`ApexDoc`](https://pmd.github.io/pmd-6.32.0/pmd_rules_apex_documentation.html#apexdoc) has two new properties: `reportPrivate` and
`reportProtected`. Previously the rule only considered public and global classes, methods, and
properties. With these properties, you can verify the existence of ApexDoc comments for private
and protected methods as well. By default, these properties are disabled to preserve backwards
compatible behavior.
### Fixed Issues
* apex-documentation
* [#3075](https://github.com/pmd/pmd/issues/3075): \[apex] ApexDoc should support private access modifier
* java
* [#3101](https://github.com/pmd/pmd/issues/3101): \[java] NullPointerException when running PMD under JRE 11
* java-bestpractices
* [#3132](https://github.com/pmd/pmd/issues/3132): \[java] UnusedImports with static imports on subclasses
* java-errorprone
* [#2716](https://github.com/pmd/pmd/issues/2716): \[java] CompareObjectsWithEqualsRule: False positive with Enums
* [#3089](https://github.com/pmd/pmd/issues/3089): \[java] CloseResource rule throws exception on spaces in property types
* [#3133](https://github.com/pmd/pmd/issues/3133): \[java] InvalidLogMessageFormat FP with StringFormattedMessage and ParameterizedMessage
* plsql
* [#3106](https://github.com/pmd/pmd/issues/3106): \[plsql] ParseException while parsing EXECUTE IMMEDIATE 'drop database link ' \|\| linkname;
### API Changes
#### Experimental APIs
* The experimental class `ASTTypeTestPattern` has been renamed to ASTTypePattern
in order to align the naming to the JLS.
* The experimental class `ASTRecordConstructorDeclaration` has been renamed to ASTCompactConstructorDeclaration
in order to align the naming to the JLS.
* The AST types and APIs around Pattern Matching and Records are not experimental anymore:
* ASTVariableDeclaratorId#isPatternBinding
* ASTPattern
* ASTTypePattern
* ASTRecordDeclaration
* ASTRecordComponentList
* ASTRecordComponent
* ASTRecordBody
* ASTCompactConstructorDeclaration
#### Internal API
Those APIs are not intended to be used by clients, and will be hidden or removed with PMD 7.0.0.
You can identify them with the `@InternalApi` annotation. You'll also get a deprecation warning.
* The protected or public member of the Java rule AvoidUsingHardCodedIPRule
are deprecated and considered to be internal API. They will be removed with PMD 7.
### External Contributions
* [#3098](https://github.com/pmd/pmd/pull/3098): \[apex] ApexDoc optionally report private and protected - [Jonathan Wiesel](https://github.com/jonathanwiesel)
* [#3107](https://github.com/pmd/pmd/pull/3107): \[plsql] Fix ParseException for EXECUTE IMMEDIATE str1\|\|str2; - [hvbtup](https://github.com/hvbtup)
* [#3125](https://github.com/pmd/pmd/pull/3125): \[doc] Fix sample code indentation in documentation - [Artur Dryomov](https://github.com/arturdryomov)
### Stats
* 43 commits
* 21 closed tickets & PRs
* Days since last release: 27
## 30-January-2021 - 6.31.0
The PMD team is pleased to announce PMD 6.31.0.
This is a minor release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [SARIF Format](#sarif-format)
* [CPD](#cpd)
* [New Rules](#new-rules)
* [Deprecated rules](#deprecated-rules)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [Deprecated API](#deprecated-api)
* [Experimental APIs](#experimental-apis)
* [External Contributions](#external-contributions)
* [Stats](#stats)
### New and noteworthy
#### SARIF Format
PMD now supports the [Static Analysis Results Interchange Format (SARIF)](https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=sarif)
as an additional report format. Just use the [command line parameter](pmd_userdocs_cli_reference.html#format) `-format sarif` to select it.
SARIF is an OASIS standard format for static analysis tools.
PMD creates SARIF JSON files in [SARIF version 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html).
An example report can be found in the documentation in [Report formats for PMD](pmd_userdocs_report_formats.html#sarif).
#### CPD
* The C++ module now supports the new option [`--ignore-literal-sequences`](https://pmd.github.io/latest/pmd_userdocs_cpd.html#-ignore-literal-sequences),
which can be used to avoid detection of some uninteresting clones. This options has been
introduced with PMD 6.30.0 for C# and is now available for C++ as well. See [#2963](https://github.com/pmd/pmd/pull/2963).
#### New Rules
* The new Apex rule [`OverrideBothEqualsAndHashcode`](https://pmd.github.io/pmd-6.31.0/pmd_rules_apex_errorprone.html#overridebothequalsandhashcode) brings the well known Java rule
to Apex. In Apex the same principle applies: `equals` and `hashCode` should always be overridden
together to ensure collection classes such as Maps and Sets work as expected.
* The new Visualforce rule [`VfHtmlStyleTagXss`](https://pmd.github.io/pmd-6.31.0/pmd_rules_vf_security.html#vfhtmlstyletagxss) checks for potential XSS problems
when using `