Update release notes, refs #1534, fixes #1517

This commit is contained in:
Andreas Dangel
2018-12-27 10:29:28 +01:00
parent e00b0b83fa
commit db25def6b0
2 changed files with 47 additions and 38 deletions

View File

@ -14,6 +14,12 @@ This is a {{ site.pmd.release_type }} release.
### New and noteworthy
#### New Rules
* The new Java rule {% rule "java/codestyle/UseDiamondOperator" %} (`java-codestyle`) looks for constructor
calls with explicit type parameters. Since Java 1.7, these type parameters are not necessary anymore, as they
can be inferred now.
#### Modified Rules
* The Java rule {% rule "java/codestyle/LocalVariableCouldBeFinal" %} (`java-codestyle`) has a new
@ -26,6 +32,7 @@ This is a {{ site.pmd.release_type }} release.
* [#658](https://github.com/pmd/pmd/issues/658): \[java] OneDeclarationPerLine: False positive for loops
* java-codestyle
* [#1513](https://github.com/pmd/pmd/issues/1513): \[java] LocalVariableCouldBeFinal: allow excluding the variable in a for-each loop
* [#1517](https://github.com/pmd/pmd/issues/1517): \[java] New Rule: UseDiamondOperator
* java-errorprone
* [#1035](https://github.com/pmd/pmd/issues/1035): \[java] ReturnFromFinallyBlock: False positive on lambda expression in finally block
@ -37,6 +44,7 @@ This is a {{ site.pmd.release_type }} release.
* [#1514](https://github.com/pmd/pmd/pull/1514): \[java] LocalVariableCouldBeFinal: allow excluding the variable in a for-each loop - [Kris Scheibe](https://github.com/kris-scheibe)
* [#1516](https://github.com/pmd/pmd/pull/1516): \[java] OneDeclarationPerLine: Don't report multiple variables in a for statement. - [Kris Scheibe](https://github.com/kris-scheibe)
* [#1521](https://github.com/pmd/pmd/pull/1521): \[java] Upgrade to ASM7 for JDK 11 support - [Mark Pritchard](https://github.com/markpritchard)
* [#1534](https://github.com/pmd/pmd/pull/1534): \[java] This is the change regarding the usediamondoperator #1517 - [hemanshu070](https://github.com/hemanshu070)
{% endtocmaker %}

View File

@ -1809,44 +1809,6 @@ public class Foo {
</example>
</rule>
<rule name="UseDiamondOperator"
language="java"
since="6.11.0"
message="Explicit type arguments can be replaced by Diamond Operator"
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#usediamondoperator"
minimumLanguageVersion="1.7">
<description>Use the diamond operator to let the type be inferred With the Diamond operator it is possible to avoid duplication of the type parameters.
Instead, the compiler is now able to infer the parameter types for constructor calls,
which makes the code also more readable.
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//VariableInitializer
//PrimaryExpression[not(PrimarySuffix)]
[not(ancestor::ArgumentList)]
/PrimaryPrefix/AllocationExpression[ClassOrInterfaceType[@AnonymousClass='false']/TypeArguments//ReferenceType[not(.//TypeArguments)]]
|
//StatementExpression[AssignmentOperator][PrimaryExpression/PrimaryPrefix[not(Expression)]]
//PrimaryExpression[not(PrimarySuffix)]
[not(ancestor::ArgumentList)]
/PrimaryPrefix/AllocationExpression[ClassOrInterfaceType[@AnonymousClass='false']/TypeArguments//ReferenceType[not(.//TypeArguments)]]
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
List<String> strings = new ArrayList<String>(); // unnecessary duplication of type parameters
List<String> stringsWithDiamond = new ArrayList<>(); // using the diamond operator is more concise
]]>
</example>
</rule>
<rule name="UnnecessaryFullyQualifiedName"
language="java"
since="5.0"
@ -1950,6 +1912,45 @@ public class Foo {
</example>
</rule>
<rule name="UseDiamondOperator"
language="java"
since="6.11.0"
message="Explicit type arguments can be replaced by Diamond Operator"
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_codestyle.html#usediamondoperator"
minimumLanguageVersion="1.7">
<description>
Use the diamond operator to let the type be inferred automatically. With the Diamond operator it is possible
to avoid duplication of the type parameters.
Instead, the compiler is now able to infer the parameter types for constructor calls,
which makes the code also more readable.
</description>
<priority>1</priority>
<properties>
<property name="xpath">
<value>
<![CDATA[
//VariableInitializer
//PrimaryExpression[not(PrimarySuffix)]
[not(ancestor::ArgumentList)]
/PrimaryPrefix/AllocationExpression[ClassOrInterfaceType[@AnonymousClass='false']/TypeArguments//ReferenceType[not(.//TypeArguments)]]
|
//StatementExpression[AssignmentOperator][PrimaryExpression/PrimaryPrefix[not(Expression)]]
//PrimaryExpression[not(PrimarySuffix)]
[not(ancestor::ArgumentList)]
/PrimaryPrefix/AllocationExpression[ClassOrInterfaceType[@AnonymousClass='false']/TypeArguments//ReferenceType[not(.//TypeArguments)]]
]]>
</value>
</property>
</properties>
<example>
<![CDATA[
List<String> strings = new ArrayList<String>(); // unnecessary duplication of type parameters
List<String> stringsWithDiamond = new ArrayList<>(); // using the diamond operator is more concise
]]>
</example>
</rule>
<rule name="UselessParentheses"
language="java"
since="5.0"