Merge branch 'harsh-kukreja-master'

This commit is contained in:
Clément Fournier
2020-04-27 21:25:30 +02:00
2 changed files with 5 additions and 2 deletions

View File

@ -20,5 +20,8 @@ This is a {{ site.pmd.release_type }} release.
### External Contributions
* [#2448](https://github.com/pmd/pmd/pull/2448): \[java] Operator Wrap check - [Harsh Kukreja](https://github.com/harsh-kukreja)
{% endtocmaker %}

View File

@ -91,8 +91,8 @@ public class CloneMethodMustImplementCloneableRule extends AbstractJavaRule {
// Is the clone method just throwing CloneNotSupportedException?
final ASTClassOrInterfaceDeclaration classOrInterface = node.getFirstParentOfType(ASTClassOrInterfaceDeclaration.class);
if (classOrInterface != null && //Don't analyze enums, which cannot subclass clone()
(node.isFinal() || classOrInterface.isFinal())) {
if (classOrInterface != null //Don't analyze enums, which cannot subclass clone()
&& (node.isFinal() || classOrInterface.isFinal())) {
if (node.findDescendantsOfType(ASTBlock.class).size() == 1) {
final List<ASTBlockStatement> blocks = node.findDescendantsOfType(ASTBlockStatement.class);
if (blocks.size() == 1) {