diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 0e8468ae86..0740013b01 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -32,10 +32,12 @@ This is a {{ site.pmd.release_type }} release. * [#1341](https://github.com/pmd/pmd/issues/1341): \[doc] Documentation Error with Regex Properties * java * [#1460](https://github.com/pmd/pmd/issues/1460): \[java] Intermittent PMD failure : PMD processing errors while no violations reported +* java-bestpractices + * [#1435](https://github.com/pmd/pmd/issues/1435): \[java] JUnitTestsShouldIncludeAssert: Support AssertJ soft assertions * java-codestyle * [#1232](https://github.com/pmd/pmd/issues/1232): \[java] Detector for large numbers not separated by _ * [#1372](https://github.com/pmd/pmd/issues/1372): \[java] false positive for UselessQualifiedThis - * [#1435](https://github.com/pmd/pmd/issues/1435): \[java] JUnitTestsShouldIncludeAssert: Support AssertJ soft assertions + * [#1440](https://github.com/pmd/pmd/issues/1440): \[java] CommentDefaultAccessModifierRule shows incorrect message ### API Changes @@ -103,6 +105,7 @@ now deprecated until 7.0.0. The proposed changes to the API are described [on th * [#1430](https://github.com/pmd/pmd/pull/1430): \[doc] Who really knows regex? - [Dem Pilafian](https://github.com/dpilafian) * [#1434](https://github.com/pmd/pmd/pull/1434): \[java] JUnitTestsShouldIncludeAssert: Recognize AssertJ soft assertions as valid assert statements - [Loïc Ledoyen](https://github.com/ledoyen) * [#1447](https://github.com/pmd/pmd/pull/1447): \[fortran] Use diamond operator in impl - [reudismam](https://github.com/reudismam) +* [#1453](https://github.com/pmd/pmd/pull/1453): \[java] Adding the fix for #1440. Showing correct message for CommentDefaultAccessmodifier. - [Rohit Kumar](https://github.com/stationeros) * [#1464](https://github.com/pmd/pmd/pull/1464): \[doc] Fix XSS on documentation web page - [Maxime Robert](https://github.com/marob) {% endtocmaker %} diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 991335622f..b84165ca98 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1854,7 +1854,7 @@ void ConstructorDeclaration(int modifiers) : Token t;} { [ TypeParameters() ] - FormalParameters() [ "throws" NameList() ] + {jjtThis.setImage(getToken(0).getImage());} FormalParameters() [ "throws" NameList() ] "{" [ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ] ( BlockStatement() )* diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml index 2a8874ff8e..a01d2c9997 100755 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml @@ -254,4 +254,25 @@ public class CommentDefaultAccessModifier { } ]]> + + + + + Add a comment to the constructors with default access modifiers to avoid mistakes + 2 + 2,4 + + To avoid mistakes add a comment at the beginning of the Foo constructor if you want a default access modifier + To avoid mistakes add a comment at the beginning of the Foo constructor if you want a default access modifier + + + \ No newline at end of file