11 KiB
title, permalink, keywords
title | permalink | keywords |
---|---|---|
PMD Release Notes | pmd_release_notes.html | changelog, release notes |
{{ site.pmd.date }} - {{ site.pmd.version }}
The PMD team is pleased to announce PMD {{ site.pmd.version }}.
This is a {{ site.pmd.release_type }} release.
{% tocmaker is_release_notes_processor %}
New and noteworthy
Modelica support
Thanks to Anatoly Trosinenko PMD supports now a new language: Modelica is a language to model complex physical systems. Both PMD and CPD are supported and there are already 3 rules available. The PMD Designer supports syntax highlighting for Modelica.
While the language implementation is quite complete, Modelica support is considered experimental for now. This is to allow us to change the rule API (e.g. the AST classes) slightly and improve the implementation based on your feedback.
Simple XML dump of AST
We added a experimental feature to dump the AST of a source file into XML. The XML format is of course PMD specific and language dependent. That XML file can be used to execute (XPath) queries against without PMD. It can also be used as a textual visualization of the AST if you don't want to use the Designer.
This feature is experimental and might change or even be removed in the future, if it is not useful. A short description how to use it is available under Creating XML dump of the AST.
Any feedback about it, especially about your use cases, is highly appreciated.
Updated Apex Support
- The Apex language support has been bumped to version 48 (Spring '20). All new language features are now properly parsed and processed.
CPD XML format
The CPD XML output format has been enhanced to also report column information for found duplications in addition to the line information. This allows to display the exact tokens, that are considered duplicate.
If a CPD language doesn't provide these exact information, then these additional attributes are omitted.
Each <file>
element in the XML format now has 3 new attributes:
- attribute
endLine
- attribute
beginColumn
(if there is column information available) - attribute
endColumn
(if there is column information available)
Modified Rules
-
The Java rule {% rule "java/errorprone/AvoidLiteralsInIfCondition" %} (
java-errorprone
) has a new propertyignoreExpressions
. This property is set by default totrue
in order to maintain compatibility. If this property is set to false, then literals in more complex expressions are considered as well. -
The Apex rule {% rule "apex/errorprone/ApexCSRF" %} (
apex-errorprone
) has been moved from category "Security" to "Error Prone". The Apex runtime already prevents DML statements from being executed, but only at runtime. So, if you try to do this, you'll get an error at runtime, hence this is error prone. See also the discussion on #2064. -
The Java rule {% rule "java/documentation/CommentRequired" %} (
java-documentation
) has a new propertyclassCommentRequirement
. This replaces the now deprecated propertyheaderCommentRequirement
, since the name was misleading. (File) header comments are not checked, but class comments are.
Fixed Issues
- apex
- #2208: [apex] ASTFormalComment should implement ApexNode<T>
- core
- #1984: [java] Cyclomatic complexity is misreported (lack of clearing metrics cache)
- #2006: [core] PMD should warn about multiple instances of the same rule in a ruleset
- #2161: [core] ResourceLoader is deprecated and marked as internal but is exposed
- #2170: [core] DocumentFile doesn't preserve newlines
- doc
- #2214: [doc] Link broken in pmd documentation for writing Xpath rules
- java
- #2212: [java] JavaRuleViolation reports wrong class name
- java-bestpractices
- #2149: [java] JUnitAssertionsShouldIncludeMessage - False positive with assertEquals and JUnit5
- java-codestyle
- #2167: [java] UnnecessaryLocalBeforeReturn false positive with variable captured by method reference
- java-documentation
- #1683: [java] CommentRequired property names are inconsistent
- java-errorprone
- java-performance
- #2141: [java] StringInstatiation: False negative with String-array access
- plsql
API Changes
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.
-
{% jdoc java::lang.java.JavaLanguageHandler %}
-
{% jdoc java::lang.java.JavaLanguageParser %}
-
{% jdoc java::lang.java.JavaDataFlowHandler %}
-
Implementations of {% jdoc core::lang.rule.RuleViolationFactory %} in each language module, eg {% jdoc java::lang.java.rule.JavaRuleViolationFactory %}. See javadoc of {% jdoc core::lang.rule.RuleViolationFactory %}.
-
Implementations of {% jdoc core::RuleViolation %} in each language module, eg {% jdoc java::lang.java.rule.JavaRuleViolation %}. See javadoc of {% jdoc core::RuleViolation %}.
-
{% jdoc core::rules.RuleFactory %}
-
{% jdoc core::rules.RuleBuilder %}
-
Constructors of {% jdoc core::RuleSetFactory %}, use factory methods from {% jdoc core::RulesetsFactoryUtils %} instead
-
{% jdoc core::RulesetsFactoryUtils#getRulesetFactory(core::PMDConfiguration, core::util.ResourceLoader) %}
-
{% jdoc apex::lang.apex.ast.AbstractApexNode %}
-
{% jdoc apex::lang.apex.ast.AbstractApexNodeBase %}, and the related
visit
methods on {% jdoc apex::lang.apex.ast.ApexParserVisitor %} and its implementations. Use {% jdoc apex::lang.apex.ast.ApexNode %} instead, now considers comments too. -
{% jdoc core::lang.ast.CharStream %}, {% jdoc core::lang.ast.JavaCharStream %}, {% jdoc core::lang.ast.SimpleCharStream %}: these are APIs used by our JavaCC implementations and that will be moved/refactored for PMD 7.0.0. They should not be used, extended or implemented directly.
For removal
- pmd-core
- Many methods on the {% jdoc core::lang.ast.Node %} interface and {% jdoc core::lang.ast.AbstractNode %} base class. See their javadoc for details.
- {% jdoc !!core::lang.ast.Node#isFindBoundary() %} is deprecated for XPath queries.
- pmd-java
- {% jdoc java::lang.java.AbstractJavaParser %}
- {% jdoc java::lang.java.AbstractJavaHandler %}
ASTAnyTypeDeclaration.TypeKind
- {% jdoc !!java::lang.java.ast.ASTAnyTypeDeclaration#getKind() %}
- {% jdoc java::lang.java.ast.JavaQualifiedName %}
- {% jdoc !!java::lang.java.ast.ASTCatchStatement#getBlock() %}
- {% jdoc !!java::lang.java.ast.ASTCompilationUnit#declarationsAreInDefaultPackage() %}
- {% jdoc java::lang.java.ast.JavaQualifiableNode %}
- {% jdoc !!java::lang.java.ast.ASTAnyTypeDeclaration#getQualifiedName() %}
- {% jdoc !!java::lang.java.ast.ASTMethodOrConstructorDeclaration#getQualifiedName() %}
- {% jdoc !!java::lang.java.ast.ASTLambdaExpression#getQualifiedName() %}
- {% jdoc_package java::lang.java.qname %} and its contents
- {% jdoc java::lang.java.ast.MethodLikeNode %}
- Its methods will also be removed from its implementations, {% jdoc java::lang.java.ast.ASTMethodOrConstructorDeclaration %}, {% jdoc java::lang.java.ast.ASTLambdaExpression %}.
- {% jdoc !!java::lang.java.ast.ASTAnyTypeDeclaration#getImage() %} will be removed. Please use
getSimpleName()
instead. This affects {% jdoc !!java::lang.java.ast.ASTAnnotationTypeDeclaration#getImage() %}, {% jdoc !!java::lang.java.ast.ASTClassOrInterfaceDeclaration#getImage() %}, and {% jdoc !!java::lang.java.ast.ASTEnumDeclaration#getImage() %}. - Several methods of {% jdoc java::lang.java.ast.ASTTryStatement %}, replacements with other names
have been added. This includes the XPath attribute
@Finally
, replace it with a test forchild::FinallyStatement
. - Several methods named
getGuardExpressionNode
are replaced withgetCondition
. This affects the following nodes: WhileStatement, DoStatement, ForStatement, IfStatement, AssertStatement, ConditionalExpression. - {% jdoc java::lang.java.ast.ASTYieldStatement %} will not implement {% jdoc java::lang.java.ast.TypeNode %} anymore come 7.0.0. Test the type of the expression nested within it.
External Contributions
- #2041: [modelica] Initial implementation for PMD - Anatoly Trosinenko
- #2051: [doc] Update the docs on adding a new language - Anatoly Trosinenko
- #2069: [java] CommentRequired: make property names consistent - snuyanzin
- #2169: [modelica] Follow-up fixes for Modelica language module - Anatoly Trosinenko
- #2193: [core] Fix odd logic in test runner - Egor Bredikhin
- #2194: [java] Fix odd logic in AvoidUsingHardCodedIPRule - Egor Bredikhin
- #2195: [modelica] Normalize invalid node ranges - Anatoly Trosinenko
- #2199: [modelica] Fix Javadoc tags - Anatoly Trosinenko
- #2225: [core] CPD: report endLine / column informations for found duplications - Maikel Steneker
{% endtocmaker %}