From 3e5a9e7b8792704a857912da59631f172aa2311a Mon Sep 17 00:00:00 2001
From: Andrei Selkin
Date: Sun, 22 Jan 2017 20:25:17 +0300
Subject: [PATCH] Issue #3675: Replace Scope with AccessModifier in
ParameterNameCheck to avoid wrong scopes comparison
---
config/checkstyle_sevntu_checks.xml | 5 +-
config/import-control.xml | 4 +
.../ParameterNameTest.java | 46 ++++++----
...a => InputParameterNameSimpleGeneral.java} | 0
.../tools/checkstyle/api/AutomaticBean.java | 32 ++++++-
.../checks/naming/AccessModifier.java | 63 +++++++++++++
.../checks/naming/ParameterNameCheck.java | 90 ++++++++-----------
.../tools/checkstyle/utils/CheckUtils.java | 32 +++++++
src/main/resources/google_checks.xml | 4 +-
.../checks/naming/ParameterNameCheckTest.java | 50 +----------
.../checkstyle/internal/XDocsPagesTest.java | 7 ++
.../checkstyle/utils/CheckUtilsTest.java | 28 ++++++
...putScope.java => InputAccessModifier.java} | 4 +-
src/xdocs/config_naming.xml | 28 +++---
src/xdocs/property_types.xml | 11 +++
15 files changed, 264 insertions(+), 140 deletions(-)
rename src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/{InputParameterNameSimplePriv.java => InputParameterNameSimpleGeneral.java} (100%)
create mode 100644 src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier.java
rename src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/{InputScope.java => InputAccessModifier.java} (93%)
diff --git a/config/checkstyle_sevntu_checks.xml b/config/checkstyle_sevntu_checks.xml
index 41ab3b3a218c..400836d9437b 100644
--- a/config/checkstyle_sevntu_checks.xml
+++ b/config/checkstyle_sevntu_checks.xml
@@ -121,7 +121,10 @@
-
+
+
diff --git a/config/import-control.xml b/config/import-control.xml
index 440d652ba236..de6eb14e15ee 100644
--- a/config/import-control.xml
+++ b/config/import-control.xml
@@ -59,6 +59,10 @@
+
+ result = new ArrayList<>();
while (tokenizer.hasMoreTokens()) {
@@ -339,4 +345,28 @@ public Object convert(Class type, Object value) {
return result.toArray(new String[result.size()]);
}
}
+
+ /**
+ * A converter that converts strings to {@link AccessModifier}.
+ * This implementation does not care whether the array elements contain characters like '_'.
+ * The normal {@link ArrayConverter} class has problems with this character.
+ */
+ private static class RelaxedAccessModifierArrayConverter implements Converter {
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ @Override
+ public Object convert(Class type, Object value) {
+ // Converts to a String and trims it for the tokenizer.
+ final StringTokenizer tokenizer = new StringTokenizer(
+ value.toString().trim(), COMMA_SEPARATOR);
+ final List result = new ArrayList<>();
+
+ while (tokenizer.hasMoreTokens()) {
+ final String token = tokenizer.nextToken();
+ result.add(AccessModifier.getInstance(token.trim()));
+ }
+
+ return result.toArray(new AccessModifier[result.size()]);
+ }
+ }
}
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier.java
new file mode 100644
index 000000000000..d3eb980d4f70
--- /dev/null
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifier.java
@@ -0,0 +1,63 @@
+////////////////////////////////////////////////////////////////////////////////
+// checkstyle: Checks Java source code for adherence to a set of rules.
+// Copyright (C) 2001-2016 the original author or authors.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+////////////////////////////////////////////////////////////////////////////////
+
+package com.puppycrawl.tools.checkstyle.checks.naming;
+
+import java.util.Locale;
+
+/**
+ * This enum represents access modifiers.
+ * Access modifiers names are taken from JLS:
+ * https://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.6
+ *
+ * @author Andrei Selkin
+ */
+public enum AccessModifier {
+ /** Public access modifier. */
+ PUBLIC,
+ /** Protected access modifier. */
+ PROTECTED,
+ /** Package access modifier. */
+ PACKAGE,
+ /** Private access modifier. */
+ PRIVATE;
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ public String getName() {
+ return name().toLowerCase(Locale.ENGLISH);
+ }
+
+ /**
+ * Factory method which returns an AccessModifier instance that corresponds to the
+ * given access modifier name represented as a {@link String}.
+ * The access modifier name can be formatted both as lower case or upper case string.
+ * For example, passing PACKAGE or package as a modifier name
+ * will return {@link AccessModifier#PACKAGE}.
+ *
+ * @param modifierName access modifier name represented as a {@link String}.
+ * @return the AccessModifier associated with given access modifier name.
+ */
+ public static AccessModifier getInstance(String modifierName) {
+ return valueOf(AccessModifier.class, modifierName.trim().toUpperCase(Locale.ENGLISH));
+ }
+}
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java
index 50f599567ab7..ce6cbc72daa3 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java
@@ -19,16 +19,17 @@
package com.puppycrawl.tools.checkstyle.checks.naming;
+import java.util.Arrays;
import java.util.Optional;
+import java.util.stream.Stream;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CheckUtils;
import com.puppycrawl.tools.checkstyle.utils.ScopeUtils;
/**
-*
+ *
* Checks that method and catch parameter names conform to a format specified
* by the format property. The format is a
* {@link java.util.regex.Pattern regular expression}
@@ -38,19 +39,15 @@
*
The check has the following options:
*
ignoreOverridden - allows to skip methods with Override annotation from
* validation. Default values is false .
- *
scope - visibility scope of methods to be checked.
- * Default value is anoninner .
- *
excludeScope - visibility scope of methods not to be checked.
- * Default value is null .
- *
- * An example of how to configure the check is:
- *
+ *
accessModifiers - access modifiers of methods which should to be checked.
+ * Default value is public, protected, package, private .
+ * An example of how to configure the check:
*
* <module name="ParameterName"/>
*
*
- * An example of how to configure the check for names that begin with
- * a lower case letter, followed by letters, digits, and underscores is:
+ * An example of how to configure the check for names that begin with
+ * a lower case letter, followed by letters, digits, and underscores:
*
*
* <module name="ParameterName">
@@ -70,19 +67,17 @@
* @author Oliver Burn
* @author Andrei Selkin
*/
-public class ParameterNameCheck
- extends AbstractNameCheck {
+public class ParameterNameCheck extends AbstractNameCheck {
/**
* Allows to skip methods with Override annotation from validation.
*/
private boolean ignoreOverridden;
- /** The visibility scope where methods are checked. */
- private Scope scope = Scope.ANONINNER;
-
- /** The visibility scope where methods shouldn't be checked. */
- private Scope excludeScope;
+ /** Access modifiers of methods which should be checked. */
+ private AccessModifier[] accessModifiers = Stream.of(AccessModifier.PUBLIC,
+ AccessModifier.PROTECTED, AccessModifier.PACKAGE, AccessModifier.PRIVATE)
+ .toArray(AccessModifier[]::new);
/**
* Creates a new {@code ParameterNameCheck} instance.
@@ -93,7 +88,6 @@ public ParameterNameCheck() {
/**
* Sets whether to skip methods with Override annotation from validation.
- *
* @param ignoreOverridden Flag for skipping methods with Override annotation.
*/
public void setIgnoreOverridden(boolean ignoreOverridden) {
@@ -101,19 +95,12 @@ public void setIgnoreOverridden(boolean ignoreOverridden) {
}
/**
- * Set the scope.
- * @param from a scope.
+ * Sets access modifiers of methods which should be checked.
+ * @param accessModifiers access modifiers of methods which should be checked.
*/
- public void setScope(Scope from) {
- scope = from;
- }
-
- /**
- * Set the excludeScope.
- * @param excludeScope a scope.
- */
- public void setExcludeScope(Scope excludeScope) {
- this.excludeScope = excludeScope;
+ public void setAccessModifiers(AccessModifier... accessModifiers) {
+ this.accessModifiers =
+ Arrays.copyOf(accessModifiers, accessModifiers.length);
}
@Override
@@ -134,53 +121,49 @@ public int[] getRequiredTokens() {
@Override
protected boolean mustCheckName(DetailAST ast) {
boolean checkName = true;
- final boolean isDefault = scope == Scope.ANONINNER && excludeScope == null;
-
if (ignoreOverridden && isOverriddenMethod(ast)
|| ast.getParent().getType() == TokenTypes.LITERAL_CATCH
|| CheckUtils.isReceiverParameter(ast)
- || !isDefault && !matchScope(calculateScope(ast))) {
+ || !matchAccessModifiers(getAccessModifier(ast))) {
checkName = false;
}
return checkName;
}
/**
- * Returns the scope for the method/constructor at the specified AST. If
- * the method is in an interface or annotation block, the scope is assumed
+ * Returns the access modifier of the method/constructor at the specified AST. If
+ * the method is in an interface or annotation block, the access modifier is assumed
* to be public.
*
- * @param ast the token of the method/constructor
- * @return the scope of the method/constructor
+ * @param ast the token of the method/constructor.
+ * @return the access modifier of the method/constructor.
*/
- private static Scope calculateScope(final DetailAST ast) {
+ private static AccessModifier getAccessModifier(final DetailAST ast) {
final DetailAST params = ast.getParent();
final DetailAST meth = params.getParent();
- Scope scope = Scope.PRIVATE;
+ AccessModifier accessModifier = AccessModifier.PRIVATE;
if (meth.getType() == TokenTypes.METHOD_DEF
- || meth.getType() == TokenTypes.CTOR_DEF) {
+ || meth.getType() == TokenTypes.CTOR_DEF) {
if (ScopeUtils.isInInterfaceOrAnnotationBlock(ast)) {
- scope = Scope.PUBLIC;
+ accessModifier = AccessModifier.PUBLIC;
}
else {
- final DetailAST mods = meth.findFirstToken(TokenTypes.MODIFIERS);
- scope = ScopeUtils.getScopeFromMods(mods);
+ final DetailAST modsToken = meth.findFirstToken(TokenTypes.MODIFIERS);
+ accessModifier = CheckUtils.getAccessModifierFromModifiersToken(modsToken);
}
}
- return scope;
+ return accessModifier;
}
/**
- * Checks whether a method has the correct scope to be checked.
- * @param nodeScope the scope of the method
- * @return whether the method matches the expected scope
+ * Checks whether a method has the correct access modifier to be checked.
+ * @param accessModifier the access modifier of the method.
+ * @return whether the method matches the expected access modifier.
*/
- private boolean matchScope(final Scope nodeScope) {
- return nodeScope.isIn(scope)
- && (excludeScope == null
- || !nodeScope.isIn(excludeScope));
+ private boolean matchAccessModifiers(final AccessModifier accessModifier) {
+ return Arrays.stream(accessModifiers).anyMatch(el -> el == accessModifier);
}
/**
@@ -195,7 +178,8 @@ private static boolean isOverriddenMethod(DetailAST ast) {
final Optional annotation =
Optional.ofNullable(parent.getFirstChild().getFirstChild());
- if (annotation.isPresent() && annotation.get().getType() == TokenTypes.ANNOTATION) {
+ if (annotation.isPresent()
+ && annotation.get().getType() == TokenTypes.ANNOTATION) {
final Optional overrideToken =
Optional.ofNullable(annotation.get().findFirstToken(TokenTypes.IDENT));
if (overrideToken.isPresent() && "Override".equals(overrideToken.get().getText())) {
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtils.java
index 55d012a70e08..e61aff53e51d 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtils.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtils.java
@@ -23,9 +23,11 @@
import java.util.List;
import java.util.regex.Pattern;
+import antlr.collections.AST;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.FullIdent;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
+import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier;
/**
* Contains utility methods for the checks.
@@ -425,4 +427,34 @@ public static boolean isReceiverParameter(DetailAST parameterDefAst) {
}
return returnValue;
}
+
+ /**
+ * Returns {@link AccessModifier} based on the information about access modifier
+ * taken from the given token of type {@link TokenTypes#MODIFIERS}.
+ * @param modifiersToken token of type {@link TokenTypes#MODIFIERS}.
+ * @return {@link AccessModifier}.
+ */
+ public static AccessModifier getAccessModifierFromModifiersToken(DetailAST modifiersToken) {
+ if (modifiersToken == null || modifiersToken.getType() != TokenTypes.MODIFIERS) {
+ throw new IllegalArgumentException("expected non-null AST-token with type 'MODIFIERS'");
+ }
+
+ // default access modifier
+ AccessModifier accessModifier = AccessModifier.PACKAGE;
+ for (AST token = modifiersToken.getFirstChild(); token != null;
+ token = token.getNextSibling()) {
+
+ final int tokenType = token.getType();
+ if (TokenTypes.LITERAL_PUBLIC == tokenType) {
+ accessModifier = AccessModifier.PUBLIC;
+ }
+ else if (TokenTypes.LITERAL_PROTECTED == tokenType) {
+ accessModifier = AccessModifier.PROTECTED;
+ }
+ else if (TokenTypes.LITERAL_PRIVATE == tokenType) {
+ accessModifier = AccessModifier.PRIVATE;
+ }
+ }
+ return accessModifier;
+ }
}
diff --git a/src/main/resources/google_checks.xml b/src/main/resources/google_checks.xml
index 9e0a0d9633e6..21465861ccf7 100644
--- a/src/main/resources/google_checks.xml
+++ b/src/main/resources/google_checks.xml
@@ -110,14 +110,14 @@
-
+
-
+
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java
index cc0cc7c61f25..589571960485 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java
@@ -29,7 +29,6 @@
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
@@ -140,65 +139,24 @@ public void testSkipMethodsWithOverrideAnnotationFalse()
}
@Test
- public void testScope()
+ public void testPublicAccessModifier()
throws Exception {
final DefaultConfiguration checkConfig =
createCheckConfig(ParameterNameCheck.class);
checkConfig.addAttribute("format", "^h$");
- checkConfig.addAttribute("scope", Scope.PUBLIC.getName());
+ checkConfig.addAttribute("accessModifiers", AccessModifier.PUBLIC.toString());
final String pattern = "^h$";
final String[] expected = {
- "5:27: " + getCheckMessage(MSG_INVALID_PATTERN, "pubconstr", pattern),
+ "5:36: " + getCheckMessage(MSG_INVALID_PATTERN, "pubconstr", pattern),
"9:31: " + getCheckMessage(MSG_INVALID_PATTERN, "inner", pattern),
"19:24: " + getCheckMessage(MSG_INVALID_PATTERN, "pubpub", pattern),
"30:21: " + getCheckMessage(MSG_INVALID_PATTERN, "pubifc", pattern),
"44:24: " + getCheckMessage(MSG_INVALID_PATTERN, "packpub", pattern),
"60:21: " + getCheckMessage(MSG_INVALID_PATTERN, "packifc", pattern),
};
- verify(checkConfig, getPath("InputScope.java"), expected);
- }
-
- @Test
- public void testExcludeScope()
- throws Exception {
- final DefaultConfiguration checkConfig =
- createCheckConfig(ParameterNameCheck.class);
- checkConfig.addAttribute("format", "^h$");
- checkConfig.addAttribute("excludeScope", Scope.PROTECTED.getName());
-
- final String pattern = "^h$";
-
- final String[] expected = {
- "23:17: " + getCheckMessage(MSG_INVALID_PATTERN, "pubpack", pattern),
- "25:25: " + getCheckMessage(MSG_INVALID_PATTERN, "pubpriv", pattern),
- "48:17: " + getCheckMessage(MSG_INVALID_PATTERN, "packpack", pattern),
- "50:25: " + getCheckMessage(MSG_INVALID_PATTERN, "packpriv", pattern),
- "68:27: " + getCheckMessage(MSG_INVALID_PATTERN, "lexp", pattern),
- "70:23: " + getCheckMessage(MSG_INVALID_PATTERN, "limp", pattern),
- };
- verify(checkConfig, getPath("InputScope.java"), expected);
- }
-
- @Test
- public void testScopeExcludeScope()
- throws Exception {
- final DefaultConfiguration checkConfig =
- createCheckConfig(ParameterNameCheck.class);
- checkConfig.addAttribute("format", "^h$");
- checkConfig.addAttribute("scope", Scope.PACKAGE.getName());
- checkConfig.addAttribute("excludeScope", Scope.PUBLIC.getName());
-
- final String pattern = "^h$";
-
- final String[] expected = {
- "21:27: " + getCheckMessage(MSG_INVALID_PATTERN, "pubprot", pattern),
- "23:17: " + getCheckMessage(MSG_INVALID_PATTERN, "pubpack", pattern),
- "46:27: " + getCheckMessage(MSG_INVALID_PATTERN, "packprot", pattern),
- "48:17: " + getCheckMessage(MSG_INVALID_PATTERN, "packpack", pattern),
- };
- verify(checkConfig, getPath("InputScope.java"), expected);
+ verify(checkConfig, getPath("InputAccessModifier.java"), expected);
}
@Test
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java
index 8ffdac1a0618..06ea3f0815fc 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java
@@ -64,6 +64,7 @@
import com.puppycrawl.tools.checkstyle.api.Scope;
import com.puppycrawl.tools.checkstyle.api.SeverityLevel;
import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck;
+import com.puppycrawl.tools.checkstyle.checks.naming.AccessModifier;
public class XDocsPagesTest {
private static final Path AVAILABLE_CHECKS_PATH = Paths.get("src/xdocs/checks.xml");
@@ -626,6 +627,9 @@ else if (clss == SeverityLevel.class) {
else if (clss == Scope.class) {
result = "Scope";
}
+ else if (clss == AccessModifier[].class) {
+ result = "Access Modifier Set";
+ }
else if (clss != String.class) {
Assert.fail("Unknown property type: " + clss.getSimpleName());
}
@@ -688,6 +692,9 @@ else if (clss == Pattern.class) {
else if (value != null && (clss == SeverityLevel.class || clss == Scope.class)) {
result = value.toString().toLowerCase(Locale.ENGLISH);
}
+ else if (value != null && clss == AccessModifier[].class) {
+ result = Arrays.toString((Object[]) value).replace("[", "").replace("]", "");
+ }
if (clss != String.class && clss != String[].class && result == null) {
result = "null";
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilsTest.java
index 9f94eb914bed..d61e9bc06d33 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilsTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilsTest.java
@@ -21,6 +21,7 @@
import static com.puppycrawl.tools.checkstyle.internal.TestUtils.assertUtilsClassHasPrivateConstructor;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import org.junit.Assert;
import org.junit.Test;
@@ -112,7 +113,34 @@ public void testEquals() {
metDef.addChild(parameters);
Assert.assertFalse(CheckUtils.isEqualsMethod(metDef));
+ }
+ @Test
+ public void testGetAccessModifierFromModifiersTokenWrongTokenType() {
+ final DetailAST modifiers = new DetailAST();
+ modifiers.setType(TokenTypes.METHOD_DEF);
+
+ try {
+ CheckUtils.getAccessModifierFromModifiersToken(modifiers);
+ fail(IllegalArgumentException.class.getSimpleName() + " was expcted.");
+ }
+ catch (IllegalArgumentException exc) {
+ final String expectedExceptionMsg = "expected non-null AST-token with type 'MODIFIERS'";
+ final String actualExceptionMsg = exc.getMessage();
+ assertEquals(expectedExceptionMsg, actualExceptionMsg);
+ }
}
+ @Test
+ public void testGetAccessModifierFromModifiersTokenWithNullParameter() {
+ try {
+ CheckUtils.getAccessModifierFromModifiersToken(null);
+ fail(IllegalArgumentException.class.getSimpleName() + " was expcted.");
+ }
+ catch (IllegalArgumentException exc) {
+ final String expectedExceptionMsg = "expected non-null AST-token with type 'MODIFIERS'";
+ final String actualExceptionMsg = exc.getMessage();
+ assertEquals(expectedExceptionMsg, actualExceptionMsg);
+ }
+ }
}
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputScope.java b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAccessModifier.java
similarity index 93%
rename from src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputScope.java
rename to src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAccessModifier.java
index aae4a4c34401..a242550ddea7 100644
--- a/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputScope.java
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/checks/naming/InputAccessModifier.java
@@ -1,8 +1,8 @@
package com.puppycrawl.tools.checkstyle.checks.naming;
-public class InputScope {
+public class InputAccessModifier {
- public InputScope(int pubconstr) {}
+ public InputAccessModifier(int pubconstr) {}
public void v1(int h) {
new Object () {
diff --git a/src/xdocs/config_naming.xml b/src/xdocs/config_naming.xml
index ed85f1af396c..fdf0803e9e70 100644
--- a/src/xdocs/config_naming.xml
+++ b/src/xdocs/config_naming.xml
@@ -1149,8 +1149,8 @@ class MyClass {
Checks that method and catch parameter names conform to a format specified
- by the format property. By using scope and excludeScope properties
- it is possible to specify different formats for methods at different visibility levels.
+ by the format property. By using accessModifiers property it is possible
+ to specify different formats for methods at different visibility levels.
@@ -1185,16 +1185,10 @@ public boolean equals(Object o) {
false
-
scope
-
Visibility scope of methods where parameters are checked.