Merge branch 'pr-1453'

This commit is contained in:
Andreas Dangel
2018-11-21 22:00:43 +01:00
3 changed files with 26 additions and 2 deletions

View File

@ -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 %}

View File

@ -1854,7 +1854,7 @@ void ConstructorDeclaration(int modifiers) :
Token t;}
{
[ TypeParameters() ]
<IDENTIFIER> FormalParameters() [ "throws" NameList() ]
<IDENTIFIER> {jjtThis.setImage(getToken(0).getImage());} FormalParameters() [ "throws" NameList() ]
"{"
[ LOOKAHEAD(ExplicitConstructorInvocation()) ExplicitConstructorInvocation() ]
( BlockStatement() )*

View File

@ -254,4 +254,25 @@ public class CommentDefaultAccessModifier {
}
]]></code>
</test-code>
<code-fragment id="constructor-with-default-access-modifier-rule"><![CDATA[
public class Foo {
Foo() {} // should be reported
Foo(final String str) {} // should be reported
/* default */ Foo(final String str1, final String str2) {} // should not be reported
}
]]>
</code-fragment>
<test-code>
<description>Add a comment to the constructors with default access modifiers to avoid mistakes</description>
<expected-problems>2</expected-problems>
<expected-linenumbers>2,4</expected-linenumbers>
<expected-messages>
<message>To avoid mistakes add a comment at the beginning of the Foo constructor if you want a default access modifier</message>
<message>To avoid mistakes add a comment at the beginning of the Foo constructor if you want a default access modifier</message>
</expected-messages>
<code-ref id="constructor-with-default-access-modifier-rule"/>
</test-code>
</test-data>