From c80cfd61133b5df60429656c7664cb0ef4489bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 23 May 2018 21:25:22 +0200 Subject: [PATCH] Corrections for PR #1134 --- .../rule/codestyle/ClassNamingConventionsRule.java | 2 +- .../rule/codestyle/xml/ClassNamingConventions.xml | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java index 087c998f79..a7c23bb0b7 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java @@ -108,7 +108,7 @@ public class ClassNamingConventionsRule extends AbstractJavaRule { private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { - if (!DeclarationKind.METHOD.equals(bodyDeclaration.getKind())) { + if (DeclarationKind.METHOD != bodyDeclaration.getKind()) { return false; } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml index 76968619c1..fc8767d990 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml @@ -228,6 +228,19 @@ ]]> + + Class with only main method should not be utility class - varargs case + 0 + + + Class with main method and private static fields should not be utility class 0