Movatterモバイル変換


[0]ホーム

URL:


 
» Detailed Release Notes for PMD 7 Edit on GitHub

Detailed Release Notes for PMD 7

These are the detailed release notes for PMD 7.
Table of Contents

🚀 Major Features and Enhancements

New official logo

Many of you probably have already seen the new logo, but now it’s time to actually ship it. The new logowas long ago decided (see#1663).

We decided it’s time to have a modernized logo and get rid of the gun. This allows to includethe logo anywhere without offense.

The official logo is also without a tagline (such as “Code Quality Matters!”) as the tagline created somecontroversies. Without a tagline, we are not limited in the direction of future development of PMD.

New PMD Logo

The new logo is available from theLogo Project Page.

Revamped Java

The Java grammar has been refactored substantially in order to make it easier to maintain and more correctregarding the Java Language Specification. It supports now also the edge-cases where PMD 6 was failing(e.g. annotations were not supported everywhere). Changing the grammar entails a changed AST and therefore changedrules. The PMD built-in rules have all been upgraded and many bugs have been fixed on the way.Unfortunately, if you are using custom rules, you will most probably need to accommodate these changes yourself.

The type resolution framework has been rewritten from scratch and should now cover the entire Java spec correctly.The same is true for the symbol table.PMD 6 on the other hand has always had problems with advanced type inference, e.g. with lambdas and call chains.Since it was built on the core reflection API, it also was prone to linkage errors and classloader leaks for instance.PMD 7 does not need to load classes, and does not have these problems.

The AST exposes much more semantic information now. For instance, you can jump from a method call tothe declaration of the method being called, or from a field access to the field declaration. Theseimprovements allow interesting rules to be written that need precise knowledge of the typesin the program, for instance to detectUnnecessaryBoxingorUseDiamondOperator.These are just a small preview of the new rules we will be adding in the PMD 7 release cycle.

Overall, the changes to the parser, AST, type resolution and symbol table code has made PMD forJavasignificantly faster. On average, we have seen ~2-3X faster analysis, but as usual, this may changedepending on your workload, configuration and ruleset.

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

Note:The full detailed documentation of the changes to the Java AST are available in theMigration Guide for PMD 7

Revamped Command Line Interface

PMD now ships with a unified Command Line Interface for both Linux/Unix and Windows. Instead of having a collectionof scripts for the different utilities shipped with PMD, a single scriptpmd (pmd.bat for Windows) can nowlaunch all utilities using subcommands, e.g.pmd check,pmd designer. All commands and options are thoroughlydocumented in the help, with full color support where available. Moreover, efforts were made to provide consistencyin the usage of all PMD utilities.

$Usage: pmd[-hV][COMMAND]-h,--help      Show thishelpmessage and exit.-V,--version   Print version information and exit.Commands:  check     The PMD standardsourcecode analyzer  cpd       Copy/Paste Detector - find duplicate code  designer  The PMD visual rule designer  cpd-gui   GUIforthe Copy/Paste Detector              Warning: May not support the full CPD featuresetast-dump  Experimental: dumps the AST of parsingsourcecodeExit Codes:  0   Successful analysis, no violations found  1   An unexpected error occurred during execution  2   Usage error, please refer to thecommand help4   Successful analysis, at least 1 violation found

For instance, where you previously would have run

run.sh pmd-d src-R ruleset.xml

you should now use

pmd check-d src-R ruleset.xml

or even better, omit using-d /--dir and simply pass the sources at the end of the parameter list

pmd check-R ruleset.xml src

Multiple source directories can be passed, such as:

pmd check-R ruleset.xml src/main/java src/test/java

And the exact same applies to CPD:

pmd cpd--minimum-tokens 100 src/main/java

Additionally, the CLI for thecheck command has been enhanced with a progress bar, which interactively displays thecurrent progress of the analysis.

Demo

This can be disabled with the--no-progress flag.

Finally, we now provide a completion script for Bash/Zsh to further help daily usage.To use it, edit your~/.bashrc /~/.zshrc file and add the following line:

source <(pmd generate-completion)

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

Full Antlr support

PMD 6 only supported JavaCC based grammars, but withAntlr parserscan be generated as well. Languages backed by an Antlr grammar are now fully supported. This means, it’s nowpossible not only to use Antlr grammars for CPD, but we can actually build full-fledged PMD rules for them as well.Both the traditional Java visitor rules, and the simpler XPath rules are available to users. This allowsto leverage existing grammars.

We expect this to enable both our dev team and external contributors to largely extend PMD usage for more languages.

Two languages (Swift and Kotlin) already use this new possibility.

See the documentation pageAdding a new language with ANTLRfor instructions on how to use this new feature.

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

Updated PMD Designer

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

For the detailed changes, see

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.

Seethe example report.

Contributors:Mohan Chinnappan (@mohan-chinnappan-n)

🎉 Language Related Changes

New: CPD support for Apache Velocity Template Language (VTL)

PMD supported Apache Velocity for a very long time, but the CPD integration never got finished.This is now done and CPD supports Apache Velocity Template language for detecting copy and paste.It is shipped in the modulepmd-velocity.

New: CPD support for Coco

Thanks to a contribution, CPD now supports Coco, a modern programming languagedesigned specifically for building event-driven software. It is shipped in the newmodulepmd-coco.

Contributors:Wener (@wener-tiobe)

New: CPD support for Julia

Thanks to a contribution, CPD now supports the Julia language. It is shippedin the new modulepmd-julia.

Contributors:Wener (@wener-tiobe)

New: CPD support for TypeScript

Thanks to a contribution, CPD now supports the TypeScript language. It is shippedwith the rest of the JavaScript support in the modulepmd-javascript.

Contributors:Paul Guyot (@pguyot)

New: Java 21 and 22 Support

This release of PMD brings support for Java 21 and 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 preview language features,you’ll need to enable it via the environment variablePMD_JAVA_OPTS and select the new languageversion22-preview:

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

Note: Support for Java 19 and Java 20 preview language features have been removed. The versions “19-preview” and“20-preview” are no longer available.

New: Kotlin support

PMD now supports Kotlin as an additional language for analyzing source code. It is based onthe official kotlin Antlr grammar for Kotlin 1.8. Java-based rules and XPath-based rules are supported.

We are shipping the following rules:

  • FunctionNameTooShort finds functions with a tooshort name.
  • OverrideBothEqualsAndHashcode finds classes with onlyeitherequals orhashCode overridden, but not both. This leads to unexpected behavior once instancesof such classes are used in collections (Lists, HashMaps, …).

Contributors:Jeroen Borgers (@jborgers),Peter Paul Bakker (@stokpop)

New: Swift support

Given the full Antlr support, PMD now fully supports Swift for creating rules. Previously only CPD was supported.

Note: There is only limited support for newer Swift language features in the parser, e.g. Swift 5.9 (Macro Expansions)are supported, but other features are not.

We are pleased to announce we are shipping a number of rules starting with PMD 7.

  • ForceCast flags all force casts, making sure you aredefensively considering all types. Having the application crash shouldn’t be an option.
  • ForceTry flags all force tries, making sure you aredefensively handling exceptions. Having the application crash shouldn’t be an option.
  • ProhibitedInterfaceBuilder flags any usage of interfacebuilder. Interface builder files are prone to merge conflicts, and are impossible to code review, so largerteams usually try to avoid it or reduce its usage.
  • UnavailableFunction flags any function throwingafatalError not marked as@available(*, unavailable) to ensure no calls are actually performed inthe codebase.

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

Changed: 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 sourceand generate an AST. This library is however a binary-blob provided as part of theSalesforce 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 Jorjelibrary 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 byKevin Jones (@nawforce).This project provides the grammar for a ANTLR based parser.
  • Summit-AST byGoogle (@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 parsers is completely switched, there are only little known changes to the AST.These are documented in theMigration Guide for PMD 7: Apex AST.With the new Apex parser, the new language constructs likeUser Mode Database Operationsand the newNull Coalescing Operator??can be parsed now. PMD should be able to parse Apex code up to version 60.0 (Spring ‘24).

See#3766 for details.

Contributors:Aaron Hurst (@aaronhurst-google),Edward Klimoshenko (@eklimo)

Changed: CPP can now ignore identifiers in sequences (CPD)

  • New command line option for CPD:--ignore-sequences.
  • This option is used for CPP only: with the already existing option--ignore-literal-sequences, onlyliterals were ignored. The new option additionally ignores identifiers as well in sequences.
  • SeePR #4470 for details.

Changed: Groovy Support (CPD)

  • We now support parsing all Groovy features from Groovy 3 and 4.
  • We now supportsuppression throughCPD-ON/CPD-OFF comment pairs.
  • SeePR #4726 for details.

Changed: HTML support

Support for HTML was introduced in PMD 6.55.0 as an experimental feature. With PMD 7.0.0 thisis now considered stable.

Changed: JavaScript support

The JS specific parser options have been removed. The parser now always retains comments and uses version ES6.The language module registers a couple of different versions. The latest version, which supports ES6 and also somenew constructs (seeRhino), is the default. This should be fine for mostuse cases.

Changed: Language versions

We revisited the versions that were defined by each language module. Now many more versions are defined for eachlanguage. In general, you can expect that PMD can parse all these different versions. There might be situationswhere this fails and this can be considered a bug. Usually the latest version is selected as the defaultlanguage version.

The language versions can be used to mark rules to be useful only for a specific language version viatheminimumLanguageVersion andmaximumLanguageVersion attributes. While this feature is currently only used bythe Java module, listing all possible versions enables other languages as well to use this feature.

Related issue:[core] Explicitly name all language versions (#4120)

Changed: Rule properties

  • The old deprecated classes likeIntProperty andStringProperty have been removed. Please usePropertyFactory to create properties.
  • All properties which accept multiple values now use a comma (,) as a delimiter. The previous default was apipe character (|). The delimiter is not configurable anymore. If needed, the comma can be escapedwith a backslash.
  • Themin andmax attributes in property definitions in the XML are now optional and can appear separatelyor be omitted.

Changed: Velocity Template Language (VTL)

The module was named just “vm” which was not a good name. Its module name, language id andpackage names have been renamed to “velocity”.

If you import rules, you also need to adjust the paths, e.g.

  • category/vm/... ➡️category/velocity/...

Changed: Visualforce

There was an inconsistency between the naming of the maven module and the language id. The language idused the abbreviation “vf”, while the maven module used the longer name “visualforce”. This has beensolved by renaming the language module to its full name “visualforce”. The java packages havebeen renamed as well.

If you import rules, you also need to adjust the paths, e.g.

  • category/vf/security.xml ➡️category/visualforce/security.xml

🌟 New and changed rules

New Rules

Apex

Java

  • UnnecessaryBoxing reports boxing and unboxing conversions that may be made implicit.
  • UseExplicitTypes reports usages ofvar keyword, which was introduced with Java 10.

Kotlin

  • FunctionNameTooShort finds functions with a too short name.
  • OverrideBothEqualsAndHashcode finds classes with onlyeitherequals orhashCode overridden, but not both. This leads to unexpected behavior once instancesof such classes are used in collections (Lists, HashMaps, …).

Swift

  • ForceCast flags all force casts, making sure you aredefensively considering all types. Having the application crash shouldn’t be an option.
  • ForceTry flags all force tries, making sure you aredefensively handling exceptions. Having the application crash shouldn’t be an option.
  • ProhibitedInterfaceBuilder flags any usage of interfacebuilder. Interface builder files are prone to merge conflicts, and are impossible to code review, so largerteams usually try to avoid it or reduce its usage.
  • UnavailableFunction flags any function throwingafatalError not marked as@available(*, unavailable) to ensure no calls are actually performed inthe codebase.

XML

Changed Rules

General changes

Apex General changes

  • The propertiescc_categories,cc_remediation_points_multiplier,cc_block_highlighting have been removedfrom all rules. These properties have been deprecated since PMD 6.13.0.Seeissue #1648 for more details.

Apex Codestyle

  • MethodNamingConventions: The deprecated rule propertyskipTestMethodUnderscores hasbeen removed. It was actually deprecated since PMD 6.15.0, but was not mentioned in the release notesback then. Use the propertytestPattern instead to configure valid names for test methods.

Java General changes

  • Violations reported on methods or classes previously reported the line range of the entire methodor class. With PMD 7.0.0, the reported location is now just the identifier of the method or class.This affects various rules, e.g.CognitiveComplexity.

    The report location is controlled by the overrides of the methodNode#getReportLocationin different node types.

    Seeissue #4439 andissue #730for more details.

Java Best Practices

  • ArrayIsStoredDirectly: Violations are now reported on the assignment and notanymore on the formal parameter. The reported line numbers will probably move.
  • AvoidReassigningLoopVariables: This rule might not report anymore allreassignments of the control variable in for-loops when the propertyforReassign is set toskip.Seeissue #4500 for more details.
  • LooseCoupling: The rule has a new property to allow some types to be coupledto (allowedTypes).
  • UnusedLocalVariable: This rule has some important false-negatives fixedand finds many more cases now. For details see issues#2130,#4516, and#4517.

Java Codestyle

  • MethodNamingConventions: The propertycheckNativeMethods has been removed. Theproperty was deprecated since PMD 6.3.0. Use the propertynativePattern to control whether native methodsshould be considered or not.
  • ShortVariable: This rule now also reports short enum constant names.
  • UseDiamondOperator: The propertyjava7Compatibility has been removed. The rule nowhandles Java 7 properly without a property.
  • UnnecessaryFullyQualifiedName: The rule has two new properties,to selectively disable reporting on static field and method qualifiers. The rule also has been improvedto be more precise.
  • UselessParentheses: The rule has two new properties which control how strictthe rule should be applied. WithignoreClarifying (default: true) parentheses that are strictly speakingnot necessary are allowed, if they separate expressions of different precedence.The other propertyignoreBalancing (default: true) is similar, in that it allows parentheses that helpreading and understanding the expressions.
  • EmptyControlStatement: The rule has a new property to allow empty blocks whenthey contain a comment (allowCommentedBlocks).

Java Design

  • CyclomaticComplexity: The propertyreportLevel has been removed. The property wasdeprecated since PMD 6.0.0. The report level can now be configured separated for classes and methods usingclassReportLevel andmethodReportLevel instead.
  • ImmutableField: The propertyignoredAnnotations has been removed. The property wasdeprecated since PMD 6.52.0.
  • LawOfDemeter: The rule has a new propertytrustRadius. This defines the maximum degreeof trusted data. The default of 1 is the most restrictive.
  • NPathComplexity: The propertyminimum has been removed. It was deprecated since PMD 6.0.0.Use the propertyreportLevel instead.
  • SingularField: The propertiescheckInnerClasses anddisallowNotAssignment have been removed.The rule is now more precise and will check these cases properly.
  • UseUtilityClass: The propertyignoredAnnotations has been removed.

Java Documentation

  • CommentContent: The propertiescaseSensitive anddisallowedTerms are removed. Thenew propertyforbiddenRegex can be used now to define the disallowed terms with a single regularexpression.
  • CommentRequired:
    • Overridden methods are now detected even without the@Overrideannotation. This is relevant for the propertymethodWithOverrideCommentRequirement.See alsopull request #3757.
    • Elements in annotation types are now detected as well. This might lead to an increased number of violationsfor missing public method comments.
    • The deprecated propertyheaderCommentRequirement has been removed. Use the propertyclassCommentRequirementinstead.
  • CommentSize: When determining the line-length of a comment, the leading commentprefix markers (e.g.* or//) are ignored and don’t add up to the line-length.See alsopull request #4369.

Java Error Prone

  • AvoidDuplicateLiterals: The propertyexceptionfile has been removed. The property wasdeprecated since PMD 6.10.0. Use the propertyexceptionList instead.
  • DontImportSun:sun.misc.Signal is not special-cased anymore.
  • EmptyCatchBlock:CloneNotSupportedException andInterruptedException are notspecial-cased anymore. Rename the exception parameter toignored to ignore them.
  • ImplicitSwitchFallThrough: Violations are now reported on the case statementsrather than on the switch statements. This is more accurate but might result in more violations now.
  • NonSerializableClass: The deprecated propertyprefix has been removedwithout replacement. In a serializable class all fields have to be serializable regardless of the name.

Deprecated Rules

In PMD 7.0.0, there are no deprecated rules.

Removed Rules

The following previously deprecated rules have been finally removed:

Apex

Java

Removed rulesets

The following previously deprecated rulesets have been removed. These were the left-over rulesets from PMD 5.The rules have been moved into categories with PMD 6.

  • rulesets/apex/apexunit.xml
  • rulesets/apex/braces.xml
  • rulesets/apex/complexity.xml
  • rulesets/apex/empty.xml
  • rulesets/apex/metrics.xml
  • rulesets/apex/performance.xml
  • rulesets/apex/ruleset.xml
  • rulesets/apex/securty.xml
  • rulesets/apex/style.xml
  • rulesets/java/android.xml
  • rulesets/java/basic.xml
  • rulesets/java/clone.xml
  • rulesets/java/codesize.xml
  • rulesets/java/comments.xml
  • rulesets/java/controversial.xml
  • rulesets/java/coupling.xml
  • rulesets/java/design.xml
  • rulesets/java/empty.xml
  • rulesets/java/finalizers.xml
  • rulesets/java/imports.xml
  • rulesets/java/j2ee.xml
  • rulesets/java/javabeans.xml
  • rulesets/java/junit.xml
  • rulesets/java/logging-jakarta-commons.xml
  • rulesets/java/logging-java.xml
  • rulesets/java/metrics.xml
  • rulesets/java/migrating.xml
  • rulesets/java/migrating_to_13.xml
  • rulesets/java/migrating_to_14.xml
  • rulesets/java/migrating_to_15.xml
  • rulesets/java/migrating_to_junit4.xml
  • rulesets/java/naming.xml
  • rulesets/java/optimizations.xml
  • rulesets/java/strictexception.xml
  • rulesets/java/strings.xml
  • rulesets/java/sunsecure.xml
  • rulesets/java/typeresolution.xml
  • rulesets/java/unnecessary.xml
  • rulesets/java/unusedcode.xml
  • rulesets/ecmascript/basic.xml
  • rulesets/ecmascript/braces.xml
  • rulesets/ecmascript/controversial.xml
  • rulesets/ecmascript/unnecessary.xml
  • rulesets/jsp/basic.xml
  • rulesets/jsp/basic-jsf.xml
  • rulesets/plsql/codesize.xml
  • rulesets/plsql/dates.xml
  • rulesets/plsql/strictsyntax.xml
  • rulesets/plsql/TomKytesDespair.xml
  • rulesets/vf/security.xml
  • rulesets/vm/basic.xml
  • rulesets/pom/basic.xml
  • rulesets/xml/basic.xml
  • rulesets/xsl/xpath.xml
  • rulesets/releases/*

💥 Compatibility and Migration Notes

Note:The full detailed documentation of the changes are available in theMigration Guide for PMD 7

For endusers

  • PMD 7 requires Java 8 or above to execute.
  • CLI changed: Custom scripts need to be updated (run.sh pmd ... ➡️pmd check ...,run.sh cpd ... ➡️pmd cpd ...).
  • Java module revamped: Custom rules need to be updated.
  • Removed rules: Custom rulesets need to be reviewed. See above for a list of new and removed rules.
  • XPath 1.0 and 2.0 support is removed,violationSuppressXPath now requires XPath 3.1: Custom rulesets needto be reviewed.
  • Custom rules using rulechains: Need to overrideAbstractRule#buildTargetSelectorusingRuleTargetSelector#forTypes.
  • The asset filenames of PMD onGitHub Releases arenowpmd-dist-<version>-bin.zip,pmd-dist-<version>-src.zip andpmd-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 distributionZIP file the base directorypmd-bin-<version>.

  • For maven-pmd-plugin usage, seeUsing PMD 7 with maven-pmd-plugin.
  • For gradle users, at least gradle 8.6 is required for PMD 7.

For integrators

  • PMD 7 is a major release where many things have been moved or rewritten.
  • All integrators will require some level of change to adapt to the change in the API.
  • For more details look at the deprecations notes of the past PMD 6 releases. These are collected belowunderAPI Changes.
  • The PMD Ant tasks, which were previously in the modulepmd-core has been moved into its own modulepmd-ant,which needs to be added explicitly now as an additional dependency.
  • The CLI classes have also been moved out ofpmd-core into its own modulepmd-cli. The old entry point, themain classPMD is gone.

🚨 API

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

This however entails some incompatibilities and deprecations.

SeeADR 3 - API evolution principles andAPI changes below.

Small Changes and cleanups

  • #1648: [apex,vf] Remove CodeClimate dependency -Robert SösemannProperties “cc_categories”, “cc_remediation_points_multiplier”, “cc_block_highlighting” can no longer be overridden in rulesets.They were deprecated without replacement.

  • The old GUI applications accessible throughrun.sh designerold andrun.sh bgastviewer(and corresponding Batch scripts) have been removed from the PMD distribution. Please use the newer rule designerwithpmd designer. The corresponding classes in packagesjava.net.sourceforge.pmd.util.viewer andjava.net.sourceforge.pmd.util.designer have all been removed.

  • All API related to XPath support has been moved to the packagenet.sourceforge.pmd.lang.rule.xpath.This includes API that was previously dispersed overnet.sourceforge.pmd.lang,net.sourceforge.pmd.lang.ast.xpath,net.sourceforge.pmd.lang.rule.xpath,net.sourceforge.pmd.lang.rule, and various language-specific packages(which were made internal).

  • The implementation of the Ant integration has been moved from the modulepmd-core to a new modulepmd-ant.This involves classes in packagenet.sourceforge.pmd.ant. The ant CPDTask classnet.sourceforge.pmd.cpd.CPDTaskhas been moved into the same packagenet.sourceforge.pmd.ant. You’ll need to update your taskdef entries in yourbuild.xml files with the FQCNnet.sourceforge.pmd.ant.CPDTask if you use it anywhere.

  • Utility classes innet.sourceforge.pmd.util, that have previously marked as@InternalApi have been finallymoved to an internal sub package and are now longer available.This includes ClasspathClassLoader, FileFinder, FileUtil, and IOUtil.

  • The following utility classes innet.sourceforge.pmd.util are now considered public API:
  • Moved the two classesAntlrCpdLexer andJavaccCpdLexer frominternal package into packagenet.sourceforge.pmd.cpd.impl. These two classes are part of the API andare base classes for CPD language implementations. Since 7.0.0-rc2.Note: These two classes have been previously called “AntlrTokenizer” and “JavaCCTokenizer”.
  • AntlrBaseRule is gone in favor ofAbstractVisitorRule. Since 7.0.0-rc2.
  • The classesnet.sourceforge.pmd.lang.kotlin.ast.KotlinInnerNode andnet.sourceforge.pmd.lang.swift.ast.SwiftInnerNode are package-private now. Since 7.0.0-rc2.

XPath 3.1 support

Support for XPath versions 1.0, 1.0-compatibility, 2.0 was removed. The default(and only) supported XPath version is now XPath 3.1. This version of the XPath language is mostly identical toXPath 2.0.

Notable changes:

  • The deprecated support for sequence-valued attributes is removed. Sequence-valued properties are still supported.
  • Refer tothe Saxonica documentation foran introduction to new features in XPath 3.1.

Node stream API for AST traversal

This version includes a powerful API to navigate trees, similar in usage to the Java 8 Stream API:

node.descendants(ASTMethodCall.class).filter(m->"toString".equals(m.getMethodName())).map(m->m.getQualifier()).filter(q->TypeTestUtil.isA(String.class,q)).foreach(System.out::println);

A pipeline like shown here traverses the tree lazily, which is more efficient than traversing eagerly to put alldescendants in a list. It is also much easier to change than the old imperative way.

To make this API as accessible as possible, theNode interface has been fitted with newmethods producing node streams. Those methods replace previous tree traversal methods likeNode#findDescendantsOfType.In all cases, they should be more efficient and more convenient.

SeeNodeStream for more details.

Contributors:Clément Fournier (@oowekyala)

Metrics framework

The metrics framework has been made simpler and more general.

  • The metric interface takes an additional type parameter, representing the result type of the metric. This isusuallyInteger orDouble. It avoids widening the result to adouble just to narrow it down.

    This makes it so, thatDouble.NaN is not an appropriate sentinel value to represent “not supported” anymore.Instead,computeFor may returnnull in that case (or a garbage value). The valuenull may have causedproblems with the narrowing casts, which through unboxing, might have thrown an NPE. But when we deprecatedthe language-specific metrics façades to replace them with the genericMetricsUtil,we took care of makingthe new methods throw an exception if the metric cannot be computed on the parameter. This forces you to guardcalls toMetricsUtil#computeMetric (and other overloads)with something likeif (metric.supports(node)). If you’re followingthis pattern, then you won’t observe the undefined behavior.

  • TheMetricKey interface is not so useful and has been merged into theMetricinterface and removed. So theMetric interface has the new methoddisplayName.

  • The framework is not tied to at most 2 node types per language anymore. Previously those were nodes forclasses and for methods/constructors. Instead, many metrics support more node types. For example, NCSS canbe computed on any code block.

    For that reason, keeping around a hard distinction between “class metrics” and “operation metrics” is notuseful. So in the Java framework for example, we removed the interfacesJavaClassMetric,JavaOperationMetric,abstract classes for those,JavaClassMetricKey, andJavaOperationMetricKey. Metric constants are now allinside theJavaMetrics utility class. The same was done in the Apex framework.

    We don’t really need abstract classes for metrics now. SoAbstractMetric is also removed from pmd-core.There is a factory method on theMetric interface to create a metric easily.

  • This makes it so, thatLanguageMetricsProvider does not need type parameters.It can just return aSet<Metric<?, ?>> to list available metrics.

  • Signatures, their implementations, and the interfaceSignedNode have beenremoved. Node streams allow replacing their usages very easily.

Testing framework

  • PMD 7 has been upgraded to use JUnit 5 only. That means, that JUnit4 related classes have been removed, namely
    • net.sourceforge.pmd.testframework.PMDTestRunner
    • net.sourceforge.pmd.testframework.RuleTestRunner
    • net.sourceforge.pmd.testframework.TestDescriptor
  • Rule tests, that useSimpleAggregatorTst orPmdRuleTst work as before without change, but usenow JUnit5 under the hood. If you added additional JUnit4 tests to your rule test classes, then you’llneed to upgrade them to use JUnit5.

Language Lifecycle and Language Properties

  • Language modules now provide a proper lifecycle and can store global information. This enables the implementationof multifile analysis.
  • Language modules can definecustom language propertieswhich can be set via environment variables. This allows to add and use language specific configuration optionswithout the need to change pmd-core.

The documentation page has been updated:Adding a new language with JavaCCandAdding a new language with ANTLR

Related issue:[core] Language lifecycle (#3782)

Rule properties

  • The old deprecated classes likeIntProperty andStringProperty have been removed. Please usePropertyFactory to create properties.
  • All properties which accept multiple values now use a comma (,) as a delimiter. The previous default was apipe character (|). The delimiter is not configurable anymore. If needed, the comma can be escapedwith a backslash.
  • Themin andmax attributes in property definitions in the XML are now optional and can appear separatelyor be omitted.

New Programmatic API for CPD

This release introduces a new programmatic API to replace the old classCPD. The new API uses a similar model toPmdAnalysis and is calledCpdAnalysis. Programmatic execution of CPD should now bedone with aCPDConfiguration and aCpdAnalysis, for instance:

CPDConfigurationconfig=newCPDConfiguration();config.setMinimumTileSize(100);config.setOnlyRecognizeLanguage(config.getLanguageRegistry().getLanguageById("java"));config.setSourceEncoding(StandardCharsets.UTF_8);config.addInputPath(Path.of("src/main/java")config.setIgnoreAnnotations(true);config.setIgnoreLiterals(false);config.setRendererName("text");try(CpdAnalysiscpd=CpdAnalysis.create(config)){// note: don't use `config` once a CpdAnalysis has been created.// optional: add more filescpd.files().addFile(Paths.get("src","main","more-java","ExtraSource.java"));cpd.performAnalysis();}

CPD can of course still be called via command line or using the modulepmd-cli. But for tight integrationthis new programmatic API is recommended.

SeePR #4397 for details.

API changes

7.0.0

These are the changes between 7.0.0-rc4 and final 7.0.0.

pmd-java

New API

The API aroundTreeRenderer has been declared as stable. It was previouslyexperimental. It can be used via the CLI subcommandast-dump or programmatically, as describedonCreating XML dump of the AST.

General AST Changes to avoid@Image

SeeGeneral AST Changes to avoid @Imagein the migration guide for details.

XPath Rules

  • The propertyversion was already deprecated and has finally been removed. Please don’t define the versionproperty anymore in your custom XPath rules. By default, the latest XPath version will be used, whichis XPath 3.1.

Moved classes/consolidated packages

Internalized classes and interfaces and methods

The following classes/methods have been marked as @InternalApi before and are now moved into ainternalpackage or made (package) private and arenot accessible anymore.

  • pmd-core
  • pmd-doc
    • The whole maven modulepmd-doc is now considered internal API even though it was not declared so before.It’s used to generate the rule documentation for the built-in rules.
    • All the classes have been moved into packagenet.sourceforge.pmd.doc.internal.
  • pmd-ant
    • net.sourceforge.pmd.ant.Formatter
      • MethodgetRenderer() has been removed.
      • Methodstart(String) is private now.
      • Methodend(Report) has been removed.
      • MethodisNoOutputSupplied() is now package private.
      • MethodnewListener(Project) is now package private.
    • net.sourceforge.pmd.ant.PMDTask
      • MethodgetRelativizeRoots() has been removed.
    • net.sourceforge.pmd.ant.ReportException is now package private. Note: It was not marked with @InternalApi before.
  • pmd-apex
    • net.sourceforge.pmd.lang.apex.ast.ApexNode
      • MethodgetNode() has been removed. It was only deprecated before and not marked with @InternalApi.However, it gave access to the wrapped Jorje node and was thus internal API.
    • net.sourceforge.pmd.lang.apex.ast.AbstractApexNode
      • MethodgetNode() is now package private.
    • net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis
      • Constructor is now package private.
    • net.sourceforge.pmd.lang.apex.rule.design.AbstractNcssCountRule (now package private)
    • net.sourceforge.pmd.lang.apex.rule.AbstractApexUnitTestRule (moved to packagenet.sourceforge.pmd.apex.rule.bestpractices, now package private)
  • pmd-java
  • pmd-jsp
  • pmd-modelica
    • net.sourceforge.pmd.lang.modelica.ast.InternalApiBridge renamed fromInternalModelicaNodeApi.
    • net.sourceforge.pmd.lang.modelica.resolver.InternalApiBridge renamed fromInternalModelicaResolverApi.
    • net.sourceforge.pmd.lang.modelica.resolver.ModelicaSymbolFacade has been removed.
    • net.sourceforge.pmd.lang.modelica.resolver.ResolutionContext (moved to internal)
    • net.sourceforge.pmd.lang.modelica.resolver.ResolutionState (moved to internal). Note: it was not previously marked with @InternalApi.
    • net.sourceforge.pmd.lang.modelica.resolver.Watchdog (moved to internal). Note: it was not previously marked with @InternalApi.
  • pmd-plsql
    • net.sourceforge.pmd.lang.plsql.rule.design.AbstractNcssCountRule is now package private.
  • pmd-scala

Removed classes and members (previously deprecated)

The annotation@DeprecatedUntil700 has been removed.

  • pmd-core
  • pmd-apex
    • ApexNode andASTApexFile
      • #getApexVersion(): In PMD 6, this method has been deprecated but was defined in the classApexRootNode.The version returned is always “Version.CURRENT”, as the apex compiler integrationdoesn’t use additional information which Apex version actually is used. Therefore, this method can’t beused to determine the Apex version of the project that is being analyzed.

        If the current version is needed, thenNode.getTextDocument().getLanguageVersion() can be used. Thisis the version that has been selected via CLI--use-version parameter.

    • ApexNode
      • methodjjtAccept() has been removed.UseacceptVisitor instead.
      • methodgetNode() has been removed. The underlying node is only available in AST nodes, but not in rule implementations.
    • AbstractApexNode - methodgetNode() is now package private.AST nodes still have access to the underlying Jorje node via the protected propertynode.
    • net.sourceforge.pmd.lang.apex.ast.ApexParserVisitorUseApexVisitor orApexVisitorBase instead.
    • net.sourceforge.pmd.lang.apex.ast.ApexParserVisitorAdapter
    • ASTAssignmentExpression - methodgetOperator() removed.UsegetOp instead.
    • ASTBinaryExpression - methodgetOperator() removed.UsegetOp instead.
    • ASTBooleanExpression - methodgetOperator() removed.UsegetOp instead.
    • ASTPostfixExpression - methodgetOperator() removed.UsegetOp instead.
    • ASTPrefixExpression - methodgetOperator() removed.UsegetOp instead.
    • net.sourceforge.pmd.lang.apex.rule.security.Helper removed. This was actually internal API.
  • pmd-java
    • AbstractPackageNameModuleDirective - methodgetImage() has been removed.UsegetPackageName instead.
    • AbstractTypeDeclaration - methodgetImage() has been removed.UsegetSimpleName() instead.
    • ASTAnnotation - methodgetAnnotationName() has been removed.
    • ASTClassType
      • constructorASTClassType(java.lang.String) has been removed.
      • methodgetImage() has been removed.
      • methodisReferenceToClassSameCompilationUnit() has been removed.
    • ASTFieldDeclaration - methodgetVariableName() has been removed.
    • ASTLiteral - the following methods have been removed:
      • isStringLiteral() - usenode instanceof ASTStringLiteral instead.
      • isCharLiteral() - usenode instanceof ASTCharLiteral instead.
      • isNullLiteral() - usenode instanceof ASTNullLiteral instead.
      • isBooleanLiteral() - usenode instanceof ASTBooleanLiteral instead.
      • isNumericLiteral() - usenode instanceof ASTNumericLiteral instead.
      • isIntLiteral() - useisIntLiteral instead.
      • isLongLiteral() - useisLongLiteral instead.
      • isFloatLiteral() - useisFloatLiteral instead.
      • isDoubleLiteral() - useisDoubleLiteral instead.
    • ASTMethodDeclaration - methodsgetImage() andgetMethodName() have been removed.UsegetName instead.
    • ASTMethodReference - methodgetImage() has been removed.
    • ASTModuleName - methodgetImage() has been removed.
    • ASTPrimitiveType - methodgetImage() has been removed.
    • ASTType
      • getTypeImage() has been removed.
      • getArrayDepth() has been removed. It’s only available for arrays:getArrayDepth.
      • isPrimitiveType() - usenode instanceof ASTPrimitiveType instead.
      • isArrayType() - usenode instanceof ASTArrayType instead.
      • isClassOrInterfaceType() - usenode instanceof ASTClassType instead.
    • ASTTypeDeclaration - methodgetImage() has been removed.
    • ASTUnaryExpression - methodisPrefix() has been removed.UsegetOperator.isPrefix() instead.
    • ASTVariableId - methodsgetImage() andgetVariableName() have been removed.UsegetName instead.
    • JavaComment - methodgetImage() has been removed.UsegetText instead.
    • JavaNode - methodjjtAccept() has been removed.UseacceptVisitor instead.
    • net.sourceforge.pmd.lang.java.ast.JavaParserVisitorUseJavaVisitor orJavaVisitorBase instead.
    • net.sourceforge.pmd.lang.java.ast.JavaParserVisitorAdapter
    • ModifierOwner
      • isFinal() - This is still available in various subtypes, where it makes sense, e.g.isFinal.
      • isAbstract() - This is still available in subtypes, e.g.isAbstract.
      • isStrictfp() - UsehasModifiers instead, e.g.hasModifiers(STRICTFP).
      • isSynchronized() - UsehasModifiers instead, e.g.hasModifiers(SYNCHRONIZED).
      • isNative() - UsehasModifiers instead, e.g.hasModifiers(NATIVE).
      • isStatic() - This is still available in subtypes, e.g.isStatic.
      • isVolatile() - UsehasModifiers instead, e.g.hasModifiers(VOLATILE).
      • isTransient() - UsehasModifiers instead, e.g.hasModifiers(TRANSIENT).
      • isPrivate() - UsegetVisibility instead, e.g.getVisibility() == Visibility.V_PRIVATE.
      • isPublic() - UsegetVisibility instead, e.g.getVisibility() == Visibility.V_PUBLIC.
      • isProtected() - UsegetVisibility instead, e.g.getVisibility() == Visibility.V_PROTECTED.
      • isPackagePrivate() - UsegetVisibility instead, e.g.getVisibility() == Visibility.V_PACKAGE.
      • isSyntacticallyAbstract() - UsehasExplicitModifiers instead, e.g.hasExplicitModifiers(ABSTRACT).
      • isSyntacticallyPublic() - UsehasExplicitModifiers instead, e.g.hasExplicitModifiers(PUBLIC).
      • isSyntacticallyStatic() - UsehasExplicitModifiers instead, e.g.hasExplicitModifiers(STATIC).
      • isSyntacticallyFinal() - UsehasExplicitModifiers instead, e.g.hasExplicitModifiers(FINAL).
    • TypeNode - methodgetType() has been removed. UsegetTypeMirror instead.
  • pmd-javascript
    • AbstractEcmascriptNode - methodgetNode() has been removed.AST nodes still have access to the underlying Rhino node via the protected propertynode.
    • ASTFunctionNode - methodgetBody(int) removed.UsegetBody instead.
    • ASTTryStatement
      • methodisCatch() has been removed. UsehasCatch instead.
      • methodisFinally() has been removed. UsehasFinally instead.
    • EcmascriptNode
      • methodjjtAccept() has been removed. UseacceptVisitor instead.
      • methodgetNode() has been removed. The underlying node is only available in AST nodes, but not in rule implementations.
    • net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParserVisitorUseEcmascriptVisitor orEcmascriptVisitorBase instead.
    • net.sourceforge.pmd.lang.ecmascript.ast.EcmascriptParserVisitorAdapter
  • pmd-jsp
  • pmd-modelica
  • pmd-plsql
  • pmd-scala
    • The maven modulepmd-scala has been removed. Usepmd-scala_2.13 orpmd-scala_2.12 instead.
    • ScalaNode
      • Methodaccept() has been removed. UseacceptVisitor instead.
      • MethodgetNode() has been removed. The underlying node is only available in AST nodes, but not in rule implementations.
    • AbstractScalaNode - methodgetNode() has been removed. AST nodes still have accessto the underlying Scala node via the protected propertynode.
  • pmd-visualforce
  • pmd-velocity (previously pmd-vm)

Removed classes, interfaces and methods (not previously deprecated)

  • pmd-apex
    • The methodisSynthetic() inASTMethod has been removed.With the switch from Jorje to Summit AST as underlying parser, no synthetic methods are generated by theparser anymore. This also means, that there is no XPath attribute@Synthetic anymore.
    • The constantSTATIC_INITIALIZER_METHOD_NAME inFieldDeclarationsShouldBeAtStartRulehas been removed. It was used to filter out synthetic methods, but these are not generated anymore with thenew parser.
    • The methodgetContext() inASTReferenceExpression has been removed.It was not used and always returnednull.
    • The methodgetNamespace() in all AST nodes (defined inApexNode) hasbeen removed, as it was never fully implemented. It always returned an empty string.
    • The methodgetNameSpace() inApexQualifiedName has been removed.
    • The classnet.sourceforge.pmd.lang.apex.ast.ASTBridgeMethodCreator has been removed. This was a node that hasbeen generated by the old Jorje parser only.
  • pmd-apex-jorje
    • With the switch from Jorje to Summit AST, this maven module is no longer needed and has been removed.
  • pmd-core
    • net.sourceforge.pmd.util.Predicate has been removed. It was marked as Experimental before. Usejava.util.function.Predicate instead.
  • pmd-java
    • The interfaceFinalizableNode (introduced in 7.0.0-rc1) has been removed.Its methodisFinal() has been moved down to thenodes where needed, e.g.ASTLocalVariableDeclaration#isFinal.
    • The methodisPackagePrivate() inASTClassDeclaration (formerly ASTClassOrInterfaceDeclaration)has been removed.UsehasVisibility instead,which can correctly differentiate between local and package private classes.

Renamed classes, interfaces, methods

  • pmd-core
  • pmd-java
    • The interfaceAccessNode has been renamed toModifierOwner. This is only relevantfor Java rules, which use that type directly e.g. through downcasting.Or when using the XPath functionpmd-java:nodeIs().
    • The nodeASTClassOrInterfaceType has been renamed toASTClassType. XPath rulesneed to be adjusted.
    • The nodeASTClassOrInterfaceDeclaration has been renamed toASTClassDeclaration.XPath rules need to be adjusted.
    • The interfaceASTAnyTypeDeclaration has been renamed toASTTypeDeclaration.This is only relevant for Java rules, which use that type directly, e.g. through downcasting.Or when using the XPath functionpmd-java:nodeIs().
    • The interfaceASTMethodOrConstructorDeclaration has been renamed toASTExecutableDeclaration. This is only relevant for Java rules, which use that typedirectly, e.g. through downcasting. Or when using the XPath functionpmd-java:nodeIs().
    • The nodeASTVariableDeclaratorId has been renamed toASTVariableId. XPath rulesneed to be adjusted.
    • The nodeASTClassOrInterfaceBody has been renamed toASTClassBody. XPath rulesneed to be adjusted.
  • pmd-scala
    • The interfaceScalaParserVisitor has been renamed toScalaVisitor in orderto align the naming scheme for the different language modules.
    • The classScalaParserVisitorAdapter has been renamed toScalaVisitorBase in orderto align the naming scheme for the different language modules.

New API

These were annotated with@Experimental, but can now be considered stable.

Removed functionality

  • The CLI parameter--no-ruleset-compatibility has been removed. It was only used to allow loadingsome rulesets originally written for PMD 5 also in PMD 6 without fixing the rulesets.
  • The classRuleSetFactoryCompatibility has been removed without replacement.The different ways to enable/disable this filter inPMDConfiguration(Property “RuleSetFactoryCompatibilityEnabled”) andPMDTask (Property “noRuleSetCompatibility”) have been removed as well.
  • textcolor renderer (TextColorRenderer) now renders always in color.The propertycolor has been removed. The possibility to override this with the system propertypmd.colorhas been removed as well. If you don’t want colors, usetext renderer (TextRenderer).

7.0.0-rc4

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 likeIntProperty andStringProperty have been removed. Please usePropertyFactory to create properties.
  • All properties which accept multiple values now use a comma (,) as a delimiter. The previous default was apipe character (|). The delimiter is not configurable anymore. If needed, the comma can be escapedwith a backslash.
  • Themin andmax attributes in property definitions in the XML are now optional and can appear separatelyor be omitted.

New Programmatic API for CPD

SeeDetailed Release Notes for PMD 7andPR #4397 for details.

Removed classes and methods

The following previously deprecated classes have been removed:

  • pmd-core
    • net.sourceforge.pmd.cpd.AbstractTokenizer ➡️ useAnyCpdLexer instead (previously known as AnyTokenizer)
    • net.sourceforge.pmd.cpd.CPD ➡️ usePmdCli frompmd-cli module for CLI support or useCpdAnalysis for programmatic API
    • net.sourceforge.pmd.cpd.GridBagHelper (now package private)
    • net.sourceforge.pmd.cpd.TokenEntry.State
    • net.sourceforge.pmd.lang.document.CpdCompat
    • net.sourceforge.pmd.properties.BooleanMultiProperty
    • net.sourceforge.pmd.properties.BooleanProperty
    • net.sourceforge.pmd.properties.CharacterMultiProperty
    • net.sourceforge.pmd.properties.CharacterProperty
    • net.sourceforge.pmd.properties.DoubleMultiProperty
    • net.sourceforge.pmd.properties.DoubleProperty
    • net.sourceforge.pmd.properties.EnumeratedMultiProperty
    • net.sourceforge.pmd.properties.EnumeratedProperty
    • net.sourceforge.pmd.properties.EnumeratedPropertyDescriptor
    • net.sourceforge.pmd.properties.FileProperty (note: without replacement)
    • net.sourceforge.pmd.properties.FloatMultiProperty
    • net.sourceforge.pmd.properties.FloatProperty
    • net.sourceforge.pmd.properties.IntegerMultiProperty
    • net.sourceforge.pmd.properties.IntegerProperty
    • net.sourceforge.pmd.properties.LongMultiProperty
    • net.sourceforge.pmd.properties.LongProperty
    • net.sourceforge.pmd.properties.MultiValuePropertyDescriptor
    • net.sourceforge.pmd.properties.NumericPropertyDescriptor
    • net.sourceforge.pmd.properties.PropertyDescriptorField
    • net.sourceforge.pmd.properties.RegexProperty
    • net.sourceforge.pmd.properties.SingleValuePropertyDescriptor
    • net.sourceforge.pmd.properties.StringMultiProperty
    • net.sourceforge.pmd.properties.StringProperty
    • net.sourceforge.pmd.properties.ValueParser
    • net.sourceforge.pmd.properties.ValueParserConstants
    • net.sourceforge.pmd.properties.builders.MultiNumericPropertyBuilder
    • net.sourceforge.pmd.properties.builders.MultiPackagedPropertyBuilder
    • net.sourceforge.pmd.properties.builders.MultiValuePropertyBuilder
    • net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilder
    • net.sourceforge.pmd.properties.builders.PropertyDescriptorBuilderConversionWrapper
    • net.sourceforge.pmd.properties.builders.PropertyDescriptorExternalBuilder
    • net.sourceforge.pmd.properties.builders.SingleNumericPropertyBuilder
    • net.sourceforge.pmd.properties.builders.SinglePackagedPropertyBuilder
    • net.sourceforge.pmd.properties.builders.SingleValuePropertyBuilder
    • net.sourceforge.pmd.properties.modules.EnumeratedPropertyModule
    • net.sourceforge.pmd.properties.modules.NumericPropertyModule

The following previously deprecated methods have been removed:

  • pmd-core
    • net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder#delim(char)
    • net.sourceforge.pmd.properties.PropertySource#setProperty(...)
    • net.sourceforge.pmd.properties.internal.PropertyTypeId#factoryFor(...)
    • net.sourceforge.pmd.properties.internal.PropertyTypeId#typeIdFor(...)
    • net.sourceforge.pmd.properties.PropertyDescriptor: removed methods errorFor, type, isMultiValue,uiOrder, compareTo, isDefinedExternally, valueFrom, asDelimitedString

The following methods have been removed:

  • pmd-core
    • CPDConfiguration
      • #sourceCodeFor(File),#postConstruct(),#tokenizer(),#filenameFilter() removed
    • Mark
      • #getSourceSlice(),#setLineCount(int),#getLineCount(),#setSourceCode(SourceCode) removed
      • #getBeginColumn(),#getBeginLine(),#getEndLine(),#getEndColumn() removed➡️ usegetLocation instead
    • Match
      • #LABEL_COMPARATOR removed
      • #setMarkSet(...),#setLabel(...),#getLabel(),#addTokenEntry(...) removed
      • #getSourceCodeSlice() removed➡️ useCPDReport#getSourceCodeSlice instead
    • TokenEntry
      • #getEOF(),#clearImages(),#getIdentifier(),#getIndex(),#setHashCode(int) removed
      • #EOF removed ➡️ useisEof instead
    • Parser.ParserTask
      • #getFileDisplayName() removed ➡️ usegetFileId instead(getFileId().getAbsolutePath())

The following classes have been removed:

  • pmd-core
    • net.sourceforge.pmd.cpd.AbstractLanguage
    • net.sourceforge.pmd.cpd.AnyLanguage
    • net.sourceforge.pmd.cpd.Language
    • net.sourceforge.pmd.cpd.LanguageFactory
    • net.sourceforge.pmd.cpd.MatchAlgorithm (now package private)
    • net.sourceforge.pmd.cpd.MatchCollector (now package private)
    • net.sourceforge.pmd.cpd.SourceCode (and all inner classes likeFileCodeLoader, …)
    • net.sourceforge.pmd.cpd.token.TokenFilter

Moved packages

Changed types and other changes

Internal APIs

  • net.sourceforge.pmd.properties.internal.PropertyTypeId

Deprecated API

Experimental APIs

7.0.0-rc3

PMD Distribution

  • The asset filenames of PMD onGitHub Releases arenowpmd-dist-<version>-bin.zip,pmd-dist-<version>-src.zip andpmd-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 distributionZIP file the base directorypmd-bin-<version>.

CLI

  • 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 equivalentinteger values (1 to 5) are supported as well.

pmd-core

7.0.0-rc2

Removed classes and methods

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

CLI

  • 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 equivalentinteger values (1 to 5) are supported as well.

7.0.0-rc1

CLI

  • The CLI option--stress (or-stress) has been removed without replacement.
  • The CLI option--minimum-priority now takes one of the following values instead of an integer:High, Medium High, Medium, Medium Low, Low.

6.55.0

Go

  • The LanguageModule of Go, that only supports CPD execution, has been deprecated. This languageis not fully supported by PMD, so having a language module does not make sense. The functionality of CPD isnot 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 classnet.sourceforge.pmd.lang.java.ast.ASTGuardedPattern has been removed.

6.54.0

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 possibleto 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 reportwith some matches removed with a given predicate based filter.

6.53.0

Deprecated APIs

For removal

These classes / APIs have been deprecated and will be removed with PMD 7.0.0.

6.52.0

PMD CLI

  • PMD now supports a new--use-version flag, which receives a language-version pair (such asjava-8 orapex-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

  • Usingrun.sh cpdgui will now warn about it being deprecated. Userun.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 userun.sh ast-dump for a text-based alternative.

Deprecated API

6.51.0

No changes.

6.50.0

CPD CLI

  • CPD now supports the--ignore-literal-sequences argument when analyzing Lua code.

6.49.0

Deprecated API

6.48.0

CPD CLI

  • CPD has a new CLI option--debug. This option has the same behavior as in PMD. It enables more verboselogging output.

Rule Test Framework

  • The module “pmd-test”, which contains support classes to write rule tests, nowrequires Java 8. If you depend onthis 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. Theschema has been extracted in order to easily share it with other tools like the Rule Designer or IDE plugins.
  • Test schema changes:
    • The attributeisRegressionTest oftest-code is deprecated. The newattributedisabled should be used instead for defining whether a rule test should be skipped or not.
    • The attributesreinitializeRule anduseAuxClasspath oftest-code are deprecated and assumed true.They will not be replaced.
    • The new attributefocused oftest-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

Deprecated API

  • The experimental Java AST classnet.sourceforge.pmd.lang.java.ast.ASTGuardedPattern has been deprecated andwill 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 interfaceCPDRenderer is deprecated. For custom CPD renderersthe new interfaceCPDReportRenderer should be used.
  • The classTestDescriptor is deprecated, replaced withRuleTestDescriptor.
  • Many methods ofRuleTst have been deprecated as internal API.

Experimental APIs

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.

6.47.0

No changes.

6.46.0

Deprecated ruleset references

Ruleset references with the following formats are now deprecated and will produce a warningwhen used on the CLI or in a ruleset XML file:

  • <lang-name>-<ruleset-name>, egjava-basic, which resolves torulesets/java/basic.xml
  • the internal release number, eg600, which resolves torulesets/releases/600.xml

Use the explicit forms of these references to be compatible with PMD 7.

Deprecated API

  • toString is now deprecated. The format of thismethod will remain the same until PMD 7. The deprecation is intended to steer usersaway from relying on this format, as it may be changed in PMD 7.
  • getInputPaths andsetInputPaths 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.

6.45.0

Experimental APIs

  • Report has two new methods which allow limited mutations of a given report:
  • net.sourceforge.pmd.util.Predicate will be replaced in PMD7 with the standard Predicate interface from java8.
  • The modulepmd-html is entirely experimental right now. Anything in the packagenet.sourceforge.pmd.lang.html should be used cautiously.

6.44.0

Deprecated API

Experimental APIs

  • Together with the new programmatic API the interfaceTextFile has been added asexperimental. It intendsto replaceDataSource andSourceCode in the long term.

    This interface will change in PMD 7 to support read/write operationsand other things. You don’t need to use it in PMD 6, asFileCollectordecouples you from this. A file collector is available throughPmdAnalysis#files.

6.43.0

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 setof stable methods, matching those in PMD 7, was added to replace theaddViolationoverloads ofAbstractRule. In PMD 7,RuleContext willbe the API to report violations, and it can already be used as such in PMD 6.
  • The fieldconfiguration 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.

Changed API

It is now forbidden to report a violation:

  • With anull node
  • With anull message
  • With anull set of format arguments (prefer a zero-length array)

Note that the message is set from the XML rule declaration, so this is only relevantif you instantiate rules manually.

RuleContext now requires setting the current rule before callingapply. This isdone automatically byRuleSet#apply and such. Creating and configuring aRuleContext manually is strongly advised against, as the lifecycle ofRuleContextwill change drastically in PMD 7.

6.42.0

No changes.

6.41.0

Command Line Interface

The command line options for PMD and CPD now use GNU-style long options format. E.g. instead of-rulesets thepreferred usage is now--rulesets. Alternatively one can still use the short option-R.Some options also have been renamed to a more consistent casing pattern at the same time(--fail-on-violation instead of-failOnViolation).The old single-dash options are still supported but are deprecated and will be removed with PMD 7.This change makes the command line interface more consistent within PMD and also less surprisingcompared to other cli tools.

The changes in detail for PMD:

old optionnew option
-rulesets--rulesets (or-R)
-uri--uri
-dir--dir (or-d)
-filelist--file-list
-ignorelist--ignore-list
-format--format (or-f)
-debug--debug
-verbose--verbose
-help--help
-encoding--encoding
-threads--threads
-benchmark--benchmark
-stress--stress
-shortnames--short-names
-showsuppressed--show-suppressed
-suppressmarker--suppress-marker
-minimumpriority--minimum-priority
-property--property
-reportfile--report-file
-force-language--force-language
-auxclasspath--aux-classpath
-failOnViolation--fail-on-violation
--failOnViolation--fail-on-violation
-norulesetcompatibility--no-ruleset-compatibility
-cache--cache
-no-cache--no-cache

The changes in detail for CPD:

old optionnew option
--failOnViolation--fail-on-violation
-failOnViolation--fail-on-violation
--filelist--file-list

6.40.0

Experimental APIs

  • The interfaceASTCommentContainer 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 forASTCatchBlockStatement and used by the ruleEmptyCatchBlock.This information is also available via XPath attribute@ContainsComment.

6.39.0

No changes.

6.38.0

No changes.

6.37.0

PMD CLI

  • PMD has a new CLI option-force-language. With that a language can be forced to be used for all input files,irrespective of filenames. When using this option, the automatic language selection by extension is disabledand all files are tried to be parsed with the given language. Parsing errors are ignored and unparsable filesare skipped.

    This option allows to use the xml language for files, that don’t use xml as extension.See also the examples onPMD CLI reference.

Experimental APIs

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.

6.36.0

No changes.

6.35.0

Deprecated API

6.34.0

No changes.

6.33.0

No changes.

6.32.0

Experimental APIs

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 ruleAvoidUsingHardCodedIPRuleare deprecated and considered to be internal API. They will be removed with PMD 7.

6.31.0

Deprecated API

Experimental APIs

  • The methodGenericToken#getKind has been added as experimental. Thisunifies the token interface for both JavaCC and Antlr. The already existing methodAntlrToken#getKind is therefore experimental as well. Thereturned constant depends on the actual language and might change whenever the grammarof the language is changed.

6.30.0

Deprecated API

Around RuleSet parsing

Around thePMD class

Many classes around PMD’s entry point (PMD) have been deprecated as internal, including:

Miscellaneous

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.

6.29.0

No changes.

6.28.0

Deprecated API

For removal

6.27.0

  • XML rule definition in rulesets: In PMD 7, thelanguage attribute will be required on allruleelements that declare a new rule. Some base rule classes set the language implicitly in theirconstructor, and so this is not required in all cases for the rule to work. But thisbehavior will be discontinued in PMD 7, so missinglanguage attributes are nowreported as a forward compatibility warning.

Deprecated API

For removal

6.26.0

Deprecated API

For removal

6.25.0

  • The maven modulenet.sourceforge.pmd:pmd-scala is deprecated. Usenet.sourceforge.pmd:pmd-scala_2.13ornet.sourceforge.pmd:pmd-scala_2.12 instead.

  • Rule implementation classes are internal API and should not be used by clients directly.The rules should only be referenced via their entry in the corresponding category ruleset(e.g.<rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" />).

    While we definitely won’t move or rename the rule classes in PMD 6.x, we might consider changesin PMD 7.0.0 and onwards.

Deprecated APIs

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.

For removal

6.24.0

Deprecated APIs

Experimental APIs

Note: Experimental APIs are identified with the annotationExperimental,see its javadoc for details

6.23.0

Deprecated APIs

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.

In ASTs

As part of the changes we’d like to do to AST classes for 7.0.0, we would like tohide some methods and constructors that rule writers should not have access to.The following usages are now deprecated in theApex,Javascript,PL/SQL,Scala andVisualforce ASTs:

  • Manual instantiation of nodes.Constructors of node classes are deprecated andmarkedInternalApi. Nodes should only be obtained from the parser,which for rules, means that they never need to instantiate node themselves.Those constructors will be made package private with 7.0.0.
  • Subclassing of abstract node classes, or usage of their type. The base classes are internal APIand will be hidden in version 7.0.0. You should not couple your code to them.
  • In the meantime you should use interfaces likeVfNode orNode, or the other published interfaces in this package,to refer to nodes generically.
  • Concrete node classes willbe made final with 7.0.0.
  • Setters found in any node class or interface.Rules should consider the AST immutable.We will make those setters package private with 7.0.0.
  • The implementation classes ofParser (egVfParser) are deprecated and should not be used directly.UseLanguageVersionHandler#getParser instead.
  • The implementation classes ofTokenManager (egVfTokenManager) are deprecated and should not be used outside of our implementation.This also affects CPD-only modules.

These deprecations are added to the following language modules in this release.Please look at the package documentation to find out the full list of deprecations.

These deprecations have already been rolled out in a previous version for thefollowing languages:

Outside of these packages, these changes also concern the following TokenManagerimplementations, and their corresponding Parser if it exists (in the same package):

In theJava AST the following attributes are deprecated and will issue a warning when used in XPath rules:

For removal

6.22.0

Deprecated APIs

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.

For removal

In ASTs (JSP)

As part of the changes we’d like to do to AST classes for 7.0.0, we would like tohide some methods and constructors that rule writers should not have access to.The following usages are now deprecatedin the JSP AST (with other languages to come):

  • Manual instantiation of nodes.Constructors of node classes are deprecated andmarkedInternalApi. Nodes should only be obtained from the parser,which for rules, means that they never need to instantiate node themselves.Those constructors will be made package private with 7.0.0.
  • Subclassing of abstract node classes, or usage of their type. The base classes are internal APIand will be hidden in version 7.0.0. You should not couple your code to them.
  • In the meantime you should use interfaces likeJspNode orNode, or the other published interfaces in this package,to refer to nodes generically.
  • Concrete node classes willbe made final with 7.0.0.
  • Setters found in any node class or interface.Rules should consider the AST immutable.We will make those setters package private with 7.0.0.
  • The classJspParser is deprecated and should not be used directly.UseLanguageVersionHandler#getParser instead.

Please look atnet.sourceforge.pmd.lang.jsp.ast to find out the full list of deprecations.

In ASTs (Velocity)

As part of the changes we’d like to do to AST classes for 7.0.0, we would like tohide some methods and constructors that rule writers should not have access to.The following usages are now deprecatedin the VM AST (with other languages to come):

  • Manual instantiation of nodes.Constructors of node classes are deprecated andmarkedInternalApi. Nodes should only be obtained from the parser,which for rules, means that they never need to instantiate node themselves.Those constructors will be made package private with 7.0.0.
  • Subclassing of abstract node classes, or usage of their type. The base classes are internal APIand will be hidden in version 7.0.0. You should not couple your code to them.
  • In the meantime you should use interfaces likeVtlNode orNode, or the other published interfaces in this package,to refer to nodes generically.
  • Concrete node classes willbe made final with 7.0.0.
  • Setters found in any node class or interface.Rules should consider the AST immutable.We will make those setters package private with 7.0.0.
  • The packagenet.sourceforge.pmd.lang.vm.directive as well as the classesDirectiveMapper andLogUtil are deprecatedfor removal. They were only used internally during parsing.
  • The classVmParser is deprecated and should not be used directly.UseLanguageVersionHandler#getParser instead.

Please look atnet.sourceforge.pmd.lang.vm.ast to find out the full list of deprecations.

PLSQL AST

The production and nodeASTCursorBody was unnecessary, not used and has been removed. Cursors have been alreadyparsed asASTCursorSpecification.

6.21.0

Deprecated APIs

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.

For removal

6.20.0

No changes.

6.19.0

Deprecated APIs

For removal

Internal APIs

6.18.0

Changes to Renderer

  • Each renderer has now a new methodRenderer#setUseShortNames whichis used for implementing the “shortnames” CLI option. The method is automatically called by PMD, if thisCLI option is in use. When rendering filenames to the report, the new helper methodAbstractRenderer#determineFileName should be used. This will changethe filename to a short name, if the CLI option “shortnames” is used.

    Not adjusting custom renderers will make them render always the full file names and not honoring theCLI option “shortnames”.

Deprecated APIs

For removal

Internal APIs

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.

6.17.0

No changes.

6.16.0

Deprecated APIs

Reminder: Please don’t use members marked with the annotationInternalApi, as they willlikely be removed, hidden, or otherwise intentionally broken with 7.0.0.

In ASTs

As part of the changes we’d like to do to AST classes for 7.0.0, we would like tohide some methods and constructors that rule writers should not have access to.The following usages are now deprecatedin the Java AST (with other languages to come):

  • Manual instantiation of nodes.Constructors of node classes are deprecated and markedInternalApi. Nodes should only be obtained from the parser, which for rules, meansthat never need to instantiate node themselves. Those constructors will be made package private with 7.0.0.
  • Subclassing of abstract node classes, or usage of their type. Version 7.0.0 will bring a new set of abstractionsthat will be public API, but the base classes are and will stay internal. You should not couple your code to them.
    • In the meantime you should use interfaces likeJavaNode orNode, or the other published interfaces in this package, to refer to nodes generically.
    • Concrete node classes willbe made final with 7.0.0.
  • Setters found in any node class or interface.Rules should consider the AST immutable. We will make thosesetters package private with 7.0.0.

Please look atnet.sourceforge.pmd.lang.java.ast to find out the full listof deprecations.

6.15.0

Deprecated APIs

For removal

6.14.0

No changes.

6.13.0

Command Line Interface

The start scriptsrun.sh,pmd.bat andcpd.bat support the new environment variablePMD_JAVA_OPTS.This can be used to set arbitrary JVM options for running PMD, such as memory settings (e.g.PMD_JAVA_OPTS=-Xmx512m)or enable preview language features (e.g.PMD_JAVA_OPTS=--enable-preview).

The previously available variables such asOPTS orHEAPSIZE are deprecated and will be removed with PMD 7.0.0.

Deprecated API

  • CodeClimateRule is deprecated in 7.0.0 because it was unused for 2 years andcreated an unwanted dependency.Properties “cc_categories”, “cc_remediation_points_multiplier”, “cc_block_highlighting” will also be removed.See#1702 for more.

  • The Apex rulesetrulesets/apex/ruleset.xml has been deprecated and will be removed in 7.0.0. Please use the newquickstart rulesetrulesets/apex/quickstart.xml instead.

6.12.0

No changes.

6.11.0

6.10.0

Properties framework

The properties framework is about to get a lifting, and for that reason, we need to deprecate a lot of APIsto remove them in 7.0.0. The proposed changes to the API are describedon the wiki

Changes to how you define properties

Here’s an example:

// Before 7.0.0, these are equivalent:IntegerPropertymyProperty=newIntegerProperty("score","Top score value",1,100,40,3.0f);IntegerPropertymyProperty=IntegerProperty.named("score").desc("Top score value").range(1,100).defaultValue(40).uiOrder(3.0f);// They both map to the following in 7.0.0PropertyDescriptor<Integer>myProperty=PropertyFactory.intProperty("score").desc("Top score value").require(inRange(1,100)).defaultValue(40);

You’re highly encouraged to migrate to using this new API as soon as possible, to ease your migration to 7.0.0.

Architectural simplifications

Changes to the PropertyDescriptor interface

  • preferredRowCount is deprecated with no intended replacement. It was never implemented, and does not belongin this interface. The methodsuiOrder andcompareTo(PropertyDescriptor) are deprecated for thesame reason. These methods mix presentation logic with business logic and are not necessary for PropertyDescriptors to work.PropertyDescriptor will not extendComparable<PropertyDescriptor> anymore come 7.0.0.
  • The methodpropertyErrorFor is deprecated and will be removed with no intendedreplacement. It’s really just a shortcut forprop.errorFor(rule.getProperty(prop)).
  • TvalueFrom(String) andStringasDelimitedString(T) are deprecated and will be removed. These wereused to serialize and deserialize properties to/from a string, but 7.0.0 will introduce a more flexibleXML syntax which will make them obsolete.
  • isMultiValue andtype are deprecated and won’t be replaced. The new XML syntax will remove the needfor a divide between multi- and single-value properties, and will allow arbitrary types to be represented.Since arbitrary types may be represented,type will become obsolete as it can’t represent generic types,which will nevertheless be representable with the XML syntax. It was only used for documentation, but anew way to document these properties exhaustively will be added with 7.0.0.
  • errorFor is deprecated as its return type will be changed toOptional<String> with the shift to Java 8.

Deprecated APIs

For internalization

For removal

6.9.0

No changes.

6.8.0

  • A couple of methods and fields innet.sourceforge.pmd.properties.AbstractPropertySource have beendeprecated, as they are replaced by already existing functionality or expose internal implementationdetails:propertyDescriptors,propertyValuesByDescriptor,copyPropertyDescriptors(),copyPropertyValues(),ignoredProperties(),usesDefaultValues(),useDefaultValueFor().

  • Some methods innet.sourceforge.pmd.properties.PropertySource have been deprecated as well:usesDefaultValues(),useDefaultValueFor(),ignoredProperties().

  • The classnet.sourceforge.pmd.lang.rule.AbstractDelegateRule has been deprecated and willbe removed with PMD 7.0.0. It is internally only in use by RuleReference.

  • The default constructor ofnet.sourceforge.pmd.lang.rule.RuleReference has been deprecatedand will be removed with PMD 7.0.0. RuleReferences should only be created by providing a Rule anda RuleSetReference. Furthermore, the following methods are deprecated:setRuleReference(),hasOverriddenProperty(),usesDefaultValues(),useDefaultValueFor().

6.7.0

  • All classes in the packagenet.sourceforge.pmd.lang.dfa.report have been deprecated and will be removedwith PMD 7.0.0. This includes the classnet.sourceforge.pmd.lang.dfa.report.ReportTree. The reason is,that this class is very specific to Java and not suitable for other languages. It has only been used forYAHTMLRenderer, which has been rewritten to work without these classes.

  • The nodes RUNSIGNEDSHIFT and RSIGNEDSHIFT are deprecated and will be removed from the AST with PMD 7.0.0.These represented the operator of ShiftExpression in two cases out of three, but they’re not needed andmake ShiftExpression inconsistent. The operator of a ShiftExpression is now accessible throughShiftExpression#getOperator.

6.5.0

  • The utility classCommentUtil has been deprecated and will be removedwith PMD 7.0.0. Its methods have been intended to parse javadoc tags. A more useful solution will be addedaround the AST nodeFormalComment, which contains as childrenJavadocElement nodes, which inturn provide access to theJavadocTag.

    All comment AST nodes (FormalComment,MultiLineComment,SingleLineComment) have a new methodgetFilteredComment() which provide access to the comment text without the leading/* markers.

  • The methodAbstractCommentRule.tagsIndicesIn() has been deprecated and will be removed withPMD 7.0.0. It is not very useful, since it doesn’t extract the informationin a useful way. You would still need check, which tags have been found, and with whichdata they might be accompanied.

6.4.0

6.2.0

6.1.0

  • The methodgetXPathNodeName is added to theNode interface, which removes theuse oftoString of a node to get its XPath element name (see#569).
    • The default implementation provided inAbstractNode, will be removed with 7.0.0
    • With 7.0.0, theNode.toString method will not necessarily provide its XPath nodename anymore.
  • The interfacenet.sourceforge.pmd.cpd.Renderer has been deprecated. A new interfaceCPDRenderer has been introduced to replace it. The maindifference is that the new interface is meant to render directly to ajava.io.Writerrather than to a String. This allows to greatly reduce the memory footprint of CPD, as onlarge projects, with many duplications, it was causingOutOfMemoryErrors (see#795).

    net.sourceforge.pmd.cpd.FileReporter has also been deprecated as part of this change, as it’s no longer needed.

6.0.1

🐛 Fixed Issues

  • miscellaneous
    • #881: [all] Breaking API changes for 7.0.0
    • #896: [all] Use slf4j
    • #1431: [ui] Remove old GUI applications (designerold, bgastviewer)
    • #1451: [core] RulesetFactoryCompatibility stores the whole ruleset file in memory as a string
    • #2496: Update PMD 7 Logo on landing page
    • #2497: PMD 7 Logo page
    • #2498: Update PMD 7 Logo in documentation
    • #3797: [all] Use JUnit5
    • #4462: Provide Software Bill of Materials (SBOM)
    • #4460: Fix assembly-plugin warnings
    • #4582: [dist] Download link broken
    • #4586: Use explicit encoding in ruleset xml files
    • #4642: Update regression tests with Java 21 language features
    • #4691: [CVEs] Critical and High CEVs reported on PMD and PMD dependencies
    • #4699: Make PMD buildable with java 21
    • #4736: [ci] Improve build procedure
    • #4741: Add pmd-compat6 module for maven-pmd-plugin
    • #4749: Fixes NoSuchMethodError on processing errors in pmd-compat6
    • #4776: [ci] Upgrade to ruby 3
    • #4796: Remove deprecated and release rulesets
    • #4823: Update to use renamed pmd-designer
    • #4827: [compat6] Support config errors and cpd for csharp
    • #4830: Consolidate packages in each maven module
    • #4867: [dist] ./mvnw command not found in dist-src
  • ant
    • #4080: [ant] Split off Ant integration into a new submodule
  • core
    • #880: [core] Make visitors generic
    • #1027: [core] Apply the new PropertyDescriptor<Pattern> type where applicable
    • #1204: [core] Allow numeric properties in XML to be within an unbounded range
    • #1622: [core] NodeStream API
    • #1687: [core] Deprecate and Remove XPath 1.0 support
    • #1785: [core] Allow abstract node types to be valid rulechain visits
    • #1825: [core] Support NoAttribute for XPath
    • #2038: [core] Remove DCD
    • #2218: [core]isFindBoundary should not be an attribute
    • #2234: [core] Consolidate PMD CLI into a single command
    • #2239: [core] Merging Javacc build scripts
    • #2500: [core] Clarify API for ANTLR based languages
    • #2518: [core] Language properties
    • #2602: [core] Remove ParserOptions
    • #2614: [core] Upgrade Saxon, add XPath 3.1, remove Jaxen
    • #2696: [core] Remove DFA
    • #2821: [core] Rule processing error filenames are missing paths
    • #2873: [core] Utility classes in pmd 7
    • #2885: [core] Error recovery mode
    • #3203: [core] Replace RuleViolationFactory implementations with ViolationDecorator
    • #3692: [core] Analysis listeners
    • #3782: [core] Language lifecycle
    • #3815: [core] Update Saxon HE to 10.7
    • #3893: [core] Text documents
    • #3902: [core] Violation decorators
    • #3903: [core] Consolidaten.s.pmd.reporting package
    • #3905: [core] Stabilize tree export API
    • #3917: [core] Consolidaten.s.pmd.lang.rule package
    • #3918: [core] Make LanguageRegistry non static
    • #3919: [core] Merge CPD and PMD language
    • #3922: [core] Better error reporting for the ruleset parser
    • #4035: [core] ConcurrentModificationException in DefaultRuleViolationFactory
    • #4065: [core] Rename TokenMgrError to LexException, Tokenizer to CpdLexer
    • #4120: [core] Explicitly name all language versions
    • #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
    • #4309: [core] Cleanups in XPath area
    • #4312: [core] Remove unnecessary propertycolor and system propertypmd.color inTextColorRenderer
    • #4313: [core] Remove support for <lang>-<ruleset> hyphen notation for ruleset references
    • #4314: [core] Remove ruleset compatibility filter (RuleSetFactoryCompatibility) and CLI option--no-ruleset-compatibility
    • #4323: [core] Refactor CPD integration
    • #4348: [core] Consolidate @InternalApi classes
    • #4349: [core] Cleanup remaining experimental and deprecated API
    • #4353: [core] Micro optimizations for Node API
    • #4365: [core] Improve benchmarking
    • #4397: [core] Refactor CPD
    • #4378: [core] Ruleset loading processes commented rules
    • #4420: [core] Remove PMD.EOL
    • #4425: [core] Replace TextFile::pathId
    • #4454: [core] “Unknown option: ‘-min’” but is referenced in documentation
    • #4611: [core] Fix loading language properties from env vars
    • #4621: [core] MakeClasspathClassLoader::getResource child first
    • #4674: [core] WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass
    • #4694: [core] Fix line/col numbers in TokenMgrError
    • #4717: [core] XSLTRenderer doesn’t close report file
    • #4750: [core] Fix flaky SummaryHTMLRenderer
    • #4782: [core] Avoid using getImage/@Image
  • cli
    • #2234: [core] Consolidate PMD CLI into a single command
    • #3828: [core] Progress reporting
    • #4079: [cli] Split off CLI implementation into a pmd-cli submodule
    • #4423: [cli] Fix NPE when only--file-list is specified
    • #4482: [cli] pmd.bat can only be executed once
    • #4484: [cli] ast-dump with no properties produce an NPE
    • #4594: [cli] Change completion generation to runtime
    • #4685: [cli] Clarify CPD documentation, fix positional parameter handling
    • #4723: [cli] Launch fails for “bash pmd”
  • doc
    • #995: [doc] Document API evolution principles as ADR
    • #2501: [doc] Verify ANTLR Documentation
    • #2511: [doc] Review guides for writing java/xpath rules for correctness with PMD 7
    • #3175: [doc] Document language module features
    • #4294: [doc] Migration Guide for upgrading PMD 6 ➡️ 7
    • #4303: [doc] Document new property framework
    • #4308: [doc] Document XPath API @DeprecatedAttribute
    • #4319: [doc] Document TypeRes API and Symbols API
    • #4438: [doc] Documentation links in VS Code are outdated
    • #4521: [doc] Website is not mobile friendly
    • #4676: [doc] Clarify how CPD--ignore-literals and--ignore-identifiers work
    • #4659: [doc] Improve ant documentation
    • #4669: [doc] Add bld PMD Extension to Tools / Integrations
    • #4704: [doc] Multivalued properties do not accept | as a separator
  • testing
    • #2435: [test] Remove duplicated Dummy language module
    • #4234: [test] Tests that change the logging level do not work

Language specific fixes:

  • apex
    • #1937: [apex] Apex should only have a single RootNode
    • #1648: [apex,vf] Remove CodeClimate dependency
    • #1750: [apex] Remove apex statistical rules
    • #2836: [apex] Remove Apex ProjectMirror
    • #3766: [apex] Replace Jorje with fully open source front-end
    • #3973: [apex] Update parser to support new ‘as user’ keywords (User Mode for Database Operations)
    • #4427: [apex] ApexBadCrypto test failing to detect inline code
    • #4453: [apex] [7.0-rc1] Exception while initializing Apexlink (Index 34812 out of bounds for length 34812)
    • #4828: [apex] Support null coalescing operator ?? (apex 60)
    • #4845: [apex] Use same ANLTR version for apex-parser
  • apex-design
    • #2667: [apex] Integrate nawforce/ApexLink to build robust Unused rule
    • #4509: [apex] ExcessivePublicCount doesn’t consider inner classes correctly
    • #4596: [apex] ExcessivePublicCount ignores properties
  • apex-documentation
    • #4774: [apex] ApexDoc false-positive for the first method of an annotated Apex class
  • apex-performance
    • #4675: [apex] New Rule: OperationWithHighCostInLoop
  • apex-security
    • #4646: [apex] ApexSOQLInjection does not recognise SObjectType or SObjectField as safe variable types
  • groovy
    • #4726: [groovy] Support Groovy to 3 and 4 and CPD suppressions
  • java
    • #520: [java] Allow@SuppressWarnings with constants instead of literals
    • #864: [java] Similar/duplicated implementations for determining FQCN
    • #905: [java] Add new node for anonymous class declaration
    • #910: [java] AST inconsistency between primitive and reference type arrays
    • #997: [java] Java8 parsing corner case with annotated array types
    • #998: [java] AST inconsistencies around FormalParameter
    • #1019: [java] Breaking Java Grammar changes for PMD 7.0.0
    • #1124: [java] ImmutableList implementation in the qname codebase
    • #1128: [java] Improve ASTLocalVariableDeclaration
    • #1150: [java] ClassOrInterfaceType AST improvements
    • #1207: [java] Resolve explicit types using FQCNs, without hitting the classloader
    • #1307: [java] AccessNode API changes
    • #1367: [java] Parsing error on annotated inner class
    • #1661: [java] About operator nodes
    • #2366: [java] Remove qualified names
    • #2819: [java] GLB bugs in pmd 7
    • #3642: [java] Parse error on rare extra dimensions on method return type on annotation methods
    • #3763: [java] Ambiguous reference error in valid code
    • #3749: [java] ImproveisOverridden in ASTMethodDeclaration
    • #3750: [java] Make symbol table support instanceof pattern bindings
    • #3751: [java] Rename some node types
    • #3752: [java] Expose annotations in symbol API
    • #4237: [java] Cleanup handling of Java comments
    • #4317: [java] Some AST nodes should not be TypeNodes
    • #4359: [java] Type resolution fails with NPE when the scope is not a type declaration
    • #4367: [java] Move testrule TypeResTest into internal
    • #4383: [java] IllegalStateException: Object is not an array type!
    • #4401: [java] PMD 7 fails to build under Java 19
    • #4405: [java] Processing error with ArrayIndexOutOfBoundsException
    • #4583: [java] Support JDK 21 (LTS)
    • #4628: [java] Support loading classes from java runtime images
    • #4753: [java] PMD crashes while using generics and wildcards
    • #4757: [java] Intermittent NPEs while analyzing Java code
    • #4794: [java] Support JDK 22
  • java-bestpractices
    • #342: [java] AccessorMethodGeneration: Name clash with another public field not properly handled
    • #755: [java] AccessorClassGeneration false positive for private constructors
    • #770: [java] UnusedPrivateMethod yields false positive for counter-variant arguments
    • #807: [java] AccessorMethodGeneration false positive with overloads
    • #833: [java] ForLoopCanBeForeach should consider iterating on this
    • #1189: [java] UnusedPrivateMethod false positive from inner class via external class
    • #1205: [java] Improve ConstantsInInterface message to mention alternatives
    • #1212: [java] Don’t raise JUnitTestContainsTooManyAsserts on JUnit 5’s assertAll
    • #1422: [java] JUnitTestsShouldIncludeAssert false positive with inherited @Rule field
    • #1455: [java] JUnitTestsShouldIncludeAssert: False positives for assert methods named “check” and “verify”
    • #1563: [java] ForLoopCanBeForeach false positive with method call using index variable
    • #1565: [java] JUnitAssertionsShouldIncludeMessage false positive with AssertJ
    • #1747: [java] PreserveStackTrace false-positive
    • #1969: [java] MissingOverride false-positive triggered by package-private method overwritten in another package by extending class
    • #1998: [java] AccessorClassGeneration false-negative: subclass calls private constructor
    • #2130: [java] UnusedLocalVariable: false-negative with array
    • #2147: [java] JUnitTestsShouldIncludeAssert - false positives with lambdas and static methods
    • #2464: [java] LooseCoupling must ignore class literals: ArrayList.class
    • #2542: [java] UseCollectionIsEmpty can not detect the casefoo.bar().size()
    • #2650: [java] UseTryWithResources false positive when AutoCloseable helper used
    • #2796: [java] UnusedAssignment false positive with call chains
    • #2797: [java] MissingOverride long-standing issues
    • #2806: [java] SwitchStmtsShouldHaveDefault false-positive with Java 14 switch non-fallthrough branches
    • #2822: [java] LooseCoupling rule: Extend to cover user defined implementations and interfaces
    • #2843: [java] Fix UnusedAssignment FP with field accesses
    • #2882: [java] UseTryWithResources - false negative for explicit close
    • #2883: [java] JUnitAssertionsShouldIncludeMessage false positive with method call
    • #2890: [java] UnusedPrivateMethod false positive with generics
    • #2946: [java] SwitchStmtsShouldHaveDefault false positive on enum inside enums
    • #3672: [java] LooseCoupling - fix false positive with generics
    • #3675: [java] MissingOverride - fix false positive with mixing type vars
    • #3858: [java] UseCollectionIsEmpty should infer local variable type from method invocation
    • #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
    • #4516: [java] UnusedLocalVariable: false-negative with try-with-resources
    • #4517: [java] UnusedLocalVariable: false-negative with compound assignments
    • #4518: [java] UnusedLocalVariable: false-positive with multiple for-loop indices
    • #4603: [java] UnusedAssignment false positive in record compact constructor
    • #4625: [java] UnusedPrivateMethod false positive: Autoboxing into Number
    • #4634: [java] JUnit4TestShouldUseTestAnnotation false positive with TestNG
    • #4817: [java] UnusedPrivateMethod false-positive used in lambda
  • java-codestyle
    • #1208: [java] PrematureDeclaration rule false-positive on variable declared to measure time
    • #1429: [java] PrematureDeclaration as result of method call (false positive)
    • #1480: [java] IdenticalCatchBranches false positive with return expressions
    • #1673: [java] UselessParentheses false positive with conditional operator
    • #1790: [java] UnnecessaryFullyQualifiedName false positive with enum constant
    • #1918: [java] UselessParentheses false positive with boolean operators
    • #2134: [java] PreserveStackTrace not handlingThrowable.addSuppressed(...)
    • #2299: [java] UnnecessaryFullyQualifiedName false positive with similar package name
    • #2391: [java] UseDiamondOperator FP when expected type and constructed type have a different parameterization
    • #2528: [java] MethodNamingConventions - JUnit 5 method naming not support ParameterizedTest
    • #2739: [java] UselessParentheses false positive for string concatenation
    • #2748: [java] UnnecessaryCast false positive with unchecked cast
    • #2847: [java] New Rule: Use Explicit Types
    • #2973: [java] New rule: UnnecessaryBoxing
    • #3195: [java] Improve rule UnnecessaryReturn to detect more cases
    • #3218: [java] Generalize UnnecessaryCast to flag all unnecessary casts
    • #3221: [java] PrematureDeclaration false positive for unused variables
    • #3238: [java] Improve ExprContext, fix FNs of UnnecessaryCast
    • #3500: [java] UnnecessaryBoxing - check for Integer.valueOf(String) calls
    • #4239: [java] UnnecessaryLocalBeforeReturn - false positive with catch clause
    • #4268: [java] CommentDefaultAccessModifier: false positive with TestNG annotations
    • #4273: [java] CommentDefaultAccessModifier ignoredAnnotations should include “org.junit.jupiter.api.extension.RegisterExtension” by default
    • #4357: [java] Fix IllegalStateException in UseDiamondOperator rule
    • #4432: [java] [7.0-rc1] UnnecessaryImport - Unused static import is being used
    • #4455: [java] FieldNamingConventions: false positive with lombok’s @UtilityClass
    • #4487: [java] UnnecessaryConstructor: false-positive with @Inject and @Autowired
    • #4511: [java] LocalVariableCouldBeFinal shouldn’t report unused variables
    • #4512: [java] MethodArgumentCouldBeFinal shouldn’t report unused parameters
    • #4557: [java] UnnecessaryImport FP with static imports of overloaded methods
    • #4578: [java] CommentDefaultAccessModifier comment needs to be before annotation if present
    • #4631: [java] UnnecessaryFullyQualifiedName fails to recognize illegal self reference in enums
    • #4645: [java] CommentDefaultAccessModifier - False Positive with JUnit5’s ParameterizedTest
    • #4754: [java] EmptyControlStatementRule: Add allowCommentedBlocks property
    • #4816: [java] UnnecessaryImport false-positive on generic method call with on lambda
  • java-design
    • #174: [java] SingularField false positive with switch in method that both assigns and reads field
    • #1014: [java] LawOfDemeter: False positive with lambda expression
    • #1605: [java] LawOfDemeter: False positive for standard UTF-8 charset name
    • #2160: [java] Issues with Law of Demeter
    • #2175: [java] LawOfDemeter: False positive for chained methods with generic method call
    • #2179: [java] LawOfDemeter: False positive with static property access - should treat class-level property as global object, not dot-accessed property
    • #2180: [java] LawOfDemeter: False positive with Thread and ThreadLocalRandom
    • #2182: [java] LawOfDemeter: False positive with package-private access
    • #2188: [java] LawOfDemeter: False positive with fields assigned to local vars
    • #2536: [java] ClassWithOnlyPrivateConstructorsShouldBeFinal can’t detect inner class
    • #3668: [java] ClassWithOnlyPrivateConstructorsShouldBeFinal - fix FP with inner private classes
    • #3754: [java] SingularField false positive with read in while condition
    • #3786: [java] SimplifyBooleanReturns should consider operator precedence
    • #3840: [java] LawOfDemeter disallows method call on locally created object
    • #4238: [java] Make LawOfDemeter not use the rulechain
    • #4254: [java] ImmutableField - false positive with Lombok @Setter
    • #4434: [java] [7.0-rc1] ExceptionAsFlowControl when simply propagating
    • #4456: [java] FinalFieldCouldBeStatic: false positive with lombok’s @UtilityClass
    • #4477: [java] SignatureDeclareThrowsException: false-positive with TestNG annotations
    • #4490: [java] ImmutableField - false negative with Lombok @Getter
    • #4549: [java] Make LawOfDemeter results deterministic
  • java-documentation
    • #4369: [java] Improve CommentSize
    • #4416: [java] Fix reported line number in CommentContentRule
  • java-errorprone
    • #659: [java] MissingBreakInSwitch - last default case does not contain a break
    • #718: [java] BrokenNullCheck false positive with parameter/field confusion
    • #932: [java] SingletonClassReturningNewInstance false positive with double assignment
    • #1005: [java] CloneMethodMustImplementCloneable triggers for interfaces
    • #1669: [java] NullAssignment - FP with ternay and null as constructor argument
    • #1831: [java] DetachedTestCase reports abstract methods
    • #1899: [java] Recognize @SuppressWanings(“fallthrough”) for MissingBreakInSwitch
    • #2320: [java] NullAssignment - FP with ternary and null as method argument
    • #2532: [java] AvoidDecimalLiteralsInBigDecimalConstructor can not detect the casenew BigDecimal(Expression)
    • #2579: [java] MissingBreakInSwitch detects the lack of break in the last case
    • #2880: [java] CompareObjectsWithEquals - false negative with type res
    • #2893: [java] Remove special cases from rule EmptyCatchBlock
    • #2894: [java] Improve MissingBreakInSwitch
    • #3071: [java] BrokenNullCheck FP with PMD 6.30.0
    • #3087: [java] UnnecessaryBooleanAssertion overlaps with SimplifiableTestAssertion
    • #3100: [java] UseCorrectExceptionLogging FP in 6.31.0
    • #3173: [java] UseProperClassLoader false positive
    • #3351: [java] ConstructorCallsOverridableMethod ignores abstract methods
    • #3400: [java] AvoidUsingOctalValues FN with underscores
    • #3843: [java] UseEqualsToCompareStrings should consider return type
    • #4063: [java] AvoidBranchingStatementAsLastInLoop: False-negative about try/finally block
    • #4356: [java] Fix NPE in CloseResourceRule
    • #4449: [java] AvoidAccessibilityAlteration: Possible false positive in AvoidAccessibilityAlteration rule when using Lambda expression
    • #4457: [java] OverrideBothEqualsAndHashcode: false negative with anonymous classes
    • #4493: [java] MissingStaticMethodInNonInstantiatableClass: false-positive about @Inject
    • #4505: [java] ImplicitSwitchFallThrough NPE in PMD 7.0.0-rc1
    • #4510: [java] ConstructorCallsOverridableMethod: false positive with lombok’s @Value
    • #4513: [java] UselessOperationOnImmutable various false negatives with String
    • #4514: [java] AvoidLiteralsInIfCondition false positive and negative for String literals when ignoreExpressions=true
    • #4546: [java] OverrideBothEqualsAndHashCode ignores records
    • #4719: [java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string
  • java-multithreading
    • #2537: [java] DontCallThreadRun can’t detect the case that call run() inthis.run()
    • #2538: [java] DontCallThreadRun can’t detect the case that call run() infoo.bar.run()
    • #2577: [java] UseNotifyAllInsteadOfNotify falsely detect a special case with argument:foo.notify(bar)
    • #4483: [java] NonThreadSafeSingleton false positive with double-checked locking
  • java-performance
    • #1224: [java] InefficientEmptyStringCheck false negative in anonymous class
    • #2587: [java] AvoidArrayLoops could also check for list copy through iterated List.add()
    • #2712: [java] SimplifyStartsWith false-positive with AssertJ
    • #3486: [java] InsufficientStringBufferDeclaration: Fix NPE
    • #3848: [java] StringInstantiation: false negative when using method result
    • #4070: [java] A false positive about the rule RedundantFieldInitializer
    • #4458: [java] RedundantFieldInitializer: false positive with lombok’s @Value
  • javascript
    • #4673: [javascript] CPD: Added support for decorator notation
  • kotlin
    • #419: [kotlin] Add support for Kotlin
    • #4389: [kotlin] Update grammar to version 1.8
  • plsql
    • #4820: [plsql] WITH clause is ignored for SELECT INTO statements
  • swift
    • #1877: [swift] Feature/swift rules
    • #1882: [swift] UnavailableFunction Swift rule
    • #4697: [swift] Support Swift 5.9 features (mainly macros expansion expressions)
  • xml
    • #1800: [xml] Unimplement org.w3c.dom.Node from the XmlNodeWrapper
  • xml-bestpractices
    • #4592: [xml] Add MissingEncoding rule

✨ External Contributions

  • #1658: [core] Node support for Antlr-based languages -Matías Fraga (@matifraga)
  • #1698: [core] [swift] Antlr Base Parser adapter and Swift Implementation -Lucas Soncini (@lsoncini)
  • #1774: [core] Antlr visitor rules -Lucas Soncini (@lsoncini)
  • #1877: [swift] Feature/swift rules -Matías Fraga (@matifraga)
  • #1881: [doc] Add ANTLR documentation -Matías Fraga (@matifraga)
  • #1882: [swift] UnavailableFunction Swift rule -Tomás de Lucca (@tomidelucca)
  • #2830: [apex] Apexlink POC -Kevin Jones (@nawforce)
  • #3866: [core] Add CLI Progress Bar -@JerritEic (@JerritEic)
  • #4093: [apex] Summit-AST Apex module - Part 1 -Edward Klimoshenko (@eklimo)
  • #4151: [apex] Summit-AST Apex module - Part 2 - expression nodes -Aaron Hurst (@aaronhurst-google)
  • #4171: [apex] Summit-AST Apex module - Part 3 - initializers -Aaron Hurst (@aaronhurst-google)
  • #4206: [apex] Summit-AST Apex module - Part 4 - statements -Aaron Hurst (@aaronhurst-google)
  • #4219: [apex] Summit-AST Apex module - Part 5 - annotations, triggers, misc. -Aaron Hurst (@aaronhurst-google)
  • #4242: [apex] Merge 6.52 into experimental-apex-parser -Aaron Hurst (@aaronhurst-google)
  • #4251: [apex] Summit-AST Apex module - Part 6 Passing testsuite -Aaron Hurst (@aaronhurst-google)
  • #4402: [javascript] CPD: add support for Typescript using antlr4 grammar -Paul Guyot (@pguyot)
  • #4403: [julia] CPD: Add support for Julia code duplication -Wener (@wener-tiobe)
  • #4412: [doc] Added new error msg to ConstantsInInterface -David Ljunggren (@dague1)
  • #4426: [cpd] New XML to HTML XLST report format for PMD CPD -mohan-chinnappan-n (@mohan-chinnappan-n)
  • #4428: [apex] ApexBadCrypto bug fix for #4427 - inline detection of hard coded values -Steven Stearns (@sfdcsteve)
  • #4431: [coco] CPD: Coco support for code duplication detection -Wener (@wener-tiobe)
  • #4444: [java] CommentDefaultAccessModifier - ignore org.junit.jupiter.api.extension.RegisterExtension by default -Nirvik Patel (@nirvikpatel)
  • #4448: [apex] Bump summit-ast to new release 2.1.0 (and remove workaround) -Aaron Hurst (@aaronhurst-google)
  • #4450: [java] Fix #4449 AvoidAccessibilityAlteration: Correctly handle Lambda expressions in PrivilegedAction scenarios -Seren (@mohui1999)
  • #4452: [doc] Update PMD_APEX_ROOT_DIRECTORY documentation reference -nwcm (@nwcm)
  • #4470: [cpp] CPD: Added strings as literal and ignore identifiers in sequences -Wener (@wener-tiobe)
  • #4474: [java] ImmutableField: False positive with lombok (fixes #4254) -Pim van der Loos (@PimvanderLoos)
  • #4479: [apex] Merge main (7.x) branch into experimental-apex-parser and fix tests -Aaron Hurst (@aaronhurst-google)
  • #4488: [java] Fix #4477: A false-positive about SignatureDeclareThrowsException -AnnaDev (@LynnBroe)
  • #4494: [java] Fix #4487: A false-positive about UnnecessaryConstructor and @Inject and @Autowired -AnnaDev (@LynnBroe)
  • #4495: [java] Fix #4493: false-positive about MissingStaticMethodInNonInstantiatableClass and @Inject -AnnaDev (@LynnBroe)
  • #4507: [java] Fix #4503: A false negative about JUnitTestsShouldIncludeAssert and TestNG -AnnaDev (@LynnBroe)
  • #4520: [doc] Fix typo: missing closing quotation mark after CPD-END -João Dinis Ferreira (@joaodinissf)
  • #4528: [apex] Update to apexlink -Kevin Jones (@nawforce)
  • #4533: [java] Fix #4063: False-negative about try/catch block in Loop -AnnaDev (@LynnBroe)
  • #4536: [java] Fix #4268: CommentDefaultAccessModifier - false positive with TestNG’s @Test annotation -AnnaDev (@LynnBroe)
  • #4537: [java] Fix #4455: A false positive about FieldNamingConventions and UtilityClass -AnnaDev (@LynnBroe)
  • #4538: [java] Fix #4456: A false positive about FinalFieldCouldBeStatic and UtilityClass -AnnaDev (@LynnBroe)
  • #4540: [java] Fix #4457: false negative about OverrideBothEqualsAndHashcode -AnnaDev (@LynnBroe)
  • #4541: [java] Fix #4458: A false positive about RedundantFieldInitializer and @Value -AnnaDev (@LynnBroe)
  • #4542: [java] Fix #4510: A false positive about ConstructorCallsOverridableMethod and @Value -AnnaDev (@LynnBroe)
  • #4553: [java] Fix #4492: GuardLogStatement gives false positive when argument is a Java method reference -Anastasiia Koba (@anastasiia-koba)
  • #4562: [apex] Fixes #4556 - Update Apex bind regex match for all possible combinations -nwcm (@nwcm)
  • #4637: [java] fix #4634 - JUnit4TestShouldUseTestAnnotation false positive with TestNG -Krystian Dabrowski (@krdabrowski)
  • #4640: [cli] Launch script fails if run via “bash pmd” -Shai Bennathan (@shai-bennathan)
  • #4649: [apex] Add SObjectType and SObjectField to list of injectable SOQL variable types -Richard Corfield (@rcorfieldffdc)
  • #4651: [doc] Add “Tencent Cloud Code Analysis” in Tools / Integrations -yale (@cyw3)
  • #4664: [cli] CPD: Fix NPE when only--file-list is specified -Wener (@wener-tiobe)
  • #4665: [java] Doc: Fix references AutoClosable -> AutoCloseable -Andrey Bozhko (@AndreyBozhko)
  • #4673: [javascript] CPD: Added support for decorator notation -Wener (@wener-tiobe)
  • #4677: [apex] Add new rule: OperationWithHighCostInLoop -Thomas Prouvot (@tprouvot)
  • #4698: [swift] Add macro expansion support for swift 5.9 -Richard B. (@kenji21)
  • #4706: [java] DetachedTestCase should not report on abstract methods -Debamoy Datta (@Debamoy)
  • #4719: [java] UnnecessaryCaseChange: example doc toUpperCase() should compare to a capitalized string -ciufudean (@ciufudean)
  • #4738: [doc] Added reference to the PMD extension for bld -Erik C. Thauvin (@ethauvin)
  • #4749: Fixes NoSuchMethodError on processing errors in pmd-compat6 -Andreas Bergander (@bergander)
  • #4750: [core] Fix flaky SummaryHTMLRenderer -219sansim (@219sansim)
  • #4752: [core] Fix flaky LatticeRelationTest -219sansim (@219sansim)
  • #4754: [java] EmptyControlStatementRule: Add allowCommentedBlocks property -Andreas Bergander (@bergander)
  • #4759: [java] fix: remove delimiter attribute from ruleset category/java/errorprone.xml -Marcin Dąbrowski (@marcindabrowski)
  • #4825: [plsql] Fix ignored WITH clause for SELECT INTO statements -Laurent Bovet (@lbovet)
  • #4857: [javascript] Fix UnnecessaryBlock issues with empty statements -Oleksandr Shvets (@oleksandr-shvets)

This documentation is written in markdown.
If there is something missing or can be improved, edit this page on github and create a PR: Edit on GitHub

©2026 PMD Open Source Project. All rights reserved.
Site last generated: Jan 30, 2026

PMD                logo


[8]ページ先頭

©2009-2026 Movatter.jp