PMD 6.45.0 released

30 April 2022

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

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

Thank you!

Support for HTML

This version of PMD ships a new language module to support analyzing of HTML. Support for HTML is experimental and might change without notice. The language implementation is not complete yet and the AST doesn’t look well for text nodes and comment nodes and might be changed in the future. You can write your own rules, but we don’t guarantee that the rules work with the next (minor) version of PMD without adjustments.

Please give us feedback about how practical this new language is in discussions. Please report missing features or bugs as new issues.

New rules

  • The HTML rule AvoidInlineStyles finds elements which use a style attribute. In order to help maintaining a webpage it is considered good practice to separate content and styles. Instead of inline styles one should use CSS files and classes.
    <rule ref="category/html/bestpractices.xml/AvoidInlineStyles" />
  • The HTML rule UnnecessaryTypeAttribute finds “link” and “script” elements which still have a “type” attribute. This is not necessary anymore since modern browsers automatically use CSS and JavaScript.
      <rule ref="category/html/bestpractices.xml/UnnecessaryTypeAttribute" />
  • The HTML rule UseAltAttributeForImages finds “img” elements without an “alt” attribute. An alternate text should always be provided in order to help screen readers.
      <rule ref="category/html/bestpractices.xml/UseAltAttributeForImages" />

Modified rules

  • The Java rule UnusedPrivateField has a new property ignoredFieldNames. The default ignores serialization-specific fields (eg serialVersionUID). The property can be used to ignore more fields based on their name. Note that the rule used to ignore fields named IDENT, but doesn’t anymore (add this value to the property to restore the old behaviour).

Fixed Issues

  • core
    • #3792: [core] Allow to filter violations in Report
    • #3881: [core] SARIF renderer depends on platform default encoding
    • #3882: [core] Fix AssertionError about exhaustive switch
    • #3884: [core] XML report via ant task contains XML header twice
    • #3896: [core] Fix ast-dump CLI when reading from stdin
  • doc
    • #2505: [doc] Improve side bar to show release date
  • java
    • #3068: [java] Some tests should not depend on real rules
    • #3889: [java] Catch LinkageError in UselessOverridingMethodRule
  • java-bestpractices
    • #3910: [java] UnusedPrivateField - Allow the ignored fieldnames to be configurable
    • #1185: [java] ArrayIsStoredDirectly false positive with field access
    • #1474: [java] ArrayIsStoredDirectly false positive with method call
    • #3879 [java] ArrayIsStoredDirectly reports duplicated violation
    • #3929: [java] ArrayIsStoredDirectly should report the assignment rather than formal parameter
  • java-design
    • #3603: [java] SimplifiedTernary: no violation for ‘condition ? true : false’ case
  • java-performance
    • #3867: [java] UseArraysAsList with method call
  • plsql
    • #3687: [plsql] Parsing exception EXECUTE IMMEDIATE l_sql BULK COLLECT INTO statement
    • #3706: [plsql] Parsing exception CURSOR statement with parenthesis groupings

API Changes

Experimental APIs

  • Report has two new methods which allow limited mutations of a given report:
    • 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: [doc] Improve side bar by Adding Release Date - @jasonqiu98
  • #3910: [java] UnusedPrivateField - Allow the ignored fieldnames to be configurable - @laoseth
  • #3928: [plsql] Fix plsql parsing error in parenthesis groups - @LiGaOg
  • #3935: [plsql] Fix parser exception in EXECUTE IMMEDIATE BULK COLLECT #3687 - @Scrsloota
  • #3938: [java] Modify SimplifiedTernary to meet the missing case #3603 - @VoidxHoshi
  • #3943: chore: Set permissions for GitHub actions - @naveensrinivasan


  • 97 commits
  • 31 closed tickets & PRs
  • Days since last release: 33