Skip to content

Releases: pmd/pmd

PMD 7.0.0 (22-March-2024)

22 Mar 09:08
pmd_releases/7.0.0
7979570
Compare
Choose a tag to compare

22-March-2024 - 7.0.0

🎉 After a long time, we're excited to bring you now 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.

🤝🙏 Many thanks to all users and contributors who were testing the release candidates and
provided feedback and/or PRs!

✨ PMD 7...

  • ...has a new logo
  • ...analyzes Java 21 and Java 22 projects with even better type resolution and symbol table support
  • ...analyzes Kotlin and Swift
  • ...analyzes Apex with a new parser
  • ...finds duplicated code in Coco, Julia, TypeScript
  • ...ships 11 new rules and tons of improvements for existing rules
  • ...provides a new CLI interface with progress bar
  • ...supports Antlr based languages
  • ...and many more enhancements

💥 Note: Since PMD 7 is a major release, it is not a drop-in replacement for PMD 6.55.0.
A detailed documentation of required changes are available in the Migration Guide for PMD 7.

Expand to see Release Notes

Table Of Contents

Changes since 7.0.0-rc4

This section lists the most important changes from the last release candidate.
The remaining section describes the complete release notes for 7.0.0.

New and Noteworthy

Maven PMD Plugin compatibility with PMD 7

In order to use PMD 7 with maven-pmd-plugin a new
compatibility module has been created. This allows to use PMD 7 by simply adding one additional dependency:

  1. Follow the guide Upgrading PMD at Runtime
  2. Add additionally the following dependency:
<dependency>
  <groupId>net.sourceforge.pmd</groupId>
  <artifactId>pmd-compat6</artifactId>
  <version>${pmdVersion}</version>
</dependency>

It is important to add this dependency as the first in the list, so that maven-pmd-plugin sees the (old)
compatible versions of some classes.

This module is available beginning with version 7.0.0-rc4 and will be there at least for the first
final version PMD 7 (7.0.0). It's not decided yet, whether we will keep updating it, after PMD 7 is finally
released.

Note: This compatibility module only works for the built-in rules, that are still available in PMD 7. E.g. you need
to review your rulesets and look out for deprecated rules and such. See the use case
I'm using only built-in rules
in the Migration Guide for PMD 7.

As PMD 7 revamped the Java module, if you have custom rules, you need to migrate these rules.
See the use case I'm using custom rules
in the Migration Guide.

Note: Once the default version of PMD is upgraded to PMD7 in maven-pmd-plugin
(see MPMD-379), this
compatibility module is no longer needed. The module pmd-compat6 might not be maintained then
any further, hence it is already declared as deprecated.

No guarantee is given, that the (deprecated) module pmd-compat6 is being maintained over the
whole lifetime of PMD 7.

Java 22 Support

This release of PMD brings support for Java 22. There are the following new standard language features,
that are supported now:

PMD also supports the following 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 22-preview:

export PMD_JAVA_OPTS=--enable-preview
pmd check --use-version java-22-preview ...

Note: Support for Java 20 preview language features have been removed. The version "20-preview" is no longer available.

Swift Support
  • limited support for Swift 5.9 (Macro Expansions)
Groovy Support (CPD)
  • We now support parsing all Groovy features from Groovy 3 and 4.
  • We now support suppression through CPD-ON/CPD-OFF comment pairs.
  • See PR #4726 for details.
Updated PMD Designer

This PMD release ships a new version of the pmd-designer. The designer artifact has been
renamed from "pmd-ui" to "pmd-designer". While the designer still works with Java 8, the
recommended Java Runtime is Java 11 (or later) with OpenJFX 17 (or later).

For the detailed changes, see PMD Designer Changelog (7.0.0).

Apex Support: Replaced Jorje with fully open source front-end

When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source
and generate an AST. This library is however a binary-blob provided as part of the
Salesforce Extensions for VS Code, and it is closed-source.

This causes problems, if binary blobs are not allowed by e.g. a company-wide policy. In that case, the Jorje
library prevented that PMD Apex could be used at all.

Also having access to the source code, enhancements and modifications are easier to do.

Under the hood, we use two open source libraries instead:

  • apex-parser originally by
    Kevin Jones (@nawforce).
    This project provides the grammar for a ANTLR based parser.
  • Summit-AST by Google (@google)
    This project translates the ANTLR parse tree into an AST, that is similar to the AST Jorje provided.
    Note: This is not an official Google product.

