26 November 2022
The PMD team is pleased to announce PMD 6.52.0.
This is a minor release.
InvalidJavaBeanidentifies beans, that don’t follow the JavaBeans API specification, like beans with missing getters or setters.
The Java rule
BeanMembersShouldSerialize has been renamed to
NonSerializableClass. It has been revamped to only check for classes that are marked with
Serializable and reports each field in it, that is not serializable.
prefix has been deprecated, since in a serializable class all fields have to be
serializable regardless of the name.
ClassNamingConventions has a new property
testClassPattern, which is applied
to test classes. By default, test classes should end with the suffix “Test”. Test classes are top-level classes, that
either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from
JUnit4/5 or TestNG.
ignoredAnnotations of rule
ImmutableField has been deprecated and doesn’t
have any effect anymore.
Since PMD 6.47.0, the rule only considers fields, that are initialized once and never changed. If the field is just
declared but never explicitly initialized, it won’t be reported. That’s the typical case when a framework sets
the field value by reflection. Therefore, the property is not needed anymore. If there is a special case where
this rule misidentifies fields as immutable, then the rule should be suppressed for these fields explicitly.
PMD now supports a new
--use-version flag, which receives a language-version pair (such as
This supersedes the usage of
-v, allowing for multiple versions to be set in a single run.
PMD 7 will completely remove support for
-version in favor of this new flag.
-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.
-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.
--diras an alias to
--files, in favor of consistency with PMD. PMD 7 will remove support for
--filesin favor of these new flags.
run.sh cpdgui will now warn about it being deprecated. Use
run.sh cpd-gui instead.
The old designer (
run.sh designerold) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer:
The old visual AST viewer (
run.sh bgastviewer) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer:
run.sh designer for a visual tool, or use
run.sh ast-dump for a text-based alternative.
PMD.StatusCode- PMD 7 will ship with a revamped CLI split from pmd-core. To programmatically launch analysis you can use
PMDConfiguration#getAllInputPaths- It is now superseded by
PMDConfiguration#setInputPaths- It is now superseded by
PMDConfiguration#addInputPath- It is now superseded by
PMDConfiguration#getInputFilePath- It is now superseded by
PMDConfiguration#getIgnoreFilePath- It is now superseded by
PMDConfiguration#setInputFilePath- It is now superseded by
PMDConfiguration#setIgnoreFilePath- It is now superseded by
PMDConfiguration#getInputUri- It is now superseded by
PMDConfiguration#setInputUri- It is now superseded by
PMDConfiguration#getReportFile- It is now superseded by
PMDConfiguration#setReportFile- It is now superseded by
PMDConfiguration#setStressTest- Will be removed with no replacement.
PMDConfiguration#setBenchmark- Will be removed with no replacement, the CLI will still support it.
CPD.StatusCode- PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time.
DataType#fromBasicTypehas been deprecated. The equivalent method
fromTypeNameshould be used instead.