Although the parser is completely switched, there are only little known changes to the AST.
These are documented in the Migration Guide for PMD 7: Apex AST.

With the new Apex parser, the new language constructs like
[User Mode Database Operations...

Read more

PMD 7.0.0-rc4 (30-September-2023)

30 Sep 17:53
pmd_releases/7.0.0-rc4
720b9a3
Compare
Choose a tag to compare

30-September-2023 - 7.0.0-rc4

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.

ℹ️ Release Candidates

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.

Expand to see Release Notes

Table Of Contents

Changes since 7.0.0-rc3

This section lists the most important changes from the last release candidate.
The remaining section describes the complete release notes for 7.0.0.

New and Noteworthy

Migration Guide for PMD 7

A detailed documentation of required changes are available in the
Migration Guide for PMD 7.

Apex Jorje Updated

With the new version of Apex Jorje, the new language constructs like User Mode Database Operations
can be parsed now. PMD should now be able to parse Apex code up to version 59.0 (Winter '23).

Java 21 Support

This release of PMD brings support for Java 21. There are the following new standard language features,
that are supported now:

PMD also supports the following 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 21-preview:

export PMD_JAVA_OPTS=--enable-preview
pmd check --use-version java-21-preview ...

Note: Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available.

Fixed issues

  • miscellaneous
    • #4582: [dist] Download link broken
    • #4691: [CVEs] Critical and High CEVs reported on PMD and PMD dependencies
  • core
    • #1204: [core] Allow numeric properties in XML to be within an unbounded range
    • #3919: [core] Merge CPD and PMD language
    • #4204: [core] Provide a CpdAnalysis class as a programmatic entry point into CPD
    • #4301: [core] Remove deprecated property concrete classes
    • #4302: [core] Migrate Property Framework API to Java 8
    • #4323: [core] Refactor CPD integration
    • #4397: [core] Refactor CPD
    • #4611: [core] Fix loading language properties from env vars
    • #4621: [core] Make ClasspathClassLoader::getResource child first
  • cli
    • #4423: [cli] Fix NPE when only --file-list is specified
  • doc
    • #4294: [doc] Migration Guide for upgrading PMD 6 ➡️ 7
    • #4303: [doc] Document new property framework
    • #4521: [doc] Website is not mobile friendly
  • apex
    • #3973: [apex] Update parser to support new 'as user' keywords (User Mode for Database Operations)
    • #4453: [apex] [7.0-rc1] Exception while initializing Apexlink (Index 34812 out of bounds for length 34812)
  • apex-design
    • #4596: [apex] ExcessivePublicCount ignores properties
  • apex-security
    • #4646: [apex] ApexSOQLInjection does not recognise SObjectType or SObjectField as safe variable types
  • java
    • #4401: [java] PMD 7 fails to build under Java 19
    • #4583: [java] Support JDK 21 (LTS)
  • java-bestpractices
    • #4634: [java] JUnit4TestShouldUseTestAnnotation false positive with TestNG

API Changes

pmd-java
  • Support for Java 19 preview language features have been removed. The version "19-preview" is no longer available.
Rule properties
  • The old deprecated classes like IntProperty and StringProperty have been removed. Please use
    PropertyFactory to create properties.
  • All properties which accept multiple values now use a comma (,) as a delimiter. The previous default was a
    pipe character (|). The delimiter is not configurable anymore. If needed, the comma can be escaped
    with a backslash.
  • The min and max attributes in property definitions in the XML are now optional and can appear separately
    or be omitted.
New Programmatic API for CPD

See Detailed Release Notes for PMD 7
and PR #4397 for details.

Removed classes and methods

The following previously deprecated classes have been removed:

  • pmd-core
    • net.sourceforge.pmd.cpd.AbstractTokenizer ➡️ use AnyTokenizer instead
    • net.sourceforge.pmd.cpd.CPD ➡️ use PmdCli from pmd-cli module for CLI support or use
      CpdAnalysis for programmatic API
    • net.sourceforge.pmd.cpd.GridBagHelper (now package private)
      ...
Read more

PMD 7.0.0-rc3 (30-May-2023)

30 May 18:44
pmd_releases/7.0.0-rc3
7d6d303
Compare
Choose a tag to compare

30-May-2023 - 7.0.0-rc3

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.

ℹ️ Release Candidates

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.

Expand to see Release Notes

Table Of Contents

Changes since 7.0.0-rc2

This section lists the most important changes from the last release candidate.
The remaining section describes the complete release notes for 7.0.0.

New CPD report format cpdhtml-v2.xslt

Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table.
It uses an XSLT stylesheet to convert CPD's XML format into HTML.

See the example report.

Fixed issues

  • miscellaneous
    • #4460: Fix assembly-plugin warnings
  • core
    • #4425: [core] Replace TextFile::pathId
    • #4454: [core] "Unknown option: '-min'" but is referenced in documentation
  • java-bestpractices
    • #4433: [java] [7.0-rc1] ReplaceHashtableWithMap on java.util.Properties
    • #4492: [java] GuardLogStatement gives false positive when argument is a Java method reference
    • #4503: [java] JUnitTestsShouldIncludeAssert: false negative with TestNG
  • java-codestyle
    • #4268: [java] CommentDefaultAccessModifier: false positive with TestNG annotations
    • #4432: [java] [7.0-rc1] UnnecessaryImport - Unused static import is being used
    • #4455: [java] FieldNamingConventions: false positive with lombok's @UtilityClass
    • #4557: [java] UnnecessaryImport FP with static imports of overloaded methods
  • java-design
    • #4434: [java] [7.0-rc1] ExceptionAsFlowControl when simply propagating
    • #4456: [java] FinalFieldCouldBeStatic: false positive with lombok's @UtilityClass
    • #4549: [java] Make LawOfDemeter results deterministic
  • java-errorprone
    • #4063: [java] AvoidBranchingStatementAsLastInLoop: False-negative about try/finally block
    • #4457: [java] OverrideBothEqualsAndHashcode: false negative with anonymous classes
    • #4510: [java] ConstructorCallsOverridableMethod: false positive with lombok's @Value
    • #4546: [java] OverrideBothEqualsAndHashCode ignores records
  • java-performance
    • #4458: [java] RedundantFieldInitializer: false positive with lombok's @Value

API Changes

  • The following previously deprecated classes have been removed:

    • pmd-core
      • net.sourceforge.pmd.PMD
      • net.sourceforge.pmd.cli.PMDCommandLineInterface
      • net.sourceforge.pmd.cli.PMDParameters
      • net.sourceforge.pmd.cli.PmdParametersParseResult
  • The asset filenames of PMD on GitHub Releases are
    now pmd-dist-<version>-bin.zip, pmd-dist-<version>-src.zip and pmd-dist-<version>-doc.zip.
    Keep that in mind, if you have an automated download script.

    The structure inside the ZIP files stay the same, e.g. we still provide inside the binary distribution
    ZIP file the base directory pmd-bin-<version>.

  • The CLI option --stress (or -stress) has been removed without replacement.

  • The CLI option --minimum-priority was changed with 7.0.0-rc1 to only take the following values:
    High, Medium High, Medium, Medium Low, Low. With 7.0.0-rc2 compatibility has been restored, so that the equivalent
    integer values (1 to 5) are supported as well.

  • Replaced RuleViolation::getFilename with new RuleViolation#getFileId, that returns a
    FileId. This is an identifier for a TextFile
    and could represent a path name. This allows to have a separate display name, e.g. renderers use
    FileNameRenderer to either display the full path name or a relative path name
    (see Renderer#setFileNameRenderer and
    ConfigurableFileNameRenderer). Many places where we used a simple String for
    a path-like name before have been adapted to use the new FileId.

    See PR #4425 for details.

External Contributions

Read more

PMD 7.0.0-rc2 (29-April-2023)

29 Apr 22:03
pmd_releases/7.0.0-rc2
a97e108
Compare
Choose a tag to compare

29-April-2023 - 7.0.0-rc2

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.

ℹ️ Release Candidates

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.

Expand to see Release Notes

Table Of Contents

Changes since 7.0.0-rc1

This section lists the most important changes from the last release candidate.
The remaining section describes the complete release notes for 7.0.0.

API Changes

  • Moved the two classes AntlrTokenizer and JavaCCTokenizer from
    internal package into package net.sourceforge.pmd.cpd.impl. These two classes are part of the API and
    are base classes for CPD language implementations.
  • AntlrBaseRule is gone in favor of AbstractVisitorRule.
  • The classes KotlinInnerNode and SwiftInnerNode
    are package-private now.
  • The parameter order of addSourceFile has been swapped
    in order to have the same meaning as in 6.55.0. That will make it easier if you upgrade from 6.55.0 to 7.0.0.
    However, that means, that you need to change these method calls if you have migrated to 7.0.0-rc1 already.

Updated PMD Designer

This PMD release ships a new version of the pmd-designer.
For the changes, see PMD Designer Changelog.

Language Related Changes

  • New: CPD support for TypeScript
  • New: CPD support for Julia

Rule Changes

  • ImmutableField: the property ignoredAnnotations has been removed. The property was
    deprecated since PMD 6.52.0.
  • SwitchDensity: the type of the property minimum has been changed from decimal to integer
    for consistency with other statistical rules.

Fixed Issues

  • cli
    • #4482: [cli] pmd.bat can only be executed once
    • #4484: [cli] ast-dump with no properties produce an NPE
  • core
    • #2500: [core] Clarify API for ANTLR based languages
  • doc
    • #2501: [doc] Verify ANTLR Documentation
    • #4438: [doc] Documentation links in VS Code are outdated
  • java-codestyle
    • #4273: [java] CommentDefaultAccessModifier ignoredAnnotations should include "org.junit.jupiter.api.extension.RegisterExtension" by default
    • #4487: [java] UnnecessaryConstructor: false-positive with @Inject and @Autowired
  • java-design
    • #4254: [java] ImmutableField - false positive with Lombok @Setter
    • #4477: [java] SignatureDeclareThrowsException: false-positive with TestNG annotations
    • #4490: [java] ImmutableField - false negative with Lombok @Getter
  • java-errorprone
    • #4449: [java] AvoidAccessibilityAlteration: Possible false positive in AvoidAccessibilityAlteration rule when using Lambda expression
    • #4493: [java] MissingStaticMethodInNonInstantiatableClass: false-positive about @Inject
    • #4505: [java] ImplicitSwitchFallThrough NPE in PMD 7.0.0-rc1
  • java-multithreading
    • #4483: [java] NonThreadSafeSingleton false positive with double-checked locking
  • miscellaneous
    • #4462: Provide Software Bill of Materials (SBOM)

External contributions

🚀 Major Features and Enhancements

New official logo

The new official logo of PMD:

New PMD Logo

Revamped Java module

  • Java grammar substantially refactored - more correct regarding the Java Language Specification (JLS)
  • Built-in rules have been upgraded for the changed AST
  • Rewritten type resolution framework and symbol table correctly implements the JLS
  • AST exposes more semantic information (method calls, field accesses)

For more ...

Read more

PMD 7.0.0-rc1 (25-March-2023)

25 Mar 13:46
pmd_releases/7.0.0-rc1
356af8b
Compare
Choose a tag to compare

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.

ℹ️ Release Candidates

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.

Expand to see Release Notes

Table Of Contents

🚀 Major Features and Enhancements

New official logo

The new official logo of PMD:

New PMD Logo

Revamped Java module

  • Java grammar substantially refactored - more correct regarding the Java Language Specification (JLS)
  • Built-in rules have been upgraded for the changed AST
  • Rewritten type resolution framework and symbol table correctly implements the JLS
  • AST exposes more semantic information (method calls, field accesses)

For more information, see the Detailed Release Notes for PMD 7.

Contributors: Clément Fournier (@oowekyala),
Andreas Dangel (@adangel),
Juan Martín Sotuyo Dodero (@jsotuyod)

Revamped Command Line Interface

  • unified and consistent Command Line Interface for both Linux/Unix and Windows across our different utilities
  • single script pmd (pmd.bat for Windows) to launch the different utilities:
    • pmd check to run PMD rules and analyze a project
    • pmd cpd to run CPD (copy paste detector)
    • pmd designer to run the PMD Rule Designer
  • progress bar support for pmd check
  • shell completion

Demo

For more information, see the Detailed Release Notes for PMD 7.

Contributors: Juan Martín Sotuyo Dodero (@jsotuyod)

Full Antlr support

  • Antlr based grammars can now be used to build full-fledged PMD rules.
  • Previously, Antlr grammar could only be used for CPD
  • New supported languages: Swift and Kotlin

For more information, see the Detailed Release Notes for PMD 7.

Contributors: Lucas Soncini (@lsoncini),
Matías Fraga (@matifraga),
Tomás De Lucca (@tomidelucca)

🎉 Language Related Changes

Note that this is just a concise listing of the highlight.
For more information on the languages, see the Detailed Release Notes for PMD 7.

New: Swift support

  • use PMD to analyze Swift code with PMD rules
  • initially 4 built-in rules

Contributors: Lucas Soncini (@lsoncini),
Matías Fraga (@matifraga),
Tomás De Lucca (@tomidelucca)

New: Kotlin support (experimental)

  • use PMD to analyze Kotlin code with PMD rules
  • Support for Kotlin 1.8 grammar
  • initially 2 built-in rules

Changed: JavaScript support

  • latest version supports ES6 and also some new constructs (see Rhino])
  • comments are retained

Changed: Language versions

  • more predefined language versions for each supported language
  • can be used to limit rule execution for specific versions only with minimumLanguageVersion and
    maximumLanguageVersion attributes.

🌟 New and changed rules

New Rules

Apex

Java

  • UnnecessaryBoxing reports boxing and unboxing conversions that may be made implicit.

Kotlin

Swift

Changed Rules

Java

  • UnnecessaryFullyQualifiedName: the rule has two new properties,
    to selectively disable reporting on static field and method qualifiers. The rule also has been improved
    to be more precise.
  • UselessParentheses: the rule has two new properties which control how strict
    the rule should be applied. With ignoreClarifying (default: true) parentheses that are strictly speaking
    not necessary are allowed, if they separate expressions of different precedence.
    The other property ignoreBalancing (default: true) is similar, in that it allows parentheses that help
    reading and understanding the expressions.
  • LooseCoupling: the rule has a new property to allow some types to be coupled
    to (allowedTypes).
  • EmptyCatchBlock: CloneNotSupportedException and InterruptedException are not
    special-cased anymore. Rename the exception parameter to ignored to ignore them.
  • DontImportSun: sun.misc.Signal is not special-cased anymore.
  • UseDiamondOperator: the property java7Compatibility is removed. The rule now
    handles Java 7 properly without a property.
  • SingularField: Properties checkInnerClasses and disallowNotAssignment are removed.
    The rule is now more precise and will check these cases properly.
  • UseUtilityClass: The property ignoredAnnotations has been removed.
  • LawOfDemeter: the rule has a new property trustRadius. This defines the maximum degree
    of trusted data. The default of 1 is the most restrictive.
  • CommentContent: The properties caseSensitive and disallowedTerms are removed. The
    new property fobiddenRegex can be used now to define the disallowed terms with a single regular
    expression.

Removed Rules

Many rules, that were previously deprecated have been finally removed.
See Detailed Release Notes for PMD 7 for the complete list.

🚨 API

The API of PMD has been growing over the years and needed some cleanup. The goal is, to
have a clear separation between a well-defined API and the implementation, which is internal.
This should help us in future development.

Also, there are some improvement and changes in different areas. For the ...

Read more

PMD 6.55.0 (25-February-2023)

25 Feb 11:12
pmd_releases/6.55.0
ef34553
Compare
Choose a tag to compare

25-February-2023 - 6.55.0

The PMD team is pleased to announce PMD 6.55.0.

This is a minor release.

Table Of Contents

New and noteworthy

PMD 7 Development

This release is the last planned release of PMD 6. The first version 6.0.0 was released in December 2017.
Over the course of more than 5 years we published almost every month a new minor version of PMD 6
with new features and improvements.

Already in November 2018 we started in parallel the development of the next major version 7.0.0,
and we are now in the process of finalizing the scope of the major version. We want to release a couple of
release candidates before publishing the final version 7.0.0.

We plan to release 7.0.0-rc1 soon. You can see the progress in PMD 7 Tracking Issue #3898.

Java 20 Support

This release of PMD brings support for Java 20. There are no new standard language features.

PMD supports JEP 433: Pattern Matching for switch (Fourth Preview) and
JEP 432: Record Patterns (Second Preview) 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 20-preview:

export PMD_JAVA_OPTS=--enable-preview
./run.sh pmd --use-version java-20-preview ...

T-SQL support

Thanks to the contribution from Paul Guyot PMD now has CPD support
for T-SQL (Transact-SQL).

Being based on a proper Antlr grammar, CPD can:

Fixed Issues

  • core
    • #4395: [core] Support environment variable CLASSPATH with pmd.bat under Windows
  • java
    • #4333: [java] Support JDK 20
  • java-errorprone
    • #4393: [java] MissingStaticMethodInNonInstantiatableClass false-positive for Lombok's @UtilityClass for classes with non-private fields

API Changes

Go

  • The LanguageModule of Go, that only supports CPD execution, has been deprecated. This language
    is 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 class has been deprecated and will be removed with PMD 7.0.0:

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

Stats

  • 40 commits
  • 11 closed tickets & PRs
  • Days since last release: 28

PMD 6.54.0 (28-January-2023)

28 Jan 13:13
pmd_releases/6.54.0
de1b12b
Compare
Choose a tag to compare

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 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.

Fixed Issues

  • apex-bestpractices
    • #2669: [apex] UnusedLocalVariable false positive in dynamic SOQL
  • core
    • #4026: [cli] Filenames printed as absolute paths in the report despite parameter --short-names
    • #4279: [core] Can not set ruleset property value to empty
    • #4329: [core] Refactor usage of snakeyaml
    • #4340: [core] Allow to filter found matches in CPDReport
  • java
    • #4364: [java] Parsing error with textblock containing quote followed by two backslashes
  • testing
    • #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
Internal APIs
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

Stats

  • 107 commits
  • 19 closed tickets & PRs
  • Days since last release: 27

PMD 6.53.0 (31-December-2022)

31 Dec 17:40
pmd_releases/6.53.0
3710345
Compare
Choose a tag to compare

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

Modified rules

  • The Java rule 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

Fixed Issues

  • core
    • #4248: [core] Can't analyze sources in zip files
  • apex-security
    • #4146: [apex] ApexCRUDViolation: Recognize User Mode in SOQL + DML
  • java
    • #4266: [java] PMD fails to process a record with lambda in compact constructor
  • java-bestpractices
    • #4166: [java] UnusedPrivateField doesn't find annotated unused private fields anymore
    • #4250: [java] WhileLoopWithLiteralBoolean - false negative with complex expressions still occurs in PMD 6.52.0
  • java-design
    • #2127: [java] Deprecate rules ExcessiveClassLength and ExcessiveMethodLength
  • java-errorprone
    • #4164: [java][doc] AvoidAssertAsIdentifier and AvoidEnumAsIdentifier - clarify use case
  • java-multithreading
    • #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.

External Contributions

Stats

  • 43 commits
  • 17 closed tickets & PRs
  • Days since last release: 35

PMD 6.52.0 (26-November-2022)

26 Nov 09:47
pmd_releases/6.52.0
e90bf0f
Compare
Choose a tag to compare

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 rules

<rule ref="category/java/design.xml/InvalidJavaBean"/>

Renamed rules

  • The Java rule BeanMembersShouldSerialize has been renamed to
    NonSerializableClass. It has been revamped to only check for classes that are marked with
    Serializable and reports each field in it, that is not serializable.

    The property prefix has been deprecated, since in a serializable class all fields have to be
    serializable regardless of the name.

Modified rules

  • The rule ClassNamingConventions has a new property testClassPattern, which is applied
    to test classes. By default, test classes should end with the suffix "Test". Test classes are top-level classes, that
    either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from
    JUnit4/5 or TestNG.

  • The property ignoredAnnotations of rule ImmutableField has been deprecated and doesn't
    have any effect anymore.
    Since PMD 6.47.0, the rule only considers fields, that are initialized once and never changed. If the field is just
    declared but never explicitly initialized, it won't be reported. That's the typical case when a framework sets
    the field value by reflection. Therefore, the property is not needed anymore. If there is a special case where
    this rule misidentifies fields as immutable, then the rule should be suppressed for these fields explicitly.

Fixed Issues

  • cli
    • #4215: NullPointerException when trying to open designer
  • doc
    • #4207: [doc] List all languages in rule doc
  • java
    • #3643: [java] More parser edge cases
    • #4152: [java] Parse error on array type annotations
  • java-codestyle
    • #2867: [java] Separate pattern for test classes in ClassNamingConventions rule for Java
    • #4201: [java] CommentDefaultAccessModifier should consider lombok's @Value
  • java-design
    • #4175: [java] ImmutableField - deprecate property ignoredAnnotations
    • #4177: [java] New Rule InvalidJavaBean
    • #4188: [java] ClassWithOnlyPrivateConstructorsShouldBeFinal false positive with Lombok's @NoArgsConstructor
    • #4189: [java] AbstractClassWithoutAnyMethod should consider lombok's @AllArgsConstructor
    • #4200: [java] ClassWithOnlyPrivateConstructorsShouldBeFinal should consider lombok's @Value
  • java-errorprone
    • #1668: [java] BeanMembersShouldSerialize is extremely noisy
    • #4172: [java] InvalidLogMessageFormat false positive on externally formatted strings
    • #4174: [java] MissingStaticMethodInNonInstantiatableClass does not consider nested builder class
    • #4176: [java] Rename BeanMembersShouldSerialize to NonSerializableClass
    • #4185: [java] InvalidLogMessageFormat rule produces a NPE
    • #4224: [java] MissingStaticMethodInNonInstantiatableClass should consider Lombok's @UtilityClass
    • #4225: [java] MissingStaticMethodInNonInstantiatableClass should consider Lombok's @NoArgsConstructor
  • java-performance
    • #4183: [java] AvoidArrayLoops regression: from false negative to false positive with final variables

API Changes

PMD CLI

  • PMD now supports a new --use-version flag, which receives a language-version pair (such as java-8 or apex-54).
    This supersedes the usage of -language / -l and -version / -v, allowing for multiple versions to be set in a single run.
    PMD 7 will completely remove support for -language and -version in favor of this new flag.

  • Support for -V is being deprecated in favor of --verbose in preparation for PMD 7.
    In PMD 7, -v will enable verbose mode and -V will show the PMD version for consistency with most Unix/Linux tools.

  • Support for -min is being deprecated in favor of --minimum-priority for consistency with most Unix/Linux tools, where -min would be equivalent to -m -i -n.

CPD CLI

  • CPD now supports using -d or --dir as an alias to --files, in favor of consistency with PMD.
    PMD 7 will remove support for --files in favor of these new flags.

Linux run.sh parameters

  • Using run.sh cpdgui will now warn about it being deprecated. Use run.sh cpd-gui instead.

  • The old designer (run.sh designerold) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: run.sh designer.

  • The old visual AST viewer (run.sh bgastviewer) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: run.sh designer for a visual tool, or use run.sh ast-dump for a text-based alternative.

Deprecated API

Read more

PMD 6.51.0 (29-October-2022)

29 Oct 07:50
pmd_releases/6.51.0
66e8340
Compare
Choose a tag to compare

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 Rules

<rule ref="category/apex/bestpractices.xml/ApexUnitTestClassShouldHaveRunAs"/>

The rule is part of the quickstart.xml ruleset.

Modified Rules

  • The Java rule TestClassWithoutTestCases has a new property testClassPattern. This is
    used to detect empty test classes by name. Previously this rule could only detect empty JUnit3 test cases
    properly. To switch back to the old behavior, this property can be set to an empty value which disables the
    test class detection by pattern.

Fixed Issues

  • apex
    • #4149: [apex] New rule: ApexUnitTestClassShouldHaveRunAs
  • doc
    • #4144: [doc] Update docs to reflect supported languages
    • #4163: [doc] Broken links on page "Architecture Decisions"
  • java-bestpractices
    • #4140: [java] [doc] AccessorClassGeneration violations hidden with Java 11
  • java-codestyle
    • #4139: [java] UnnecessaryFullyQualifiedName FP when the same simple class name exists in the current package
  • java-documentation
    • #4141: [java] UncommentedEmptyConstructor FP when constructor annotated with @Autowired
  • java-performance
    • #1167: [java] AvoidArrayLoops false positive on double assignment
    • #2080: [java] StringToString rule false-positive with field access
    • #2692: [java] [doc] AvoidArrayLoops flags copy assignment in same array as sub-optimal
    • #3437: [java] StringToString doesn't trigger on Bar.class.getSimpleName().toString()
    • #3681: [java] StringToString doesn't trigger on string literals
    • #3847: [java] AvoidArrayLoops should consider final variables
    • #3977: [java] StringToString false-positive with local method name confusion
    • #4091: [java] AvoidArrayLoops false negative with do-while loops
    • #4148: [java] UseArrayListInsteadOfVector ignores Vector when other classes are imported
  • java-errorprone
    • #929: [java] Inconsistent results with TestClassWithoutTestCases
    • #2636: [java] TestClassWithoutTestCases false positive with JUnit5 ParameterizedTest
  • javascript
    • #4165: [javascript] InaccurateNumericLiteral underscore separator notation false positive

API Changes

No changes.

External Contributions

Stats

  • 63 commits
  • 28 closed tickets & PRs
  • Days since last release: 28