From de206fc21c379ccca852690bdce536221681707f Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 27 Jan 2024 12:08:45 +0100 Subject: [PATCH 1/6] Sync Checkstyle integration test --- .../checkstyle-10.12.4-expected-changes.patch | 23 +++++++++++++++---- .../checkstyle-10.12.4-init.patch | 12 ++++++++++ integration-tests/checkstyle-10.12.4.sh | 6 +++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/integration-tests/checkstyle-10.12.4-expected-changes.patch b/integration-tests/checkstyle-10.12.4-expected-changes.patch index 4ef2b9af3f..87177fc1f3 100644 --- a/integration-tests/checkstyle-10.12.4-expected-changes.patch +++ b/integration-tests/checkstyle-10.12.4-expected-changes.patch @@ -16605,6 +16605,15 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); +@@ -221,7 +221,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + + final MessageDigest digest = MessageDigest.getInstance("SHA-1"); + final URI uri = CommonUtil.getUriByFilename(pathToResource); +- final byte[] input = ByteStreams.toByteArray(new BufferedInputStream(uri.toURL().openStream())); ++ final byte[] input = new BufferedInputStream(uri.toURL().openStream()).readAllBytes(); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + try (ObjectOutputStream oos = new ObjectOutputStream(out)) { + oos.writeObject(input); @@ -235,7 +235,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @@ -16632,16 +16641,22 @@ final DefaultConfiguration config = new DefaultConfiguration("myConfig"); config.addProperty("attr", "value"); -@@ -315,7 +315,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -314,11 +314,11 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + * @noinspectionreason ResultOfMethodCallIgnored - Setup for mockito to only mock toByteArray to * throw exception. */ - @Test +- @Test ++ @SuppressWarnings("InputStreamReadAllBytes") + // XXX: Drop suppression once + // https://github.com/checkstyle/checkstyle/pull/14362 is resolved. +- @SuppressWarnings("InputStreamReadAllBytes") - public void testNonExistentResource() throws IOException { ++ @Test + void nonExistentResource() throws IOException { final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -350,7 +350,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -353,7 +353,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -16650,7 +16665,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -389,8 +389,8 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -392,8 +392,8 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { * @param rawMessages exception messages separated by ';' */ @ParameterizedTest diff --git a/integration-tests/checkstyle-10.12.4-init.patch b/integration-tests/checkstyle-10.12.4-init.patch index 482c0f6c6a..59e551e763 100644 --- a/integration-tests/checkstyle-10.12.4-init.patch +++ b/integration-tests/checkstyle-10.12.4-init.patch @@ -161,6 +161,18 @@ final Object test = new PackageObjectFactory(Collections.singleton(null), classLoader, TRY_IN_ALL_REGISTERED_PACKAGES); assertWithMessage("Exception is expected but got " + test).fail(); +--- a/src/test/java/com/puppycrawl/tools/checkstyle/PropertyCacheFileTest.java ++++ b/src/test/java/com/puppycrawl/tools/checkstyle/PropertyCacheFileTest.java +@@ -338,6 +338,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + * mock toByteArray to throw exception. + */ + @Test ++ // XXX: Drop suppression once ++ // https://github.com/checkstyle/checkstyle/pull/14362 is resolved. ++ @SuppressWarnings("InputStreamReadAllBytes") + public void testNonExistentResource() throws IOException { + final Configuration config = new DefaultConfiguration("myName"); + final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java @@ -79,6 +79,8 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; diff --git a/integration-tests/checkstyle-10.12.4.sh b/integration-tests/checkstyle-10.12.4.sh index a6bf87bd19..5c5e5e0af3 100755 --- a/integration-tests/checkstyle-10.12.4.sh +++ b/integration-tests/checkstyle-10.12.4.sh @@ -46,16 +46,22 @@ format_goal='com.spotify.fmt:fmt-maven-plugin:2.21.1:format' error_prone_shared_flags='-XepExcludedPaths:(\Q${project.basedir}${file.separator}src${file.separator}\E(it|test|xdocs-examples)\Q${file.separator}resources\E|\Q${project.build.directory}${file.separator}\E).*' +# XXX: Drop the `ErrorProneRuntimeClasspath` exclusion once that check resides +# in a separate Maven module. error_prone_patch_flags="${error_prone_shared_flags} -XepPatchLocation:IN_PLACE -XepPatchChecks:$( find "${error_prone_support_root}" -path "*/META-INF/services/com.google.errorprone.bugpatterns.BugChecker" -print0 \ | xargs -0 grep -hoP '[^.]+$' \ + | grep -v ErrorProneRuntimeClasspath \ | paste -s -d ',' )" +# XXX: Drop the `ErrorProneRuntimeClasspath` exclusion once that check resides +# in a separate Maven module. error_prone_validation_flags="${error_prone_shared_flags} -XepDisableAllChecks $( find "${error_prone_support_root}" -path "*/META-INF/services/com.google.errorprone.bugpatterns.BugChecker" -print0 \ | xargs -0 grep -hoP '[^.]+$' \ | sed -r 's,(.*),-Xep:\1:WARN,' \ + | grep -v ErrorProneRuntimeClasspath \ | paste -s -d ' ' )" From 17d3a5ed468b2f8081c5037706b1ee8b6e231bcd Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 27 Jan 2024 12:22:45 +0100 Subject: [PATCH 2/6] Upgrade Checkstyle integration test 10.12.4 -> 10.12.7 --- .../checkstyle-10.12.4-expected-warnings.txt | 140 - ...checkstyle-10.12.7-expected-changes.patch} | 6884 +++++------------ .../checkstyle-10.12.7-expected-warnings.txt | 0 ...it.patch => checkstyle-10.12.7-init.patch} | 57 +- ...style-10.12.4.sh => checkstyle-10.12.7.sh} | 6 +- 5 files changed, 2086 insertions(+), 5001 deletions(-) delete mode 100644 integration-tests/checkstyle-10.12.4-expected-warnings.txt rename integration-tests/{checkstyle-10.12.4-expected-changes.patch => checkstyle-10.12.7-expected-changes.patch} (92%) create mode 100644 integration-tests/checkstyle-10.12.7-expected-warnings.txt rename integration-tests/{checkstyle-10.12.4-init.patch => checkstyle-10.12.7-init.patch} (82%) rename integration-tests/{checkstyle-10.12.4.sh => checkstyle-10.12.7.sh} (97%) diff --git a/integration-tests/checkstyle-10.12.4-expected-warnings.txt b/integration-tests/checkstyle-10.12.4-expected-warnings.txt deleted file mode 100644 index 283be35a3b..0000000000 --- a/integration-tests/checkstyle-10.12.4-expected-warnings.txt +++ /dev/null @@ -1,140 +0,0 @@ -src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[117,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[169,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[91,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[104,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[67,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `do` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/DetailAstImplTest.java:[597,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/api/FilterSetTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/api/FullIdentTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheckTest.java:[77,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java:[65,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[193,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[206,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[217,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[228,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java:[103,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckTest.java:[46,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java:[59,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java:[50,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java:[55,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheckTest.java:[105,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java:[57,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `native` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java:[290,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `static` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java:[373,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `for` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java:[125,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `return` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheckTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheckTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java:[54,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java:[99,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `null` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java:[81,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheckTest.java:[59,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[57,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[75,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest.java:[30,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfoTest.java:[230,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `throws` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfoTest.java:[294,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `return` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[89,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[102,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[94,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtilTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `extractInlineTags` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java:[189,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `new` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[188,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `extends` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[196,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `implements` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[266,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `throws` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifierOptionTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `case` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java:[67,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `catch` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java:[78,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckTest.java:[47,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java:[120,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java:[195,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthCheckTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java:[94,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java:[93,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `abstract` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java:[73,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheckTest.java:[62,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java:[50,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java:[51,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java:[62,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java:[50,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java:[174,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `synchronized` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCaseDefaultColonCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java:[46,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/filters/IntMatchFilterElementTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilterTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElementTest.java:[185,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilterTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java:[210,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java:[142,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionSingleFilterTest.java:[42,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/grammar/antlr4/Antlr4AstRegressionTest.java:[34,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/CommentsTest.java:[53,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/grammar/java8/DefaultMethodsTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `switch` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/gui/BaseCellEditorTest.java:[31,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) -src/test/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGeneratorTest.java:[205,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGeneratorTest.java:[219,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `import` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGeneratorTest.java:[265,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `switch` is not a valid identifier) diff --git a/integration-tests/checkstyle-10.12.4-expected-changes.patch b/integration-tests/checkstyle-10.12.7-expected-changes.patch similarity index 92% rename from integration-tests/checkstyle-10.12.4-expected-changes.patch rename to integration-tests/checkstyle-10.12.7-expected-changes.patch index 87177fc1f3..41af90329b 100644 --- a/integration-tests/checkstyle-10.12.4-expected-changes.patch +++ b/integration-tests/checkstyle-10.12.7-expected-changes.patch @@ -3093,6 +3093,79 @@ runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); } +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionBooleanExpressionComplexityTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionBooleanExpressionComplexityTest.java +@@ -19,14 +19,14 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionComplexityCheck; + import java.io.File; +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpathTestSupport { ++final class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { +@@ -34,7 +34,7 @@ public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpat + } + + @Test +- public void testMethodOne() throws Exception { ++ void methodOne() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionBooleanExpressionComplexityOne.java")); + +@@ -51,7 +51,7 @@ public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpat + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionBooleanExpressionComplexityOne']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]/SLIST" +@@ -62,7 +62,7 @@ public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpat + } + + @Test +- public void testMethodTwo() throws Exception { ++ void methodTwo() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionBooleanExpressionComplexityTwo.java")); + +@@ -79,7 +79,7 @@ public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpat + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='SuppressionXpathRegressionBooleanExpressionComplexityTwo']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodTwo']]/SLIST/VARIABLE_DEF" +@@ -89,7 +89,7 @@ public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpat + } + + @Test +- public void testMethodThree() throws Exception { ++ void methodThree() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionBoolean" + "ExpressionComplexityThree.java")); + +@@ -106,7 +106,7 @@ public class XpathRegressionBooleanExpressionComplexityTest extends AbstractXpat + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='SuppressionXpathRegressionBooleanExpressionComplexityThree']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodThree']]/SLIST/LITERAL_IF"); --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java @@ -26,7 +26,7 @@ import java.util.Arrays; @@ -4116,6 +4189,186 @@ final File fileToProcess = new File(getPath("SuppressionXpathRegressionFinalClass2.java")); final DefaultConfiguration moduleConfig = createModuleConfig(FinalClassCheck.class); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalLocalVariableTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalLocalVariableTest.java +@@ -19,13 +19,14 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck; + import java.io.File; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupport { ++final class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupport { + + private final String checkName = FinalLocalVariableCheck.class.getSimpleName(); + +@@ -35,7 +36,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable1.java")); + +@@ -47,7 +48,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalLocalVariable1']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]" +@@ -57,7 +58,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable2.java")); + +@@ -69,7 +70,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalLocalVariable2']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]/SLIST/" +@@ -79,7 +80,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testThree() throws Exception { ++ void three() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable3.java")); + +@@ -91,7 +92,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalLocalVariable3']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" +@@ -102,7 +103,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testFour() throws Exception { ++ void four() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable4.java")); + +@@ -115,7 +116,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalLocalVariable4']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" +@@ -126,7 +127,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testFive() throws Exception { ++ void five() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable5.java")); + +@@ -139,7 +140,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalLocalVariable5']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" +@@ -149,7 +150,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testSix() throws Exception { ++ void six() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable6.java")); + +@@ -162,7 +163,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable6']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method1']]" +@@ -172,7 +173,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testSeven() throws Exception { ++ void seven() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable7.java")); + +@@ -185,7 +186,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable7']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" +@@ -196,7 +197,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testEight() throws Exception { ++ void eight() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable8.java")); + +@@ -209,7 +210,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalLocalVariable8']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]" +@@ -219,7 +220,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + } + + @Test +- public void testNine() throws Exception { ++ void nine() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionFinalLocalVariable9.java")); + +@@ -231,7 +232,7 @@ public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable9']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]/SLIST/LITERAL_TRY" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java @@ -19,15 +19,15 @@ @@ -4948,6 +5201,52 @@ "/COMPILATION_UNIT/CLASS_DEF" + "[./IDENT[@text='SuppressionXpathRegressionIndentationElseWithoutCurly']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/LITERAL_ELSE" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerAssignmentTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerAssignmentTest.java +@@ -19,6 +19,7 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck; + import java.io.File; +@@ -26,7 +27,7 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionInnerAssignmentTest extends AbstractXpathTestSupport { ++final class XpathRegressionInnerAssignmentTest extends AbstractXpathTestSupport { + + private final String checkName = InnerAssignmentCheck.class.getSimpleName(); + +@@ -36,7 +37,7 @@ public class XpathRegressionInnerAssignmentTest extends AbstractXpathTestSupport + } + + @Test +- public void testFile1() throws Exception { ++ void file1() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionInnerAssignment1.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class); +@@ -46,7 +47,7 @@ public class XpathRegressionInnerAssignmentTest extends AbstractXpathTestSupport + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionInnerAssignment1']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]" +@@ -56,7 +57,7 @@ public class XpathRegressionInnerAssignmentTest extends AbstractXpathTestSupport + } + + @Test +- public void testFile2() throws Exception { ++ void file2() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionInnerAssignment2.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class); --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java @@ -26,7 +26,7 @@ import java.util.Arrays; @@ -5516,6 +5815,61 @@ "/COMPILATION_UNIT/CLASS_DEF" + "[./IDENT[@text='SuppressionXpathRegressionLeftCurlyThree']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sample']]/SLIST/LITERAL_IF/SLIST"); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMagicNumberTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMagicNumberTest.java +@@ -19,6 +19,7 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck; + import java.io.File; +@@ -26,7 +27,7 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { ++final class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { +@@ -34,7 +35,7 @@ public class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { + } + + @Test +- public void testVariable() throws Exception { ++ void variable() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionMagicNumberVariable.java")); + +@@ -59,7 +60,7 @@ public class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { + } + + @Test +- public void testMethodDef() throws Exception { ++ void methodDef() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionMagicNumberMethodDef.java")); + +@@ -85,7 +86,7 @@ public class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { + } + + @Test +- public void testAnotherVariable() throws Exception { ++ void anotherVariable() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionMagicNumberAnotherVariable.java")); + +@@ -96,7 +97,7 @@ public class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionMagicNumberAnotherVariable']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='performOperation']]" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMatchXpathTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMatchXpathTest.java @@ -19,16 +19,16 @@ @@ -8112,6 +8466,80 @@ "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text='SuppressionXpathRegressionSingleSpaceSeparatorValidateComments']]" + "/OBJBLOCK/SINGLE_LINE_COMMENT[./COMMENT_CONTENT" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStaticVariableNameTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStaticVariableNameTest.java +@@ -19,15 +19,15 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck; + import com.puppycrawl.tools.checkstyle.checks.naming.StaticVariableNameCheck; + import java.io.File; +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupport { ++final class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupport { + + private final String checkName = StaticVariableNameCheck.class.getSimpleName(); + +@@ -37,7 +37,7 @@ public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupp + } + + @Test +- public void test1() throws Exception { ++ void test1() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionStaticVariableName1.java")); + +@@ -54,7 +54,7 @@ public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text" + + "='SuppressionXpathRegressionStaticVariableName1']]" +@@ -63,7 +63,7 @@ public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupp + } + + @Test +- public void test2() throws Exception { ++ void test2() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath("SuppressionXpathRegressionStaticVariableName2.java")); + +@@ -80,7 +80,7 @@ public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text" + + "='SuppressionXpathRegressionStaticVariableName2']]" +@@ -91,7 +91,7 @@ public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupp + } + + @Test +- public void test3() throws Exception { ++ void test3() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath("SuppressionXpathRegressionStaticVariableName3.java")); + +@@ -108,7 +108,7 @@ public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text" + + "='SuppressionXpathRegressionStaticVariableName2']]" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStringLiteralEqualityTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStringLiteralEqualityTest.java @@ -19,15 +19,15 @@ @@ -8168,6 +8596,80 @@ "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionStringLiteralEquality2']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSuperCloneTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSuperCloneTest.java +@@ -19,15 +19,15 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.coding.AbstractSuperCheck; + import com.puppycrawl.tools.checkstyle.checks.coding.SuperCloneCheck; + import java.io.File; +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { ++final class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { +@@ -35,7 +35,7 @@ public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + } + + @Test +- public void testInnerClone() throws Exception { ++ void innerClone() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionSuperCloneInnerClone.java")); + +@@ -46,7 +46,7 @@ public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpath" + + "RegressionSuperCloneInnerClone']]" +@@ -57,7 +57,7 @@ public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + } + + @Test +- public void testNoSuperClone() throws Exception { ++ void noSuperClone() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionSuperCloneNoSuperClone.java")); + +@@ -68,7 +68,7 @@ public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpath" + + "RegressionSuperCloneNoSuperClone']]" +@@ -79,7 +79,7 @@ public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + } + + @Test +- public void testPlainAndSubclasses() throws Exception { ++ void plainAndSubclasses() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionSuperClonePlainAndSubclasses.java")); + +@@ -90,7 +90,7 @@ public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpath" + + "RegressionSuperClonePlainAndSubclasses']]" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java @@ -19,14 +19,14 @@ @@ -8831,3844 +9333,281 @@ @@ -54,7 +54,7 @@ public class XpathRegressionUnnecessarySemicolonInTryWithResourcesTest UnnecessarySemicolonInTryWithResourcesCheck.MSG_SEMI), }; - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources']]" - + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='m']]/SLIST/LITERAL_TRY" -@@ -63,7 +63,7 @@ public class XpathRegressionUnnecessarySemicolonInTryWithResourcesTest - } - - @Test -- public void testAllowWhenNoBraceAfterSemicolon() throws Exception { -+ void allowWhenNoBraceAfterSemicolon() throws Exception { - final File fileToProcess = - new File( - getPath( -@@ -81,7 +81,7 @@ public class XpathRegressionUnnecessarySemicolonInTryWithResourcesTest - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace']]" - + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" ---- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java -+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java -@@ -19,14 +19,14 @@ - - package org.checkstyle.suppressionxpathfilter; - -+import com.google.common.collect.ImmutableList; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; - import com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck; - import java.io.File; --import java.util.Collections; - import java.util.List; - import org.junit.jupiter.api.Test; - --public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { -+final class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { - - private final String checkName = UnusedImportsCheck.class.getSimpleName(); - -@@ -36,7 +36,7 @@ public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { - } - - @Test -- public void testOne() throws Exception { -+ void one() throws Exception { - final File fileToProcess = new File(getPath("SuppressionXpathRegressionUnusedImportsOne.java")); - - final DefaultConfiguration moduleConfig = createModuleConfig(UnusedImportsCheck.class); -@@ -47,14 +47,14 @@ public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/IMPORT/DOT[./IDENT[@text='List']]/DOT/IDENT[@text='java']"); - - runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); - } - - @Test -- public void testTwo() throws Exception { -+ void two() throws Exception { - final File fileToProcess = new File(getPath("SuppressionXpathRegressionUnusedImportsTwo.java")); - - final DefaultConfiguration moduleConfig = createModuleConfig(UnusedImportsCheck.class); -@@ -66,7 +66,7 @@ public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/STATIC_IMPORT/DOT" - + "[./IDENT[@text='Entry']]/DOT[./IDENT[@text='Map']]" - + "/DOT/IDENT[@text='java']"); ---- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java -+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java -@@ -26,7 +26,7 @@ import java.util.Arrays; - import java.util.List; - import org.junit.jupiter.api.Test; - --public class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSupport { -+final class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSupport { - private final String checkName = UnusedLocalVariableCheck.class.getSimpleName(); - - @Override -@@ -35,7 +35,7 @@ public class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSup - } - - @Test -- public void testOne() throws Exception { -+ void one() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUnusedLocalVariableOne.java")); - -@@ -71,7 +71,7 @@ public class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSup - } - - @Test -- public void testTwo() throws Exception { -+ void two() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUnusedLocalVariableTwo.java")); - ---- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java -+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java -@@ -26,7 +26,7 @@ import java.util.Arrays; - import java.util.List; - import org.junit.jupiter.api.Test; - --public class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { -+final class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { - - private final String checkName = UpperEllCheck.class.getSimpleName(); - -@@ -36,7 +36,7 @@ public class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { - } - - @Test -- public void testUpperEllOne() throws Exception { -+ void upperEllOne() throws Exception { - final File fileToProcess = new File(getPath("SuppressionXpathRegressionUpperEllFirst.java")); - - final DefaultConfiguration moduleConfig = createModuleConfig(UpperEllCheck.class); -@@ -59,7 +59,7 @@ public class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { - } - - @Test -- public void testUpperEllTwo() throws Exception { -+ void upperEllTwo() throws Exception { - final File fileToProcess = new File(getPath("SuppressionXpathRegressionUpperEllSecond.java")); - - final DefaultConfiguration moduleConfig = createModuleConfig(UpperEllCheck.class); ---- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java -+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java -@@ -26,7 +26,7 @@ import java.util.Arrays; - import java.util.List; - import org.junit.jupiter.api.Test; - --public class XpathRegressionVariableDeclarationUsageDistanceTest extends AbstractXpathTestSupport { -+final class XpathRegressionVariableDeclarationUsageDistanceTest extends AbstractXpathTestSupport { - private final String checkName = VariableDeclarationUsageDistanceCheck.class.getSimpleName(); - - @Override -@@ -35,7 +35,7 @@ public class XpathRegressionVariableDeclarationUsageDistanceTest extends Abstrac - } - - @Test -- public void testOne() throws Exception { -+ void one() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionVariableDeclarationUsageDistance1.java")); - -@@ -79,7 +79,7 @@ public class XpathRegressionVariableDeclarationUsageDistanceTest extends Abstrac - } - - @Test -- public void testTwo() throws Exception { -+ void two() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionVariableDeclarationUsageDistance2.java")); - ---- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java -+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java -@@ -19,14 +19,14 @@ - - package org.checkstyle.suppressionxpathfilter; - -+import com.google.common.collect.ImmutableList; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; - import com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck; - import java.io.File; --import java.util.Collections; - import java.util.List; - import org.junit.jupiter.api.Test; - --public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport { -+final class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport { - - private final String checkName = WhitespaceAfterCheck.class.getSimpleName(); - -@@ -36,7 +36,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport - } - - @Test -- public void testWhitespaceAfterTypecast() throws Exception { -+ void whitespaceAfterTypecast() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAfterTypecast.java")); - -@@ -48,7 +48,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAfterTypecast']]/OBJBLOCK" - + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST/RPAREN"); -@@ -57,7 +57,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport - } - - @Test -- public void testWhitespaceAfterNotFollowed() throws Exception { -+ void whitespaceAfterNotFollowed() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAfterNotFollowed.java")); - -@@ -70,7 +70,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAfterNotFollowed']]/OBJBLOCK" - + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/ARRAY_INIT/COMMA"); ---- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java -+++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java -@@ -19,14 +19,14 @@ - - package org.checkstyle.suppressionxpathfilter; - -+import com.google.common.collect.ImmutableList; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; - import com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck; - import java.io.File; --import java.util.Collections; - import java.util.List; - import org.junit.jupiter.api.Test; - --public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSupport { -+final class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSupport { - - private final String checkName = WhitespaceAroundCheck.class.getSimpleName(); - -@@ -36,7 +36,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor - } - - @Test -- public void testWhitespaceAroundNotPreceded() throws Exception { -+ void whitespaceAroundNotPreceded() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAroundNotPreceded.java")); - -@@ -49,7 +49,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAroundNotPreceded']]/OBJBLOCK" - + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN"); -@@ -58,7 +58,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor - } - - @Test -- public void testWhitespaceAroundNotFollowed() throws Exception { -+ void whitespaceAroundNotFollowed() throws Exception { - final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAroundNotFollowed.java")); - -@@ -71,7 +71,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor - }; - - final List expectedXpathQueries = -- Collections.singletonList( -+ ImmutableList.of( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAroundNotFollowed']]/OBJBLOCK" - + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN"); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java -@@ -275,8 +275,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali - /** A converter that converts a string to a pattern. */ - private static final class PatternConverter implements Converter { - -- @SuppressWarnings("unchecked") - @Override -+ @SuppressWarnings("unchecked") - public Object convert(Class type, Object value) { - return CommonUtil.createPattern(value.toString()); - } -@@ -285,8 +285,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali - /** A converter that converts strings to severity level. */ - private static final class SeverityLevelConverter implements Converter { - -- @SuppressWarnings("unchecked") - @Override -+ @SuppressWarnings("unchecked") - public Object convert(Class type, Object value) { - return SeverityLevel.getInstance(value.toString()); - } -@@ -295,8 +295,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali - /** A converter that converts strings to scope. */ - private static final class ScopeConverter implements Converter { - -- @SuppressWarnings("unchecked") - @Override -+ @SuppressWarnings("unchecked") - public Object convert(Class type, Object value) { - return Scope.getInstance(value.toString()); - } -@@ -305,8 +305,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali - /** A converter that converts strings to uri. */ - private static final class UriConverter implements Converter { - -- @SuppressWarnings("unchecked") - @Override -+ @SuppressWarnings("unchecked") - public Object convert(Class type, Object value) { - final String url = value.toString(); - URI result = null; -@@ -329,8 +329,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali - */ - private static final class RelaxedStringArrayConverter implements Converter { - -- @SuppressWarnings("unchecked") - @Override -+ @SuppressWarnings("unchecked") - public Object convert(Class type, Object value) { - final StringTokenizer tokenizer = - new StringTokenizer(value.toString().trim(), COMMA_SEPARATOR); -@@ -355,8 +355,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali - /** Constant for optimization. */ - private static final AccessModifierOption[] EMPTY_MODIFIER_ARRAY = new AccessModifierOption[0]; - -- @SuppressWarnings("unchecked") - @Override -+ @SuppressWarnings("unchecked") - public Object convert(Class type, Object value) { - // Converts to a String and trims it for the tokenizer. - final StringTokenizer tokenizer = ---- a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; -+ - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; - import com.puppycrawl.tools.checkstyle.api.BeforeExecutionFileFilter; -@@ -50,7 +53,6 @@ import java.util.Locale; - import java.util.Set; - import java.util.SortedSet; - import java.util.TreeSet; --import java.util.stream.Collectors; - import java.util.stream.Stream; - import org.apache.commons.logging.Log; - import org.apache.commons.logging.LogFactory; -@@ -215,7 +217,7 @@ public class Checker extends AbstractAutomaticBean implements MessageDispatcher, - final List targetFiles = - files.stream() - .filter(file -> CommonUtil.matchesFileExtension(file, fileExtensions)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - processFiles(targetFiles); - - // Finish up -@@ -242,7 +244,7 @@ public class Checker extends AbstractAutomaticBean implements MessageDispatcher, - .filter(ExternalResourceHolder.class::isInstance) - .map(ExternalResourceHolder.class::cast) - .flatMap(resource -> resource.getExternalResourceLocations().stream()) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); - } - - /** Notify all listeners about the audit start. */ ---- a/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkState; -+ - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import com.puppycrawl.tools.checkstyle.api.Configuration; - import com.puppycrawl.tools.checkstyle.api.SeverityLevel; -@@ -523,9 +525,7 @@ public final class ConfigurationLoader { - final DefaultConfiguration top = configStack.peek(); - top.addMessage(key, value); - } else { -- if (!METADATA.equals(qName)) { -- throw new IllegalStateException("Unknown name:" + qName + "."); -- } -+ checkState(METADATA.equals(qName), "Unknown name:%s.", qName); - } - } - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+import static java.nio.charset.StandardCharsets.UTF_8; -+ - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; - import com.puppycrawl.tools.checkstyle.api.AutomaticBean; -@@ -27,7 +30,6 @@ import java.io.OutputStream; - import java.io.OutputStreamWriter; - import java.io.PrintWriter; - import java.io.Writer; --import java.nio.charset.StandardCharsets; - - /** - * Simple plain logger for text output. This is maybe not very suitable for a text output into a -@@ -126,21 +128,17 @@ public class DefaultLogger extends AbstractAutomaticBean implements AuditListene - OutputStream errorStream, - OutputStreamOptions errorStreamOptions, - AuditEventFormatter messageFormatter) { -- if (infoStreamOptions == null) { -- throw new IllegalArgumentException("Parameter infoStreamOptions can not be null"); -- } -+ checkArgument(infoStreamOptions != null, "Parameter infoStreamOptions can not be null"); - closeInfo = infoStreamOptions == OutputStreamOptions.CLOSE; -- if (errorStreamOptions == null) { -- throw new IllegalArgumentException("Parameter errorStreamOptions can not be null"); -- } -+ checkArgument(errorStreamOptions != null, "Parameter errorStreamOptions can not be null"); - closeError = errorStreamOptions == OutputStreamOptions.CLOSE; -- final Writer infoStreamWriter = new OutputStreamWriter(infoStream, StandardCharsets.UTF_8); -+ final Writer infoStreamWriter = new OutputStreamWriter(infoStream, UTF_8); - infoWriter = new PrintWriter(infoStreamWriter); - - if (infoStream == errorStream) { - errorWriter = infoWriter; - } else { -- final Writer errorStreamWriter = new OutputStreamWriter(errorStream, StandardCharsets.UTF_8); -+ final Writer errorStreamWriter = new OutputStreamWriter(errorStream, UTF_8); - errorWriter = new PrintWriter(errorStreamWriter); - } - formatter = messageFormatter; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle; - -+import com.google.common.collect.ImmutableSet; - import java.util.Set; - - /** Contains constant definitions common to the package. */ -@@ -29,7 +30,7 @@ public final class Definitions { - - /** Name of modules which are not checks, but are internal modules. */ - public static final Set INTERNAL_MODULES = -- Set.of( -+ ImmutableSet.of( - "com.puppycrawl.tools.checkstyle.meta.JavadocMetadataScraper", - "com.puppycrawl.tools.checkstyle.site.ClassAndPropertiesSettersJavadocScraper"); - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java -@@ -19,19 +19,21 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static java.util.Objects.requireNonNullElseGet; -+import static java.util.stream.Collectors.toCollection; -+ -+import com.google.common.collect.ImmutableList; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageLexer; - import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser; - import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParserBaseVisitor; - import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - import java.util.ArrayList; --import java.util.Collections; - import java.util.Iterator; - import java.util.List; --import java.util.Optional; - import java.util.Queue; - import java.util.concurrent.ConcurrentLinkedQueue; --import java.util.stream.Collectors; - import org.antlr.v4.runtime.BufferedTokenStream; - import org.antlr.v4.runtime.CommonTokenStream; - import org.antlr.v4.runtime.ParserRuleContext; -@@ -406,7 +408,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); - - // We add C style array declarator brackets to TYPE ast - final DetailAstImpl typeAst = (DetailAstImpl) methodDef.findFirstToken(TokenTypes.TYPE); -@@ -469,7 +471,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor children = - ctx.children.stream() - .filter(child -> !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - processChildren(methodDef, children); - - // We add C style array declarator brackets to TYPE ast -@@ -780,7 +782,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); - - // We add C style array declarator brackets to TYPE ast - final DetailAstImpl typeAst = -@@ -852,7 +854,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !child.equals(ctx.LITERAL_SUPER())) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); - return primaryCtorCall; - } - -@@ -1090,7 +1092,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.VariableModifierContext)) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); - return catchParameterDef; - } - -@@ -1421,8 +1423,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); -+ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); - - DetailAstPair.addAstChild(currentAst, expressionList); - DetailAstPair.addAstChild(currentAst, create(ctx.RPAREN())); -@@ -1448,8 +1449,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); -+ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); - - methodCall.addChild(expressionList); - methodCall.addChild(create((Token) ctx.RPAREN().getPayload())); -@@ -1508,7 +1508,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor children = - ctx.children.stream() - .filter(child -> !child.equals(ctx.DOUBLE_COLON())) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - processChildren(doubleColon, children); - return doubleColon; - } -@@ -1520,7 +1520,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !child.equals(ctx.QUESTION())) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); - return root; - } - -@@ -1547,7 +1547,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor descendantList = - binOpList.parallelStream() - .map(this::getInnerBopAst) -- .collect(Collectors.toCollection(ConcurrentLinkedQueue::new)); -+ .collect(toCollection(ConcurrentLinkedQueue::new)); - - bop.addChild(descendantList.poll()); - DetailAstImpl pointer = bop.getFirstChild(); -@@ -1584,8 +1584,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); -+ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); - - final DetailAstImpl dot = create(ctx.DOT()); - dot.addChild(visit(ctx.expr())); -@@ -1618,8 +1617,8 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.PARAMETERS)); -+ requireNonNullElseGet( -+ visit(ctx.formalParameterList()), () -> createImaginary(TokenTypes.PARAMETERS)); - addLastSibling(lparen, parameters); - addLastSibling(lparen, create(ctx.RPAREN())); - return lparen; -@@ -1882,8 +1881,8 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); -+ requireNonNullElseGet( -+ visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); - root.addChild(expressionList); - - root.addChild(create(ctx.RPAREN())); -@@ -1898,8 +1897,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); -+ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); - addLastSibling(lparen, expressionList); - addLastSibling(lparen, create(ctx.RPAREN())); - return lparen; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.nio.charset.StandardCharsets.UTF_8; -+ - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.DetailNode; -@@ -28,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; - import java.io.File; - import java.io.IOException; - import java.io.PrintWriter; --import java.nio.charset.StandardCharsets; - import java.util.function.Consumer; - import java.util.regex.Matcher; - import java.util.regex.Pattern; -@@ -95,7 +96,7 @@ public final class JavadocPropertiesGenerator { - * @throws CheckstyleException if a javadoc comment can not be parsed - */ - private static void writePropertiesFile(CliOptions options) throws CheckstyleException { -- try (PrintWriter writer = new PrintWriter(options.outputFile, StandardCharsets.UTF_8)) { -+ try (PrintWriter writer = new PrintWriter(options.outputFile, UTF_8)) { - final DetailAST top = - JavaParser.parseFile(options.inputFile, JavaParser.Options.WITH_COMMENTS).getFirstChild(); - final DetailAST objBlock = getClassBody(top); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java -@@ -19,13 +19,14 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.nio.charset.StandardCharsets.UTF_8; -+ - import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; - import java.io.IOException; - import java.io.InputStreamReader; - import java.io.Reader; - import java.net.URL; - import java.net.URLConnection; --import java.nio.charset.StandardCharsets; - import java.text.MessageFormat; - import java.util.Locale; - import java.util.MissingResourceException; -@@ -147,8 +148,7 @@ public class LocalizedMessage { - final URLConnection connection = url.openConnection(); - if (connection != null) { - connection.setUseCaches(!reload); -- try (Reader streamReader = -- new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8)) { -+ try (Reader streamReader = new InputStreamReader(connection.getInputStream(), UTF_8)) { - // Only this line is changed to make it read property files as UTF-8. - resourceBundle = new PropertyResourceBundle(streamReader); - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.util.stream.Collectors.toCollection; -+ - import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; -@@ -38,7 +40,6 @@ import java.util.ArrayList; - import java.util.LinkedList; - import java.util.List; - import java.util.Locale; --import java.util.Objects; - import java.util.Properties; - import java.util.logging.ConsoleHandler; - import java.util.logging.Filter; -@@ -46,7 +47,6 @@ import java.util.logging.Level; - import java.util.logging.LogRecord; - import java.util.logging.Logger; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import org.apache.commons.logging.Log; - import org.apache.commons.logging.LogFactory; - import picocli.CommandLine; -@@ -274,7 +274,7 @@ public final class Main { - final String stringAst = - AstTreeStringPrinter.printFileAst(file, JavaParser.Options.WITHOUT_COMMENTS); - System.out.print(stringAst); -- } else if (Objects.nonNull(options.xpath)) { -+ } else if (options.xpath != null) { - final String branch = XpathUtil.printXpathBranch(options.xpath, filesToProcess.get(0)); - System.out.print(branch); - } else if (options.printAstWithComments) { -@@ -791,7 +791,7 @@ public final class Main { - .map(File::getAbsolutePath) - .map(Pattern::quote) - .map(pattern -> Pattern.compile("^" + pattern + "$")) -- .collect(Collectors.toCollection(ArrayList::new)); -+ .collect(toCollection(ArrayList::new)); - result.addAll(excludeRegex); - return result; - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.nio.charset.StandardCharsets.UTF_8; -+ - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; - import com.puppycrawl.tools.checkstyle.api.SeverityLevel; -@@ -26,7 +28,6 @@ import java.io.OutputStream; - import java.io.OutputStreamWriter; - import java.io.PrintWriter; - import java.io.Writer; --import java.nio.charset.StandardCharsets; - - /** Simple logger for metadata generator util. */ - public class MetadataGeneratorLogger extends AbstractAutomaticBean implements AuditListener { -@@ -48,7 +49,7 @@ public class MetadataGeneratorLogger extends AbstractAutomaticBean implements Au - */ - public MetadataGeneratorLogger( - OutputStream outputStream, OutputStreamOptions outputStreamOptions) { -- final Writer errorStreamWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8); -+ final Writer errorStreamWriter = new OutputStreamWriter(outputStream, UTF_8); - errorWriter = new PrintWriter(errorStreamWriter); - formatter = new AuditEventDefaultFormatter(); - closeErrorWriter = outputStreamOptions == OutputStreamOptions.CLOSE; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java -@@ -19,13 +19,14 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.util.Collections.unmodifiableSet; -+ - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import java.io.BufferedInputStream; - import java.io.IOException; - import java.io.InputStream; - import java.net.URL; - import java.util.ArrayDeque; --import java.util.Collections; - import java.util.Deque; - import java.util.Enumeration; - import java.util.HashMap; -@@ -137,7 +138,7 @@ public final class PackageNamesLoader extends XmlLoader { - throw new CheckstyleException("unable to open one of package files", ex); - } - -- return Collections.unmodifiableSet(result); -+ return unmodifiableSet(result); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java -@@ -19,10 +19,18 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static java.util.stream.Collectors.groupingBy; -+import static java.util.stream.Collectors.joining; -+import static java.util.stream.Collectors.mapping; -+import static java.util.stream.Collectors.toCollection; -+ -+import com.google.common.collect.ImmutableMap; -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import com.puppycrawl.tools.checkstyle.utils.ModuleReflectionUtil; - import java.io.IOException; --import java.util.Collections; - import java.util.HashMap; - import java.util.HashSet; - import java.util.LinkedHashSet; -@@ -31,7 +39,6 @@ import java.util.Map; - import java.util.Map.Entry; - import java.util.Set; - import java.util.function.Supplier; --import java.util.stream.Collectors; - import java.util.stream.Stream; - - /** -@@ -126,12 +133,8 @@ public class PackageObjectFactory implements ModuleFactory { - */ - public PackageObjectFactory( - Set packageNames, ClassLoader moduleClassLoader, ModuleLoadOption moduleLoadOption) { -- if (moduleClassLoader == null) { -- throw new IllegalArgumentException(NULL_LOADER_MESSAGE); -- } -- if (packageNames.contains(null)) { -- throw new IllegalArgumentException(NULL_PACKAGE_MESSAGE); -- } -+ checkArgument(moduleClassLoader != null, NULL_LOADER_MESSAGE); -+ checkArgument(!packageNames.contains(null), NULL_PACKAGE_MESSAGE); - - // create a copy of the given set, but retain ordering - packages = new LinkedHashSet<>(packageNames); -@@ -147,14 +150,10 @@ public class PackageObjectFactory implements ModuleFactory { - * @throws IllegalArgumentException if moduleClassLoader is null or packageNames is null - */ - public PackageObjectFactory(String packageName, ClassLoader moduleClassLoader) { -- if (moduleClassLoader == null) { -- throw new IllegalArgumentException(NULL_LOADER_MESSAGE); -- } -- if (packageName == null) { -- throw new IllegalArgumentException(NULL_PACKAGE_MESSAGE); -- } -+ checkArgument(moduleClassLoader != null, NULL_LOADER_MESSAGE); -+ checkArgument(packageName != null, NULL_PACKAGE_MESSAGE); - -- packages = Collections.singleton(packageName); -+ packages = ImmutableSet.of(packageName); - this.moduleClassLoader = moduleClassLoader; - } - -@@ -272,7 +271,7 @@ public class PackageObjectFactory implements ModuleFactory { - returnValue = createObject(fullModuleNames.iterator().next()); - } else { - final String optionalNames = -- fullModuleNames.stream().sorted().collect(Collectors.joining(STRING_SEPARATOR)); -+ fullModuleNames.stream().sorted().collect(joining(STRING_SEPARATOR)); - final LocalizedMessage exceptionMessage = - new LocalizedMessage( - Definitions.CHECKSTYLE_BUNDLE, -@@ -299,12 +298,11 @@ public class PackageObjectFactory implements ModuleFactory { - returnValue = - ModuleReflectionUtil.getCheckstyleModules(packages, loader).stream() - .collect( -- Collectors.groupingBy( -+ groupingBy( - Class::getSimpleName, -- Collectors.mapping( -- Class::getCanonicalName, Collectors.toCollection(HashSet::new)))); -+ mapping(Class::getCanonicalName, toCollection(HashSet::new)))); - } catch (IOException ignore) { -- returnValue = Collections.emptyMap(); -+ returnValue = ImmutableMap.of(); - } - return returnValue; - } -@@ -318,8 +316,8 @@ public class PackageObjectFactory implements ModuleFactory { - public static String getShortFromFullModuleNames(String fullName) { - return NAME_TO_FULL_MODULE_NAME.entrySet().stream() - .filter(entry -> entry.getValue().equals(fullName)) -- .map(Entry::getKey) - .findFirst() -+ .map(Entry::getKey) - .orElse(fullName); - } - -@@ -333,7 +331,7 @@ public class PackageObjectFactory implements ModuleFactory { - private static String joinPackageNamesWithClassName(String className, Set packages) { - return packages.stream() - .collect( -- Collectors.joining( -+ joining( - PACKAGE_SEPARATOR + className + STRING_SEPARATOR, - "", - PACKAGE_SEPARATOR + className)); -@@ -381,7 +379,7 @@ public class PackageObjectFactory implements ModuleFactory { - packages.stream() - .map(packageName -> packageName + PACKAGE_SEPARATOR + name) - .flatMap(className -> Stream.of(className, className + CHECK_SUFFIX)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - Object instance = null; - for (String possibleName : possibleNames) { - instance = createObject(possibleName); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java -@@ -19,10 +19,11 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+ -+import com.google.common.collect.Maps; - import java.util.Map; - import java.util.Properties; --import java.util.function.Function; --import java.util.stream.Collectors; - - /** Resolves external properties from an underlying {@code Properties} object. */ - public final class PropertiesExpander implements PropertyResolver { -@@ -37,12 +38,8 @@ public final class PropertiesExpander implements PropertyResolver { - * @throws IllegalArgumentException when properties argument is null - */ - public PropertiesExpander(Properties properties) { -- if (properties == null) { -- throw new IllegalArgumentException("cannot pass null"); -- } -- values = -- properties.stringPropertyNames().stream() -- .collect(Collectors.toMap(Function.identity(), properties::getProperty)); -+ checkArgument(properties != null, "cannot pass null"); -+ values = Maps.toMap(properties.stringPropertyNames(), properties::getProperty); - } - - @Override ---- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import com.puppycrawl.tools.checkstyle.api.Configuration; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; -@@ -93,12 +95,8 @@ public final class PropertyCacheFile { - * @throws IllegalArgumentException when either arguments are null - */ - public PropertyCacheFile(Configuration config, String fileName) { -- if (config == null) { -- throw new IllegalArgumentException("config can not be null"); -- } -- if (fileName == null) { -- throw new IllegalArgumentException("fileName can not be null"); -- } -+ checkArgument(config != null, "config can not be null"); -+ checkArgument(fileName != null, "fileName can not be null"); - this.config = config; - this.fileName = fileName; - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+import static java.nio.charset.StandardCharsets.UTF_8; -+ - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; - import com.puppycrawl.tools.checkstyle.api.SeverityLevel; -@@ -29,7 +32,6 @@ import java.io.OutputStream; - import java.io.OutputStreamWriter; - import java.io.PrintWriter; - import java.io.StringWriter; --import java.nio.charset.StandardCharsets; - import java.util.ArrayList; - import java.util.List; - import java.util.Locale; -@@ -107,10 +109,8 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener - */ - public SarifLogger(OutputStream outputStream, OutputStreamOptions outputStreamOptions) - throws IOException { -- if (outputStreamOptions == null) { -- throw new IllegalArgumentException("Parameter outputStreamOptions can not be null"); -- } -- writer = new PrintWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); -+ checkArgument(outputStreamOptions != null, "Parameter outputStreamOptions can not be null"); -+ writer = new PrintWriter(new OutputStreamWriter(outputStream, UTF_8)); - closeStream = outputStreamOptions == OutputStreamOptions.CLOSE; - report = readResource("/com/puppycrawl/tools/checkstyle/sarif/SarifReport.template"); - resultLineColumn = -@@ -307,7 +307,7 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener - result.write(buffer, 0, length); - length = inputStream.read(buffer); - } -- return result.toString(StandardCharsets.UTF_8); -+ return result.toString(UTF_8); - } - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.util.stream.Collectors.joining; -+ - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.FileText; -@@ -30,7 +32,6 @@ import java.util.List; - import java.util.Locale; - import java.util.regex.Matcher; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - - /** Class for constructing xpath queries to suppress nodes with specified line and column number. */ - public final class SuppressionsStringPrinter { -@@ -98,6 +99,6 @@ public final class SuppressionsStringPrinter { - final XpathQueryGenerator queryGenerator = - new XpathQueryGenerator(detailAST, lineNumber, columnNumber, fileText, tabWidth); - final List suppressions = queryGenerator.generate(); -- return suppressions.stream().collect(Collectors.joining(LINE_SEPARATOR, "", LINE_SEPARATOR)); -+ return suppressions.stream().collect(joining(LINE_SEPARATOR, "", LINE_SEPARATOR)); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import java.io.Serializable; - - /** -@@ -93,14 +95,12 @@ public class ThreadModeSettings implements Serializable { - */ - public final String resolveName(String name) { - if (checkerThreadsNumber > 1) { -- if (CHECKER_MODULE_NAME.equals(name)) { -- throw new IllegalArgumentException( -- "Multi thread mode for Checker module is not implemented"); -- } -- if (TREE_WALKER_MODULE_NAME.equals(name)) { -- throw new IllegalArgumentException( -- "Multi thread mode for TreeWalker module is not implemented"); -- } -+ checkArgument( -+ !CHECKER_MODULE_NAME.equals(name), -+ "Multi thread mode for Checker module is not implemented"); -+ checkArgument( -+ !TREE_WALKER_MODULE_NAME.equals(name), -+ "Multi thread mode for TreeWalker module is not implemented"); - } - - return name; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java -@@ -19,6 +19,10 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.collect.ImmutableSet.toImmutableSet; -+import static java.util.Comparator.naturalOrder; -+import static java.util.Comparator.nullsLast; -+ - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; -@@ -41,7 +45,6 @@ import java.util.Map; - import java.util.Set; - import java.util.SortedSet; - import java.util.TreeSet; --import java.util.stream.Collectors; - import java.util.stream.Stream; - - /** Responsible for walking an abstract syntax tree and notifying interested checks at each node. */ -@@ -369,7 +372,7 @@ public final class TreeWalker extends AbstractFileSetCheck implements ExternalRe - .filter(ExternalResourceHolder.class::isInstance) - .map(ExternalResourceHolder.class::cast) - .flatMap(resource -> resource.getExternalResourceLocations().stream()) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); - } - - /** -@@ -401,8 +404,8 @@ public final class TreeWalker extends AbstractFileSetCheck implements ExternalRe - private static SortedSet createNewCheckSortedSet() { - return new TreeSet<>( - Comparator.comparing(check -> check.getClass().getName()) -- .thenComparing(AbstractCheck::getId, Comparator.nullsLast(Comparator.naturalOrder())) -- .thenComparing(AbstractCheck::hashCode)); -+ .thenComparing(AbstractCheck::getId, nullsLast(naturalOrder())) -+ .thenComparingInt(AbstractCheck::hashCode)); - } - - /** State of AST. Indicates whether tree contains certain nodes. */ ---- a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java -@@ -19,6 +19,10 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.base.Preconditions.checkArgument; -+import static java.nio.charset.StandardCharsets.UTF_8; -+import static java.util.Collections.synchronizedList; -+ - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; - import com.puppycrawl.tools.checkstyle.api.AutomaticBean; -@@ -28,9 +32,7 @@ import java.io.OutputStream; - import java.io.OutputStreamWriter; - import java.io.PrintWriter; - import java.io.StringWriter; --import java.nio.charset.StandardCharsets; - import java.util.ArrayList; --import java.util.Collections; - import java.util.List; - import java.util.Map; - import java.util.concurrent.ConcurrentHashMap; -@@ -90,10 +92,8 @@ public class XMLLogger extends AbstractAutomaticBean implements AuditListener { - * @throws IllegalArgumentException if outputStreamOptions is null. - */ - public XMLLogger(OutputStream outputStream, OutputStreamOptions outputStreamOptions) { -- writer = new PrintWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); -- if (outputStreamOptions == null) { -- throw new IllegalArgumentException("Parameter outputStreamOptions can not be null"); -- } -+ writer = new PrintWriter(new OutputStreamWriter(outputStream, UTF_8)); -+ checkArgument(outputStreamOptions != null, "Parameter outputStreamOptions can not be null"); - closeStream = outputStreamOptions == OutputStreamOptions.CLOSE; - } - -@@ -328,10 +328,10 @@ public class XMLLogger extends AbstractAutomaticBean implements AuditListener { - private static final class FileMessages { - - /** The file error events. */ -- private final List errors = Collections.synchronizedList(new ArrayList<>()); -+ private final List errors = synchronizedList(new ArrayList<>()); - - /** The file exceptions. */ -- private final List exceptions = Collections.synchronizedList(new ArrayList<>()); -+ private final List exceptions = synchronizedList(new ArrayList<>()); - - /** - * Returns the file error events. ---- a/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java -@@ -19,13 +19,14 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static java.nio.charset.StandardCharsets.UTF_8; -+ - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.AuditListener; - import java.io.File; - import java.io.OutputStream; - import java.io.OutputStreamWriter; - import java.io.PrintWriter; --import java.nio.charset.StandardCharsets; - - /** - * Generates suppressions.xml file, based on violations occurred. See issue scanner.getBasedir() + File.separator + name) - .map(File::new) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - } - - /** Poor man enumeration for the formatter types. */ ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.api; - -+import static java.util.Collections.unmodifiableSet; -+ - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - import java.util.Collections; - import java.util.HashSet; -@@ -107,7 +109,7 @@ public abstract class AbstractCheck extends AbstractViolationReporter { - * @return the set of token names - */ - public final Set getTokenNames() { -- return Collections.unmodifiableSet(tokens); -+ return unmodifiableSet(tokens); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.api; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - import java.io.File; - import java.util.Arrays; -@@ -164,9 +166,7 @@ public abstract class AbstractFileSetCheck extends AbstractViolationReporter - * @throws IllegalArgumentException is argument is null - */ - public final void setFileExtensions(String... extensions) { -- if (extensions == null) { -- throw new IllegalArgumentException("Extensions array can not be null"); -- } -+ checkArgument(extensions != null, "Extensions array can not be null"); - - fileExtensions = new String[extensions.length]; - for (int i = 0; i < extensions.length; i++) { ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.api; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - /** - * Raw event for audit. - * -@@ -69,9 +71,7 @@ public final class AuditEvent { - * @throws IllegalArgumentException if {@code src} is {@code null}. - */ - public AuditEvent(Object src, String fileName, Violation violation) { -- if (src == null) { -- throw new IllegalArgumentException("null source"); -- } -+ checkArgument(src != null, "null source"); - - source = src; - this.fileName = fileName; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java -@@ -19,7 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.api; - --import java.util.Collections; -+import static java.util.Collections.unmodifiableSet; -+ - import java.util.HashSet; - import java.util.Set; - -@@ -56,7 +57,7 @@ public final class BeforeExecutionFileFilterSet implements BeforeExecutionFileFi - * @return the Filters of the filter set. - */ - public Set getBeforeExecutionFileFilters() { -- return Collections.unmodifiableSet(beforeExecutionFileFilters); -+ return unmodifiableSet(beforeExecutionFileFilters); - } - - @Override ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java -@@ -19,12 +19,13 @@ - - package com.puppycrawl.tools.checkstyle.api; - -+import static java.util.Collections.unmodifiableMap; -+ - import com.puppycrawl.tools.checkstyle.grammar.CommentListener; - import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - import java.util.ArrayList; - import java.util.Collection; --import java.util.Collections; - import java.util.HashMap; - import java.util.List; - import java.util.Map; -@@ -293,7 +294,7 @@ public final class FileContents implements CommentListener { - * @return the Map of comments - */ - public Map getSingleLineComments() { -- return Collections.unmodifiableMap(cppComments); -+ return unmodifiableMap(cppComments); - } - - /** -@@ -303,7 +304,7 @@ public final class FileContents implements CommentListener { - * @return the map of comments - */ - public Map> getBlockComments() { -- return Collections.unmodifiableMap(clangComments); -+ return unmodifiableMap(clangComments); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java -@@ -19,7 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.api; - --import java.util.Collections; -+import static java.util.Collections.unmodifiableSet; -+ - import java.util.HashSet; - import java.util.Set; - -@@ -56,7 +57,7 @@ public class FilterSet implements Filter { - * @return the Filters of the filter set. - */ - public Set getFilters() { -- return Collections.unmodifiableSet(filters); -+ return unmodifiableSet(filters); - } - - @Override ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.api; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import java.util.concurrent.atomic.AtomicInteger; - - /** -@@ -40,9 +42,7 @@ public final class SeverityLevelCounter implements AuditListener { - * @throws IllegalArgumentException when level is null - */ - public SeverityLevelCounter(SeverityLevel level) { -- if (level == null) { -- throw new IllegalArgumentException("'level' cannot be null"); -- } -+ checkArgument(level != null, "'level' cannot be null"); - this.level = level; - } - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java -@@ -385,7 +385,7 @@ public final class Violation implements Comparable { - && Objects.equals(columnNo, violation.columnNo) - && Objects.equals(columnCharIndex, violation.columnCharIndex) - && Objects.equals(tokenType, violation.tokenType) -- && Objects.equals(severityLevel, violation.severityLevel) -+ && severityLevel == violation.severityLevel - && Objects.equals(moduleId, violation.moduleId) - && Objects.equals(key, violation.key) - && Objects.equals(bundle, violation.bundle) ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java -@@ -265,8 +265,8 @@ public class AvoidEscapedUnicodeCharactersCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void beginTree(DetailAST rootAST) { - singlelineComments = getFileContents().getSingleLineComments(); - blockComments = getFileContents().getBlockComments(); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java -@@ -19,7 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks; - --import java.nio.charset.StandardCharsets; -+import static java.nio.charset.StandardCharsets.US_ASCII; -+ - import java.util.Arrays; - - /** -@@ -55,7 +56,7 @@ public enum LineSeparatorOption { - * @param sep the line separator, e.g. "\r\n" - */ - LineSeparatorOption(String sep) { -- lineSeparator = sep.getBytes(StandardCharsets.US_ASCII); -+ lineSeparator = sep.getBytes(US_ASCII); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks; - -+import static java.util.Collections.enumeration; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; - import com.puppycrawl.tools.checkstyle.api.FileText; -@@ -27,7 +29,6 @@ import java.io.IOException; - import java.io.InputStream; - import java.nio.file.Files; - import java.util.ArrayList; --import java.util.Collections; - import java.util.Enumeration; - import java.util.Iterator; - import java.util.List; -@@ -191,7 +192,7 @@ public class OrderedPropertiesCheck extends AbstractFileSetCheck { - /** Returns a copy of the keys. */ - @Override - public Enumeration keys() { -- return Collections.enumeration(keyList); -+ return enumeration(keyList); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java -@@ -19,12 +19,14 @@ - - package com.puppycrawl.tools.checkstyle.checks; - -+import static com.google.common.base.Preconditions.checkArgument; -+ -+import com.google.common.collect.ImmutableList; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.AuditEvent; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; --import java.util.Collections; - import java.util.HashMap; - import java.util.LinkedList; - import java.util.List; -@@ -293,7 +295,7 @@ public class SuppressWarningsHolder extends AbstractCheck { - */ - private static List getAllAnnotationValues(DetailAST ast) { - // get values of annotation -- List values = Collections.emptyList(); -+ List values = ImmutableList.of(); - final DetailAST lparenAST = ast.findFirstToken(TokenTypes.LPAREN); - if (lparenAST != null) { - final DetailAST nextAST = lparenAST.getNextSibling(); -@@ -375,9 +377,7 @@ public class SuppressWarningsHolder extends AbstractCheck { - * @throws IllegalArgumentException if the AST is invalid - */ - private static String getIdentifier(DetailAST ast) { -- if (ast == null) { -- throw new IllegalArgumentException("Identifier AST expected, but get null."); -- } -+ checkArgument(ast != null, "Identifier AST expected, but get null."); - final String identifier; - if (ast.getType() == TokenTypes.IDENT) { - identifier = ast.getText(); -@@ -433,7 +433,7 @@ public class SuppressWarningsHolder extends AbstractCheck { - final List annotationValues; - switch (ast.getType()) { - case TokenTypes.EXPR: -- annotationValues = Collections.singletonList(getStringExpr(ast)); -+ annotationValues = ImmutableList.of(getStringExpr(ast)); - break; - case TokenTypes.ANNOTATION_ARRAY_INIT: - annotationValues = findAllExpressionsInChildren(ast); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks; - -+import com.google.common.collect.ImmutableSet; -+import com.google.common.collect.Sets; - import com.puppycrawl.tools.checkstyle.Definitions; - import com.puppycrawl.tools.checkstyle.GlobalStatefulCheck; - import com.puppycrawl.tools.checkstyle.LocalizedMessage; -@@ -32,7 +34,6 @@ import java.io.File; - import java.io.InputStream; - import java.nio.file.Files; - import java.nio.file.NoSuchFileException; --import java.util.Arrays; - import java.util.HashSet; - import java.util.Locale; - import java.util.Map; -@@ -46,7 +47,6 @@ import java.util.TreeSet; - import java.util.concurrent.ConcurrentHashMap; - import java.util.regex.Matcher; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import org.apache.commons.logging.Log; - import org.apache.commons.logging.LogFactory; - -@@ -226,7 +226,7 @@ public class TranslationCheck extends AbstractFileSetCheck { - * @since 6.11 - */ - public void setRequiredTranslations(String... translationCodes) { -- requiredTranslations = Arrays.stream(translationCodes).collect(Collectors.toSet()); -+ requiredTranslations = ImmutableSet.copyOf(translationCodes); - validateUserSpecifiedLanguageCodes(requiredTranslations); - } - -@@ -394,7 +394,7 @@ public class TranslationCheck extends AbstractFileSetCheck { - final ResourceBundle newBundle = new ResourceBundle(baseName, path, extension); - final Optional bundle = findBundle(resourceBundles, newBundle); - if (bundle.isPresent()) { -- bundle.get().addFile(currentFile); -+ bundle.orElseThrow().addFile(currentFile); - } else { - newBundle.addFile(currentFile); - resourceBundles.add(newBundle); -@@ -497,9 +497,7 @@ public class TranslationCheck extends AbstractFileSetCheck { - for (Entry> fileKey : fileKeys.entrySet()) { - final Set currentFileKeys = fileKey.getValue(); - final Set missingKeys = -- keysThatMustExist.stream() -- .filter(key -> !currentFileKeys.contains(key)) -- .collect(Collectors.toSet()); -+ Sets.difference(keysThatMustExist, currentFileKeys).immutableCopy(); - if (!missingKeys.isEmpty()) { - final MessageDispatcher dispatcher = getMessageDispatcher(); - final String path = fileKey.getKey().getAbsolutePath(); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -60,7 +61,7 @@ public class UncommentedMainCheck extends AbstractCheck { - - /** Set of possible String array types. */ - private static final Set STRING_PARAMETER_NAMES = -- Set.of( -+ ImmutableSet.of( - String[].class.getCanonicalName(), - String.class.getCanonicalName(), - String[].class.getSimpleName(), ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.annotation; - -+import static java.util.Objects.requireNonNullElse; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -152,8 +154,7 @@ public final class MissingOverrideCheck extends AbstractCheck { - final DetailAST startNode; - if (modifiers.hasChildren()) { - startNode = -- Optional.ofNullable(ast.getFirstChild().findFirstToken(TokenTypes.ANNOTATION)) -- .orElse(modifiers); -+ requireNonNullElse(ast.getFirstChild().findFirstToken(TokenTypes.ANNOTATION), modifiers); - } else { - startNode = ast.findFirstToken(TokenTypes.TYPE); - } -@@ -164,6 +165,6 @@ public final class MissingOverrideCheck extends AbstractCheck { - .map(DetailAST::getText) - .filter(JavadocUtil::isJavadocComment) - .findFirst(); -- return javadoc.isPresent() && MATCH_INHERIT_DOC.matcher(javadoc.get()).find(); -+ return javadoc.isPresent() && MATCH_INHERIT_DOC.matcher(javadoc.orElseThrow()).find(); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java -@@ -19,13 +19,14 @@ - - package com.puppycrawl.tools.checkstyle.checks.annotation; - -+import static java.util.Objects.requireNonNullElse; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.AnnotationUtil; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; --import java.util.Objects; - import java.util.regex.Matcher; - import java.util.regex.Pattern; - -@@ -162,7 +163,7 @@ public class SuppressWarningsCheck extends AbstractCheck { - final DetailAST token = warningHolder.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); - - // case like '@SuppressWarnings(value = UNUSED)' -- final DetailAST parent = Objects.requireNonNullElse(token, warningHolder); -+ final DetailAST parent = requireNonNullElse(token, warningHolder); - DetailAST warning = parent.findFirstToken(TokenTypes.EXPR); - - // rare case with empty array ex: @SuppressWarnings({}) -@@ -242,10 +243,10 @@ public class SuppressWarningsCheck extends AbstractCheck { - final DetailAST annValuePair = - annotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); - -- final DetailAST annArrayInitParent = Objects.requireNonNullElse(annValuePair, annotation); -+ final DetailAST annArrayInitParent = requireNonNullElse(annValuePair, annotation); - final DetailAST annArrayInit = - annArrayInitParent.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT); -- return Objects.requireNonNullElse(annArrayInit, annotation); -+ return requireNonNullElse(annArrayInit, annotation); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java -@@ -370,7 +370,7 @@ public class FallThroughCheck extends AbstractCheck { - return Optional.ofNullable(getNextNonCommentAst(ast)) - .map(DetailAST::getPreviousSibling) - .map(previous -> previous.getFirstChild().getText()) -- .map(text -> reliefPattern.matcher(text).find()) -- .orElse(Boolean.FALSE); -+ .filter(text -> reliefPattern.matcher(text).find()) -+ .isPresent(); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java -@@ -207,7 +207,7 @@ public class FinalLocalVariableCheck extends AbstractCheck { - if (isAssignOperator(parentType) && isFirstChild(ast)) { - final Optional candidate = getFinalCandidate(ast); - if (candidate.isPresent()) { -- determineAssignmentConditions(ast, candidate.get()); -+ determineAssignmentConditions(ast, candidate.orElseThrow()); - currentScopeAssignedVariables.peek().add(ast); - } - removeFinalVariableCandidateFromStack(ast); -@@ -705,7 +705,7 @@ public class FinalLocalVariableCheck extends AbstractCheck { - final Optional candidate = - Optional.ofNullable(scope.get(ast.getText())); - if (candidate.isPresent()) { -- storedVariable = candidate.get().variableIdent; -+ storedVariable = candidate.orElseThrow().variableIdent; - } - if (storedVariable != null && isSameVariables(storedVariable, ast)) { - result = candidate; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import static java.util.stream.Collectors.toCollection; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -28,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - import java.util.Arrays; - import java.util.HashSet; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Checks that certain exception types do not appear in a {@code catch} statement. -@@ -74,7 +75,7 @@ public final class IllegalCatchCheck extends AbstractCheck { - "java.lang.RuntimeException", - "java.lang.Throwable", - }) -- .collect(Collectors.toCollection(HashSet::new)); -+ .collect(toCollection(HashSet::new)); - - /** - * Setter to specify exception class names to reject. ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java -@@ -19,16 +19,15 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - 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.utils.CommonUtil; --import java.util.Arrays; - import java.util.HashSet; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Checks for illegal instantiations where a factory method is preferred. -@@ -314,6 +313,6 @@ public class IllegalInstantiationCheck extends AbstractCheck { - * @since 3.0 - */ - public void setClasses(String... names) { -- classes = Arrays.stream(names).collect(Collectors.toSet()); -+ classes = ImmutableSet.copyOf(names); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import static java.util.stream.Collectors.toCollection; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -30,7 +32,6 @@ import java.util.Arrays; - import java.util.Collections; - import java.util.HashSet; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Checks that specified types are not declared to be thrown. Declaring that a method throws {@code -@@ -69,7 +70,7 @@ public final class IllegalThrowsCheck extends AbstractCheck { - new String[] { - "finalize", - }) -- .collect(Collectors.toCollection(HashSet::new)); -+ .collect(toCollection(HashSet::new)); - - /** Specify throw class names to reject. */ - private final Set illegalClassNames = -@@ -82,7 +83,7 @@ public final class IllegalThrowsCheck extends AbstractCheck { - "java.lang.RuntimeException", - "java.lang.Throwable", - }) -- .collect(Collectors.toCollection(HashSet::new)); -+ .collect(toCollection(HashSet::new)); - - /** - * Allow to ignore checking overridden methods (marked with {@code Override} or {@code ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java -@@ -19,12 +19,14 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import static java.util.Objects.requireNonNullElse; -+import static java.util.regex.Pattern.CASE_INSENSITIVE; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; --import java.util.Objects; - import java.util.regex.Pattern; - - /** -@@ -124,7 +126,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { - * @since 3.2 - */ - public void setMessage(String message) { -- this.message = Objects.requireNonNullElse(message, ""); -+ this.message = requireNonNullElse(message, ""); - } - - /** -@@ -156,7 +158,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { - private void updateRegexp() { - final int compileFlags; - if (ignoreCase) { -- compileFlags = Pattern.CASE_INSENSITIVE; -+ compileFlags = CASE_INSENSITIVE; - } else { - compileFlags = 0; - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -26,7 +28,6 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - import com.puppycrawl.tools.checkstyle.xpath.AbstractNode; - import com.puppycrawl.tools.checkstyle.xpath.RootNode; - import java.util.List; --import java.util.stream.Collectors; - import net.sf.saxon.Configuration; - import net.sf.saxon.om.Item; - import net.sf.saxon.sxpath.XPathDynamicContext; -@@ -142,7 +143,7 @@ public class MatchXpathCheck extends AbstractCheck { - final List matchingItems = xpathExpression.evaluate(xpathDynamicContext); - return matchingItems.stream() - .map(item -> (DetailAST) ((AbstractNode) item).getUnderlyingNode()) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - } catch (XPathException ex) { - throw new IllegalStateException("Evaluation of Xpath query failed: " + query, ex); - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import com.google.common.collect.Sets; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -31,7 +32,6 @@ import java.util.HashSet; - import java.util.LinkedList; - import java.util.List; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Checks that for loop control variables are not modified inside the for block. An example is: -@@ -293,9 +293,7 @@ public final class ModifiedControlVariableCheck extends AbstractCheck { - private static Set getVariablesManagedByForLoop(DetailAST ast) { - final Set initializedVariables = getForInitVariables(ast); - final Set iteratingVariables = getForIteratorVariables(ast); -- return initializedVariables.stream() -- .filter(iteratingVariables::contains) -- .collect(Collectors.toSet()); -+ return Sets.intersection(initializedVariables, iteratingVariables).immutableCopy(); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -26,7 +27,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - import java.util.ArrayDeque; --import java.util.Collections; - import java.util.Deque; - import java.util.HashSet; - import java.util.Set; -@@ -99,7 +99,7 @@ public final class ParameterAssignmentCheck extends AbstractCheck { - public void beginTree(DetailAST rootAST) { - // clear data - parameterNamesStack.clear(); -- parameterNames = Collections.emptySet(); -+ parameterNames = ImmutableSet.of(); - } - - @Override ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.coding; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -36,7 +38,6 @@ import java.util.List; - import java.util.Map; - import java.util.Optional; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Checks that a local variable is declared and/or assigned, but not used. Doesn't support typeDeclWithSameName = typeDeclWithSameName(shortNameOfClass); -@@ -480,7 +481,7 @@ public class UnusedLocalVariableCheck extends AbstractCheck { - typeDeclDesc -> { - return hasSameNameAsSuperClass(superClassName, typeDeclDesc); - }) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.checks.design; - -+import static java.util.Objects.requireNonNullElse; -+ -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -27,14 +30,11 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; - import com.puppycrawl.tools.checkstyle.utils.ScopeUtil; - import com.puppycrawl.tools.checkstyle.utils.TokenUtil; --import java.util.Arrays; --import java.util.Objects; - import java.util.Optional; - import java.util.Set; - import java.util.function.Predicate; - import java.util.regex.Matcher; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - - /** - * Checks that classes are designed for extension (subclass creation). -@@ -176,11 +176,10 @@ public class DesignForExtensionCheck extends AbstractCheck { - - /** Specify annotations which allow the check to skip the method from validation. */ - private Set ignoredAnnotations = -- Arrays.stream( -- new String[] { -- "Test", "Before", "After", "BeforeClass", "AfterClass", -- }) -- .collect(Collectors.toSet()); -+ ImmutableSet.copyOf( -+ new String[] { -+ "Test", "Before", "After", "BeforeClass", "AfterClass", -+ }); - - /** - * Specify the comment text pattern which qualifies a method as designed for extension. Supports -@@ -195,7 +194,7 @@ public class DesignForExtensionCheck extends AbstractCheck { - * @since 7.2 - */ - public void setIgnoredAnnotations(String... ignoredAnnotations) { -- this.ignoredAnnotations = Arrays.stream(ignoredAnnotations).collect(Collectors.toSet()); -+ this.ignoredAnnotations = ImmutableSet.copyOf(ignoredAnnotations); - } - - /** -@@ -396,7 +395,7 @@ public class DesignForExtensionCheck extends AbstractCheck { - */ - private static String getAnnotationName(DetailAST annotation) { - final DetailAST dotAst = annotation.findFirstToken(TokenTypes.DOT); -- final DetailAST parent = Objects.requireNonNullElse(dotAst, annotation); -+ final DetailAST parent = requireNonNullElse(dotAst, annotation); - return parent.findFirstToken(TokenTypes.IDENT).getText(); - } - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.design; - -+import static java.util.Comparator.comparingInt; -+ - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -310,7 +312,7 @@ public class FinalClassCheck extends AbstractCheck { - private Optional getNearestClassWithSameName( - String className, ToIntFunction countProvider) { - final String dotAndClassName = PACKAGE_SEPARATOR.concat(className); -- final Comparator longestMatch = Comparator.comparingInt(countProvider); -+ final Comparator longestMatch = comparingInt(countProvider); - return innerClasses.entrySet().stream() - .filter(entry -> entry.getKey().endsWith(dotAndClassName)) - .map(Map.Entry::getValue) ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java -@@ -19,11 +19,12 @@ - - package com.puppycrawl.tools.checkstyle.checks.design; - -+import static java.util.Objects.requireNonNullElse; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; --import java.util.Objects; - - /** - * Restricts throws statements to a specified count. Methods with "Override" or "java.lang.Override" -@@ -167,7 +168,7 @@ public final class ThrowsCountCheck extends AbstractCheck { - */ - private static String getAnnotationName(DetailAST annotation) { - final DetailAST dotAst = annotation.findFirstToken(TokenTypes.DOT); -- final DetailAST parent = Objects.requireNonNullElse(dotAst, annotation); -+ final DetailAST parent = requireNonNullElse(dotAst, annotation); - return parent.findFirstToken(TokenTypes.IDENT).getText(); - } - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.checks.design; - -+import static java.util.stream.Collectors.toCollection; -+ -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -33,7 +36,6 @@ import java.util.HashSet; - import java.util.List; - import java.util.Set; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - - /** - * Checks visibility of class members. Only static final, immutable or annotated by specified -@@ -152,7 +154,7 @@ public class VisibilityModifierCheck extends AbstractCheck { - - /** Default ignore annotations canonical names. */ - private static final Set DEFAULT_IGNORE_ANNOTATIONS = -- Set.of( -+ ImmutableSet.of( - "org.junit.Rule", - "org.junit.ClassRule", - "com.google.common.annotations.VisibleForTesting"); -@@ -685,7 +687,7 @@ public class VisibilityModifierCheck extends AbstractCheck { - private static Set getClassShortNames(Set canonicalClassNames) { - return canonicalClassNames.stream() - .map(CommonUtil::baseClassName) -- .collect(Collectors.toCollection(HashSet::new)); -+ .collect(toCollection(HashSet::new)); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.checks.header; - -+import static com.google.common.base.Preconditions.checkArgument; -+ -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.PropertyType; - import com.puppycrawl.tools.checkstyle.XdocsPropertyType; - import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; -@@ -35,7 +38,6 @@ import java.net.URI; - import java.nio.charset.Charset; - import java.nio.charset.UnsupportedCharsetException; - import java.util.ArrayList; --import java.util.Collections; - import java.util.List; - import java.util.Set; - import java.util.regex.Pattern; -@@ -116,10 +118,9 @@ public abstract class AbstractHeaderCheck extends AbstractFileSetCheck - * @throws IllegalArgumentException if header has already been set - */ - private void checkHeaderNotInitialized() { -- if (!readerLines.isEmpty()) { -- throw new IllegalArgumentException( -- "header has already been set - " + "set either header or headerFile, not both"); -- } -+ checkArgument( -+ readerLines.isEmpty(), -+ "header has already been set - " + "set either header or headerFile, not both"); - } - - /** -@@ -190,9 +191,9 @@ public abstract class AbstractHeaderCheck extends AbstractFileSetCheck - final Set result; - - if (headerFile == null) { -- result = Collections.emptySet(); -+ result = ImmutableSet.of(); - } else { -- result = Collections.singleton(headerFile.toString()); -+ result = ImmutableSet.of(headerFile.toString()); - } - - return result; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.header; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.FileText; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; -@@ -263,9 +265,7 @@ public class RegexpHeaderCheck extends AbstractHeaderCheck { - @Override - public void setHeader(String header) { - if (!CommonUtil.isBlank(header)) { -- if (!CommonUtil.isPatternValid(header)) { -- throw new IllegalArgumentException("Unable to parse format: " + header); -- } -+ checkArgument(CommonUtil.isPatternValid(header), "Unable to parse format: %s", header); - super.setHeader(header); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.imports; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -648,10 +650,10 @@ public class CustomImportOrderCheck extends AbstractCheck { - } else if (ruleStr.startsWith(SAME_PACKAGE_RULE_GROUP)) { - final String rule = ruleStr.substring(ruleStr.indexOf('(') + 1, ruleStr.indexOf(')')); - samePackageMatchingDepth = Integer.parseInt(rule); -- if (samePackageMatchingDepth <= 0) { -- throw new IllegalArgumentException( -- "SAME_PACKAGE rule parameter should be positive integer: " + ruleStr); -- } -+ checkArgument( -+ samePackageMatchingDepth > 0, -+ "SAME_PACKAGE rule parameter should be positive integer: %s", -+ ruleStr); - customOrderRules.add(SAME_PACKAGE_RULE_GROUP); - } else { - throw new IllegalStateException("Unexpected rule: " + ruleStr); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.imports; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; -@@ -27,7 +28,6 @@ import com.puppycrawl.tools.checkstyle.api.ExternalResourceHolder; - import com.puppycrawl.tools.checkstyle.api.FullIdent; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import java.net.URI; --import java.util.Collections; - import java.util.Set; - import java.util.regex.Pattern; - -@@ -167,8 +167,8 @@ public class ImportControlCheck extends AbstractCheck implements ExternalResourc - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void beginTree(DetailAST rootAST) { - currentImportControl = null; - processCurrentFile = path.matcher(getFilePath()).find(); -@@ -207,7 +207,7 @@ public class ImportControlCheck extends AbstractCheck implements ExternalResourc - - @Override - public Set getExternalResourceLocations() { -- return Collections.singleton(file.toString()); -+ return ImmutableSet.of(file.toString()); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.imports; - -+import static com.google.common.base.Preconditions.checkArgument; -+ - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -658,9 +660,7 @@ public class ImportOrderCheck extends AbstractCheck { - // matches any package - grp = Pattern.compile(""); - } else if (pkg.startsWith(FORWARD_SLASH)) { -- if (!pkg.endsWith(FORWARD_SLASH)) { -- throw new IllegalArgumentException("Invalid group: " + pkg); -- } -+ checkArgument(pkg.endsWith(FORWARD_SLASH), "Invalid group: %s", pkg); - pkg = pkg.substring(1, pkg.length() - 1); - grp = Pattern.compile(pkg); - } else { ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser; - import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseErrorMessage; - import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseStatus; -@@ -36,7 +38,6 @@ import java.util.HashSet; - import java.util.Locale; - import java.util.Map; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Base class for Checks that process Javadoc comments. -@@ -177,7 +178,7 @@ public abstract class AbstractJavadocCheck extends AbstractCheck { - validateDefaultJavadocTokens(); - if (javadocTokens.isEmpty()) { - javadocTokens.addAll( -- Arrays.stream(getDefaultJavadocTokens()).boxed().collect(Collectors.toList())); -+ Arrays.stream(getDefaultJavadocTokens()).boxed().collect(toImmutableList())); - } else { - final int[] acceptableJavadocTokens = getAcceptableJavadocTokens(); - Arrays.sort(acceptableJavadocTokens); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java -@@ -19,14 +19,13 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.DetailNode; - import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; --import java.util.Arrays; - import java.util.Set; - import java.util.regex.Matcher; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - - /** - * Checks that a allowedAnnotations = Set.of("Override"); -+ private Set allowedAnnotations = ImmutableSet.of("Override"); - - /** - * Setter to control whether to validate {@code throws} tags. ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java -@@ -257,8 +257,8 @@ public class JavadocStyleCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void visitToken(DetailAST ast) { - if (shouldCheck(ast)) { - final FileContents contents = getFileContents(); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java -@@ -19,6 +19,10 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import static com.google.common.base.Preconditions.checkArgument; -+import static java.util.function.Function.identity; -+import static java.util.stream.Collectors.toUnmodifiableMap; -+ - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.Scope; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; -@@ -27,8 +31,6 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - import java.util.Arrays; - import java.util.BitSet; - import java.util.Map; --import java.util.function.Function; --import java.util.stream.Collectors; - - /** - * This enum defines the various Javadoc tags and their properties. -@@ -299,11 +301,9 @@ public enum JavadocTagInfo { - static { - final JavadocTagInfo[] values = values(); - TEXT_TO_TAG = -- Arrays.stream(values) -- .collect(Collectors.toUnmodifiableMap(JavadocTagInfo::getText, Function.identity())); -+ Arrays.stream(values).collect(toUnmodifiableMap(JavadocTagInfo::getText, identity())); - NAME_TO_TAG = -- Arrays.stream(values) -- .collect(Collectors.toUnmodifiableMap(JavadocTagInfo::getName, Function.identity())); -+ Arrays.stream(values).collect(toUnmodifiableMap(JavadocTagInfo::getName, identity())); - } - - /** The tag text. * */ -@@ -376,15 +376,11 @@ public enum JavadocTagInfo { - * @throws IllegalArgumentException if the text is not a valid tag - */ - public static JavadocTagInfo fromText(final String text) { -- if (text == null) { -- throw new IllegalArgumentException("the text is null"); -- } -+ checkArgument(text != null, "the text is null"); - - final JavadocTagInfo tag = TEXT_TO_TAG.get(text); - -- if (tag == null) { -- throw new IllegalArgumentException("the text [" + text + "] is not a valid Javadoc tag text"); -- } -+ checkArgument(tag != null, "the text [%s] is not a valid Javadoc tag text", text); - - return tag; - } -@@ -399,15 +395,11 @@ public enum JavadocTagInfo { - * {@link JavadocTagInfo#isValidName(String)} - */ - public static JavadocTagInfo fromName(final String name) { -- if (name == null) { -- throw new IllegalArgumentException("the name is null"); -- } -+ checkArgument(name != null, "the name is null"); - - final JavadocTagInfo tag = NAME_TO_TAG.get(name); - -- if (tag == null) { -- throw new IllegalArgumentException("the name [" + name + "] is not a valid Javadoc tag name"); -- } -+ checkArgument(tag != null, "the name [%s] is not a valid Javadoc tag name", name); - - return tag; - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -160,7 +161,7 @@ public class JavadocTypeCheck extends AbstractCheck { - * Specify annotations that allow skipping validation at all. Only short names are allowed, e.g. - * {@code Generated}. - */ -- private Set allowedAnnotations = Set.of("Generated"); -+ private Set allowedAnnotations = ImmutableSet.of("Generated"); - - /** - * Setter to specify the visibility scope where Javadoc comments are checked. -@@ -256,8 +257,8 @@ public class JavadocTypeCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void visitToken(DetailAST ast) { - if (shouldCheck(ast)) { - final FileContents contents = getFileContents(); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java -@@ -126,8 +126,8 @@ public class JavadocVariableCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void visitToken(DetailAST ast) { - if (shouldCheck(ast)) { - final FileContents contents = getFileContents(); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -141,7 +142,7 @@ public class MissingJavadocMethodCheck extends AbstractCheck { - private Pattern ignoreMethodNamesRegex; - - /** Configure annotations that allow missed documentation. */ -- private Set allowedAnnotations = Set.of("Override"); -+ private Set allowedAnnotations = ImmutableSet.of("Override"); - - /** - * Setter to configure annotations that allow missed documentation. -@@ -225,8 +226,8 @@ public class MissingJavadocMethodCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public final void visitToken(DetailAST ast) { - final Scope theScope = ScopeUtil.getScope(ast); - if (shouldCheck(ast, theScope)) { ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocPackageCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocPackageCheck.java -@@ -110,7 +110,7 @@ public class MissingJavadocPackageCheck extends AbstractCheck { - .map(DetailAST::getFirstChild); - boolean result = false; - if (firstAnnotationChild.isPresent()) { -- for (DetailAST child = firstAnnotationChild.get(); -+ for (DetailAST child = firstAnnotationChild.orElseThrow(); - child != null; - child = child.getNextSibling()) { - if (isJavadoc(child)) { ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -87,7 +88,7 @@ public class MissingJavadocTypeCheck extends AbstractCheck { - * Specify annotations that allow missed documentation. If annotation is present in target sources - * in multiple forms of qualified name, all forms should be listed in this property. - */ -- private Set skipAnnotations = Set.of("Generated"); -+ private Set skipAnnotations = ImmutableSet.of("Generated"); - - /** - * Setter to specify the visibility scope where Javadoc comments are checked. -@@ -143,8 +144,8 @@ public class MissingJavadocTypeCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void visitToken(DetailAST ast) { - if (shouldCheck(ast)) { - final FileContents contents = getFileContents(); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SingleLineJavadocCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SingleLineJavadocCheck.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.javadoc; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.DetailNode; -@@ -69,7 +70,7 @@ public class SingleLineJavadocCheck extends AbstractJavadocCheck { - * href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#CHDBEFIF"> - * block tags which are ignored by the check. - */ -- private Set ignoredTags = Set.of(); -+ private Set ignoredTags = ImmutableSet.of(); - - /** - * Control whether extractInlineTags(String... lines) { - for (String line : lines) { -- if (line.indexOf(LINE_FEED) != -1 || line.indexOf(CARRIAGE_RETURN) != -1) { -- throw new IllegalArgumentException("comment lines cannot contain newlines"); -- } -+ checkArgument( -+ line.indexOf(LINE_FEED) == -1 && line.indexOf(CARRIAGE_RETURN) == -1, -+ "comment lines cannot contain newlines"); - } - - final String commentText = convertLinesToString(lines); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java -@@ -19,6 +19,11 @@ - - package com.puppycrawl.tools.checkstyle.checks.metrics; - -+import static com.google.common.base.Preconditions.checkArgument; -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static java.util.function.Predicate.not; -+ -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -29,7 +34,6 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - import java.util.ArrayDeque; - import java.util.ArrayList; - import java.util.Arrays; --import java.util.Collections; - import java.util.Deque; - import java.util.HashMap; - import java.util.List; -@@ -37,9 +41,7 @@ import java.util.Map; - import java.util.Optional; - import java.util.Set; - import java.util.TreeSet; --import java.util.function.Predicate; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - - /** Base class for coupling calculation. */ - @FileStatefulCheck -@@ -124,7 +126,7 @@ public abstract class AbstractClassCouplingCheck extends AbstractCheck { - "Stream"); - - /** Package names to ignore. */ -- private static final Set DEFAULT_EXCLUDED_PACKAGES = Collections.emptySet(); -+ private static final Set DEFAULT_EXCLUDED_PACKAGES = ImmutableSet.of(); - - /** Pattern to match brackets in a full type name. */ - private static final Pattern BRACKET_PATTERN = Pattern.compile("\\[[^]]*]"); -@@ -211,13 +213,11 @@ public abstract class AbstractClassCouplingCheck extends AbstractCheck { - */ - public final void setExcludedPackages(String... excludedPackages) { - final List invalidIdentifiers = -- Arrays.stream(excludedPackages) -- .filter(Predicate.not(CommonUtil::isName)) -- .collect(Collectors.toList()); -- if (!invalidIdentifiers.isEmpty()) { -- throw new IllegalArgumentException( -- "the following values are not valid identifiers: " + invalidIdentifiers); -- } -+ Arrays.stream(excludedPackages).filter(not(CommonUtil::isName)).collect(toImmutableList()); -+ checkArgument( -+ invalidIdentifiers.isEmpty(), -+ "the following values are not valid identifiers: %s", -+ invalidIdentifiers); - - this.excludedPackages = Set.of(excludedPackages); - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java -@@ -19,18 +19,17 @@ - - package com.puppycrawl.tools.checkstyle.checks.naming; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; --import java.util.Arrays; - import java.util.HashSet; - import java.util.LinkedList; - import java.util.List; - import java.util.Set; --import java.util.stream.Collectors; - - /** - * Validates abbreviations (consecutive capital letters) length in identifier name, it also allows -@@ -199,7 +198,7 @@ public class AbbreviationAsWordInNameCheck extends AbstractCheck { - */ - public void setAllowedAbbreviations(String... allowedAbbreviations) { - if (allowedAbbreviations != null) { -- this.allowedAbbreviations = Arrays.stream(allowedAbbreviations).collect(Collectors.toSet()); -+ this.allowedAbbreviations = ImmutableSet.copyOf(allowedAbbreviations); - } - } - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheck.java -@@ -22,7 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.naming; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.TokenUtil; --import java.util.Objects; - - /** - * Checks lambda parameter names. -@@ -70,7 +69,7 @@ public class LambdaParameterNameCheck extends AbstractNameCheck { - public void visitToken(DetailAST ast) { - final boolean isInSwitchRule = ast.getParent().getType() == TokenTypes.SWITCH_RULE; - -- if (Objects.nonNull(ast.findFirstToken(TokenTypes.PARAMETERS))) { -+ if (ast.findFirstToken(TokenTypes.PARAMETERS) != null) { - final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); - TokenUtil.forEachChild(parametersNode, TokenTypes.PARAMETER_DEF, super::visitToken); - } else if (!isInSwitchRule) { ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.java -@@ -152,8 +152,8 @@ public class ParameterNameCheck extends AbstractNameCheck { - - if (annotation.isPresent()) { - final Optional overrideToken = -- Optional.ofNullable(annotation.get().findFirstToken(TokenTypes.IDENT)); -- if (overrideToken.isPresent() && "Override".equals(overrideToken.get().getText())) { -+ Optional.ofNullable(annotation.orElseThrow().findFirstToken(TokenTypes.IDENT)); -+ if (overrideToken.isPresent() && "Override".equals(overrideToken.orElseThrow().getText())) { - overridden = true; - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.checks.regexp; - -+import static java.util.Objects.requireNonNullElse; -+import static java.util.regex.Pattern.CASE_INSENSITIVE; -+ - import com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter; - import java.util.Optional; - import java.util.regex.Pattern; -@@ -242,8 +245,8 @@ public final class DetectorOptions { - * @return DetectorOptions instance. - */ - public DetectorOptions build() { -- message = Optional.ofNullable(message).orElse(""); -- suppressor = Optional.ofNullable(suppressor).orElse(NeverSuppress.INSTANCE); -+ message = requireNonNullElse(message, ""); -+ suppressor = requireNonNullElse(suppressor, NeverSuppress.INSTANCE); - pattern = Optional.ofNullable(format).map(this::createPattern).orElse(null); - return DetectorOptions.this; - } -@@ -257,7 +260,7 @@ public final class DetectorOptions { - private Pattern createPattern(String formatValue) { - int options = compileFlags; - if (ignoreCase) { -- options |= Pattern.CASE_INSENSITIVE; -+ options |= CASE_INSENSITIVE; - } - return Pattern.compile(formatValue, options); - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/MultilineDetector.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/MultilineDetector.java -@@ -19,6 +19,7 @@ - - package com.puppycrawl.tools.checkstyle.checks.regexp; - -+import com.google.common.base.Strings; - import com.puppycrawl.tools.checkstyle.api.FileText; - import com.puppycrawl.tools.checkstyle.api.LineColumn; - import java.util.regex.Matcher; -@@ -69,7 +70,7 @@ class MultilineDetector { - resetState(); - - final String format = options.getFormat(); -- if (format == null || format.isEmpty()) { -+ if (Strings.isNullOrEmpty(format)) { - options.getReporter().log(1, MSG_EMPTY); - } else { - matcher = options.getPattern().matcher(fileText.getFullText()); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.checks.regexp; - -+import static java.util.regex.Pattern.MULTILINE; -+ -+import com.google.common.base.Strings; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -151,7 +154,7 @@ public class RegexpCheck extends AbstractCheck { - private int errorCount; - - /** Specify the pattern to match against. */ -- private Pattern format = Pattern.compile("^$", Pattern.MULTILINE); -+ private Pattern format = Pattern.compile("^$", MULTILINE); - - /** The matcher. */ - private Matcher matcher; -@@ -218,7 +221,7 @@ public class RegexpCheck extends AbstractCheck { - * @since 4.0 - */ - public final void setFormat(Pattern pattern) { -- format = CommonUtil.createPattern(pattern.pattern(), Pattern.MULTILINE); -+ format = CommonUtil.createPattern(pattern.pattern(), MULTILINE); - } - - @Override -@@ -237,8 +240,8 @@ public class RegexpCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void beginTree(DetailAST rootAST) { - matcher = format.matcher(getFileContents().getText().getFullText()); - matchCount = 0; -@@ -320,7 +323,7 @@ public class RegexpCheck extends AbstractCheck { - private void logMessage(int lineNumber) { - String msg; - -- if (message == null || message.isEmpty()) { -+ if (Strings.isNullOrEmpty(message)) { - msg = format.pattern(); - } else { - msg = message; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheck.java -@@ -19,13 +19,15 @@ - - package com.puppycrawl.tools.checkstyle.checks.regexp; - -+import static java.util.regex.Pattern.DOTALL; -+import static java.util.regex.Pattern.MULTILINE; -+ - import com.puppycrawl.tools.checkstyle.PropertyType; - import com.puppycrawl.tools.checkstyle.StatelessCheck; - import com.puppycrawl.tools.checkstyle.XdocsPropertyType; - import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; - import com.puppycrawl.tools.checkstyle.api.FileText; - import java.io.File; --import java.util.regex.Pattern; - - /** - * Checks that a specified pattern matches across multiple lines in any file type. -@@ -121,9 +123,9 @@ public class RegexpMultilineCheck extends AbstractFileSetCheck { - final int result; - - if (matchAcrossLines) { -- result = Pattern.DOTALL; -+ result = DOTALL; - } else { -- result = Pattern.MULTILINE; -+ result = MULTILINE; - } - - return result; ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java -@@ -102,8 +102,8 @@ public class RegexpSinglelineJavaCheck extends AbstractCheck { - } - - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 -- @SuppressWarnings("deprecation") - @Override -+ @SuppressWarnings("deprecation") - public void beginTree(DetailAST rootAST) { - MatchSuppressor suppressor = null; - if (ignoreComments) { ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.java -@@ -254,7 +254,7 @@ public class EmptyLineSeparatorCheck extends AbstractCheck { - private void checkCommentInModifiers(DetailAST packageDef) { - final Optional comment = findCommentUnder(packageDef); - if (comment.isPresent()) { -- log(comment.get(), MSG_SHOULD_BE_SEPARATED, comment.get().getText()); -+ log(comment.orElseThrow(), MSG_SHOULD_BE_SEPARATED, comment.orElseThrow().getText()); - } - } - -@@ -302,7 +302,7 @@ public class EmptyLineSeparatorCheck extends AbstractCheck { - // The first child is DOT in case of POSTFIX which have at least 2 children - // First child of DOT again puts us back to normal AST tree which will - // recurse down below from here -- final DetailAST firstChildAfterPostFix = postFixNode.get(); -+ final DetailAST firstChildAfterPostFix = postFixNode.orElseThrow(); - result = getLastElementBeforeEmptyLines(firstChildAfterPostFix, line); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.java -@@ -383,7 +383,7 @@ public class NoWhitespaceAfterCheck extends AbstractCheck { - typeLastNode = - parent.findFirstToken(TokenTypes.TYPE_ARGUMENTS).findFirstToken(TokenTypes.GENERIC_END); - } else if (objectArrayType.isPresent()) { -- typeLastNode = objectArrayType.get(); -+ typeLastNode = objectArrayType.orElseThrow(); - } else { - typeLastNode = parent.getFirstChild(); - } -@@ -449,7 +449,7 @@ public class NoWhitespaceAfterCheck extends AbstractCheck { - } - // qualified name case - else { -- result = dot.get().getFirstChild().getNextSibling(); -+ result = dot.orElseThrow().getFirstChild().getNextSibling(); - } - return result; - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java -@@ -377,7 +377,7 @@ public class SuppressWithPlainTextCommentFilter extends AbstractAutomaticBean im - final Suppression suppression = (Suppression) other; - return Objects.equals(lineNo, suppression.lineNo) - && Objects.equals(columnNo, suppression.columnNo) -- && Objects.equals(suppressionType, suppression.suppressionType) -+ && suppressionType == suppression.suppressionType - && Objects.equals(text, suppression.text) - && Objects.equals(eventSourceRegexp, suppression.eventSourceRegexp) - && Objects.equals(eventMessageRegexp, suppression.eventMessageRegexp) ---- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java -@@ -483,7 +483,7 @@ public class SuppressionCommentFilter extends AbstractAutomaticBean implements T - final Tag tag = (Tag) other; - return Objects.equals(line, tag.line) - && Objects.equals(column, tag.column) -- && Objects.equals(tagType, tag.tagType) -+ && tagType == tag.tagType - && Objects.equals(text, tag.text) - && Objects.equals(tagCheckRegexp, tag.tagCheckRegexp) - && Objects.equals(tagMessageRegexp, tag.tagMessageRegexp) ---- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java -@@ -19,13 +19,13 @@ - - package com.puppycrawl.tools.checkstyle.filters; - -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean; - import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; - import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; - import com.puppycrawl.tools.checkstyle.api.ExternalResourceHolder; - import com.puppycrawl.tools.checkstyle.utils.FilterUtil; --import java.util.Collections; - import java.util.HashSet; - import java.util.Objects; - import java.util.Set; -@@ -186,7 +186,7 @@ public class SuppressionXpathFilter extends AbstractAutomaticBean - - @Override - public Set getExternalResourceLocations() { -- return Collections.singleton(file); -+ return ImmutableSet.of(file); - } - - @Override ---- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.filters; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; - import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; -@@ -28,7 +30,6 @@ import java.util.List; - import java.util.Objects; - import java.util.Optional; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import net.sf.saxon.Configuration; - import net.sf.saxon.om.Item; - import net.sf.saxon.sxpath.XPathDynamicContext; -@@ -190,7 +191,7 @@ public class XpathFilterElement implements TreeWalkerFilter { - } else { - isMatching = false; - final List nodes = -- getItems(event).stream().map(AbstractNode.class::cast).collect(Collectors.toList()); -+ getItems(event).stream().map(AbstractNode.class::cast).collect(toImmutableList()); - for (AbstractNode abstractNode : nodes) { - isMatching = - abstractNode.getTokenType() == event.getTokenType() ---- a/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java -@@ -19,6 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.gui; - -+import static java.util.stream.Collectors.joining; -+import static java.util.stream.Collectors.toCollection; -+ - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.utils.XpathUtil; - import com.puppycrawl.tools.checkstyle.xpath.ElementNode; -@@ -36,7 +39,6 @@ import java.util.Collection; - import java.util.Deque; - import java.util.EventObject; - import java.util.List; --import java.util.stream.Collectors; - import javax.swing.AbstractAction; - import javax.swing.Action; - import javax.swing.JTable; -@@ -203,7 +205,7 @@ public final class TreeTable extends JTable { - XpathUtil.getXpathItems(xpath, new RootNode(rootAST)).stream() - .map(ElementNode.class::cast) - .map(ElementNode::getUnderlyingNode) -- .collect(Collectors.toCollection(ArrayDeque::new)); -+ .collect(toCollection(ArrayDeque::new)); - updateTreeTable(xpath, nodes); - } catch (XPathException exception) { - xpathEditor.setText(xpathEditor.getText() + NEWLINE + exception.getMessage()); -@@ -254,7 +256,7 @@ public final class TreeTable extends JTable { - private static String getAllMatchingXpathQueriesText(Deque nodes) { - return nodes.stream() - .map(XpathQueryGenerator::generateXpathQuery) -- .collect(Collectors.joining(NEWLINE, "", NEWLINE)); -+ .collect(joining(NEWLINE, "", NEWLINE)); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java -@@ -19,6 +19,10 @@ - - package com.puppycrawl.tools.checkstyle.meta; - -+import static java.util.Collections.unmodifiableMap; -+import static java.util.stream.Collectors.joining; -+ -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.DetailNode; -@@ -28,7 +32,6 @@ import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; - import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - import java.util.ArrayDeque; - import java.util.Arrays; --import java.util.Collections; - import java.util.Deque; - import java.util.HashMap; - import java.util.HashSet; -@@ -39,7 +42,6 @@ import java.util.Optional; - import java.util.Set; - import java.util.regex.Matcher; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import javax.xml.parsers.ParserConfigurationException; - import javax.xml.transform.TransformerException; - -@@ -98,7 +100,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - * files. - */ - private static final Set PROPERTIES_TO_NOT_WRITE = -- Set.of( -+ ImmutableSet.of( - "null", - "the charset property of the parent Checker module"); -@@ -271,7 +273,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - final Optional propertyNameNode = - getFirstChildOfType(nodeLi, JavadocTokenTypes.JAVADOC_INLINE_TAG, 0); - if (propertyNameNode.isPresent()) { -- final DetailNode propertyNameTag = propertyNameNode.get(); -+ final DetailNode propertyNameTag = propertyNameNode.orElseThrow(); - final String propertyName = getTextFromTag(propertyNameTag); - - final DetailNode propertyType = -@@ -295,7 +297,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - final Optional validationTypeNodeOpt = - getFirstChildOfMatchingText(nodeLi, VALIDATION_TYPE_TAG); - if (validationTypeNodeOpt.isPresent()) { -- final DetailNode validationTypeNode = validationTypeNodeOpt.get(); -+ final DetailNode validationTypeNode = validationTypeNodeOpt.orElseThrow(); - modulePropertyDetails.setValidationType(getTagTextFromProperty(nodeLi, validationTypeNode)); - } - -@@ -327,7 +329,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - nodeLi, JavadocTokenTypes.JAVADOC_INLINE_TAG, propertyMeta.getIndex() + 1); - DetailNode tagNode = null; - if (tagNodeOpt.isPresent()) { -- tagNode = tagNodeOpt.get(); -+ tagNode = tagNodeOpt.orElseThrow(); - } - return getTextFromTag(tagNode); - } -@@ -420,7 +422,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - nodeLi, JavadocTokenTypes.JAVADOC_INLINE_TAG, defaultValueNode.getIndex() + 1); - final String result; - if (propertyDefaultValueTag.isPresent()) { -- result = getTextFromTag(propertyDefaultValueTag.get()); -+ result = getTextFromTag(propertyDefaultValueTag.orElseThrow()); - } else { - final String tokenText = - constructSubTreeText(nodeLi, defaultValueNode.getIndex(), nodeLi.getChildren().length); -@@ -477,7 +479,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - return Arrays.stream(parentNode.getChildren()) - .filter(child -> child.getType() == JavadocTokenTypes.TEXT) - .map(node -> QUOTE_PATTERN.matcher(node.getText().trim()).replaceAll("")) -- .collect(Collectors.joining(" ")); -+ .collect(joining(" ")); - } - - /** -@@ -594,7 +596,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - * @return map containing module details of supplied checks. - */ - public static Map getModuleDetailsStore() { -- return Collections.unmodifiableMap(MODULE_DETAILS_STORE); -+ return unmodifiableMap(MODULE_DETAILS_STORE); - } - - /** Reset the module detail store of any previous information. */ -@@ -617,7 +619,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - return parent.getType() == TokenTypes.CLASS_DEF - && child.getType() == TokenTypes.IDENT; - }); -- return className.isPresent() && getModuleSimpleName().equals(className.get().getText()); -+ return className.isPresent() && getModuleSimpleName().equals(className.orElseThrow().getText()); - } - - /** -@@ -673,7 +675,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { - return getFirstChildOfType(ast, JavadocTokenTypes.TEXT, 0) - .map(DetailNode::getText) - .map(pattern::matcher) -- .map(Matcher::matches) -- .orElse(Boolean.FALSE); -+ .filter(Matcher::matches) -+ .isPresent(); - } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.meta; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; - import com.puppycrawl.tools.checkstyle.Checker; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -@@ -34,7 +36,6 @@ import java.nio.file.Path; - import java.nio.file.Paths; - import java.util.ArrayList; - import java.util.List; --import java.util.stream.Collectors; - import java.util.stream.Stream; - - /** Class which handles all the metadata generation and writing calls. */ -@@ -98,7 +99,7 @@ public final class MetadataGeneratorUtil { - || fileName.endsWith("Check.java") - || fileName.endsWith("Filter.java"); - }) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); - } - } - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/meta/ModuleDetails.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/meta/ModuleDetails.java -@@ -19,8 +19,9 @@ - - package com.puppycrawl.tools.checkstyle.meta; - -+import static java.util.Collections.unmodifiableList; -+ - import java.util.ArrayList; --import java.util.Collections; - import java.util.List; - - /** Simple POJO class for module details. */ -@@ -125,7 +126,7 @@ public final class ModuleDetails { - * @return property list of module - */ - public List getProperties() { -- return Collections.unmodifiableList(properties); -+ return unmodifiableList(properties); - } - - /** -@@ -152,7 +153,7 @@ public final class ModuleDetails { - * @return violation message keys of module - */ - public List getViolationMessageKeys() { -- return Collections.unmodifiableList(violationMessageKeys); -+ return unmodifiableList(violationMessageKeys); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/site/ClassAndPropertiesSettersJavadocScraper.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/ClassAndPropertiesSettersJavadocScraper.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.site; - -+import static java.util.Collections.unmodifiableMap; -+ - import com.puppycrawl.tools.checkstyle.FileStatefulCheck; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.DetailNode; -@@ -27,7 +29,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; - import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; - import java.beans.Introspector; --import java.util.Collections; - import java.util.LinkedHashMap; - import java.util.Map; - import java.util.regex.Pattern; -@@ -65,7 +66,7 @@ public class ClassAndPropertiesSettersJavadocScraper extends AbstractJavadocChec - * @return the javadocs. - */ - public static Map getJavadocsForModuleOrProperty() { -- return Collections.unmodifiableMap(JAVADOC_FOR_MODULE_OR_PROPERTY); -+ return unmodifiableMap(JAVADOC_FOR_MODULE_OR_PROPERTY); - } - - @Override ---- a/src/main/java/com/puppycrawl/tools/checkstyle/site/ExampleMacro.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/ExampleMacro.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.site; - -+import static java.util.stream.Collectors.joining; -+ - import java.io.IOException; - import java.nio.file.Files; - import java.nio.file.Path; -@@ -26,7 +28,6 @@ import java.util.ArrayList; - import java.util.Collection; - import java.util.List; - import java.util.Locale; --import java.util.stream.Collectors; - import org.apache.maven.doxia.macro.AbstractMacro; - import org.apache.maven.doxia.macro.Macro; - import org.apache.maven.doxia.macro.MacroExecutionException; -@@ -121,7 +122,7 @@ public class ExampleMacro extends AbstractMacro { - .dropWhile(line -> !XML_CONFIG_START.equals(line)) - .skip(1) - .takeWhile(line -> !XML_CONFIG_END.equals(line)) -- .collect(Collectors.joining(NEWLINE)); -+ .collect(joining(NEWLINE)); - } - - /** -@@ -136,7 +137,7 @@ public class ExampleMacro extends AbstractMacro { - .dropWhile(line -> !line.contains(CODE_SNIPPET_START)) - .skip(1) - .takeWhile(line -> !line.contains(CODE_SNIPPET_END)) -- .collect(Collectors.joining(NEWLINE)); -+ .collect(joining(NEWLINE)); - } - - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.site; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.api.AbstractCheck; - import com.puppycrawl.tools.checkstyle.api.DetailNode; - import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; -@@ -32,7 +34,6 @@ import java.util.List; - import java.util.Locale; - import java.util.Map; - import java.util.Set; --import java.util.stream.Collectors; - import org.apache.maven.doxia.macro.AbstractMacro; - import org.apache.maven.doxia.macro.Macro; - import org.apache.maven.doxia.macro.MacroExecutionException; -@@ -251,7 +252,7 @@ public class PropertiesMacro extends AbstractMacro { - final List configurableTokens = - SiteUtil.getDifference(check.getAcceptableTokens(), check.getRequiredTokens()).stream() - .map(TokenUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - sink.text("subset of tokens"); - writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_TOKEN_TYPES); - } -@@ -262,7 +263,7 @@ public class PropertiesMacro extends AbstractMacro { - check.getAcceptableJavadocTokens(), check.getRequiredJavadocTokens()) - .stream() - .map(JavadocUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - sink.text("subset of javadoc tokens"); - writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_JAVADOC_TOKEN_TYPES); - } else { -@@ -342,7 +343,7 @@ public class PropertiesMacro extends AbstractMacro { - final List configurableTokens = - SiteUtil.getDifference(check.getDefaultTokens(), check.getRequiredTokens()).stream() - .map(TokenUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_TOKEN_TYPES); - } - } else if (SiteUtil.JAVADOC_TOKENS.equals(propertyName)) { -@@ -351,7 +352,7 @@ public class PropertiesMacro extends AbstractMacro { - SiteUtil.getDifference(check.getDefaultJavadocTokens(), check.getRequiredJavadocTokens()) - .stream() - .map(JavadocUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); - writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_JAVADOC_TOKEN_TYPES); - } else { - final String defaultValue = ---- a/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java -@@ -19,6 +19,14 @@ - - package com.puppycrawl.tools.checkstyle.site; - -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; -+import static java.util.stream.Collectors.joining; -+import static java.util.stream.Collectors.toSet; -+ -+import com.google.common.base.Strings; -+import com.google.common.collect.ImmutableList; -+import com.google.common.collect.ImmutableSet; - import com.google.common.collect.Lists; - import com.puppycrawl.tools.checkstyle.Checker; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -@@ -72,7 +80,6 @@ import java.util.Optional; - import java.util.Set; - import java.util.TreeSet; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import java.util.stream.IntStream; - import java.util.stream.Stream; - import org.apache.commons.beanutils.PropertyUtils; -@@ -146,7 +153,7 @@ public final class SiteUtil { - - /** Set of properties that are undocumented. Those are internal properties. */ - private static final Set UNDOCUMENTED_PROPERTIES = -- Set.of( -+ ImmutableSet.of( - "SuppressWithNearbyCommentFilter.fileContents", "SuppressionCommentFilter.fileContents"); - - /** Properties that can not be gathered from class instance. */ -@@ -179,7 +186,7 @@ public final class SiteUtil { - - /** List of files who are superclasses and contain certain properties that checks inherit. */ - private static final List MODULE_SUPER_CLASS_FILES = -- List.of( -+ ImmutableList.of( - new File( - Paths.get(MAIN_FOLDER_PATH, CHECKS, NAMING, "AbstractAccessControlNameCheck.java") - .toString()), -@@ -359,7 +366,7 @@ public final class SiteUtil { - (path, attr) -> { - return attr.isRegularFile() && path.toString().endsWith(".xml.template"); - })) { -- return stream.collect(Collectors.toSet()); -+ return stream.collect(toImmutableSet()); - } catch (IOException ioException) { - throw new MacroExecutionException("Failed to find xdocs templates", ioException); - } -@@ -386,7 +393,7 @@ public final class SiteUtil { - } - - // If parent class is not found, check interfaces -- if (parentModuleName == null || parentModuleName.isEmpty()) { -+ if (Strings.isNullOrEmpty(parentModuleName)) { - final Class[] interfaces = moduleClass.getInterfaces(); - for (Class interfaceClass : interfaces) { - parentModuleName = CLASS_TO_PARENT_MODULE.get(interfaceClass); -@@ -396,7 +403,7 @@ public final class SiteUtil { - } - } - -- if (parentModuleName == null || parentModuleName.isEmpty()) { -+ if (Strings.isNullOrEmpty(parentModuleName)) { - final String message = - String.format( - Locale.ROOT, "Failed to find parent module for %s", moduleClass.getSimpleName()); -@@ -424,7 +431,7 @@ public final class SiteUtil { - prop -> { - return !isGlobalProperty(clss, prop) && !isUndocumentedProperty(clss, prop); - }) -- .collect(Collectors.toSet()); -+ .collect(toSet()); - properties.addAll(getNonExplicitProperties(instance, clss)); - return new TreeSet<>(properties); - } -@@ -543,7 +550,7 @@ public final class SiteUtil { - treeWalkerConfig.addChild(scraperCheckConfig); - try { - checker.configure(defaultConfiguration); -- final List filesToProcess = List.of(moduleFile); -+ final List filesToProcess = ImmutableList.of(moduleFile); - checker.process(filesToProcess); - checker.destroy(); - } catch (CheckstyleException checkstyleException) { -@@ -855,9 +862,7 @@ public final class SiteUtil { - if (value != null && Array.getLength(value) > 0) { - result = - removeSquareBrackets( -- Arrays.stream((Pattern[]) value) -- .map(Pattern::pattern) -- .collect(Collectors.joining(COMMA_SPACE))); -+ Arrays.stream((Pattern[]) value).map(Pattern::pattern).collect(joining(COMMA_SPACE))); - } - - if (result.isEmpty()) { -@@ -889,8 +894,7 @@ public final class SiteUtil { - result = ""; - } else { - try (Stream valuesStream = getValuesStream(value)) { -- result = -- valuesStream.map(String.class::cast).sorted().collect(Collectors.joining(COMMA_SPACE)); -+ result = valuesStream.map(String.class::cast).sorted().collect(joining(COMMA_SPACE)); - } - } - -@@ -931,10 +935,7 @@ public final class SiteUtil { - private static String getIntArrayPropertyValue(Object value) { - try (IntStream stream = getIntStream(value)) { - String result = -- stream -- .mapToObj(TokenUtil::getTokenName) -- .sorted() -- .collect(Collectors.joining(COMMA_SPACE)); -+ stream.mapToObj(TokenUtil::getTokenName).sorted().collect(joining(COMMA_SPACE)); - if (result.isEmpty()) { - result = CURLY_BRACKETS; - } -@@ -1024,11 +1025,11 @@ public final class SiteUtil { - */ - public static List getDifference(int[] tokens, int... subtractions) { - final Set subtractionsSet = -- Arrays.stream(subtractions).boxed().collect(Collectors.toSet()); -+ Arrays.stream(subtractions).boxed().collect(toImmutableSet()); - return Arrays.stream(tokens) - .boxed() - .filter(token -> !subtractionsSet.contains(token)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" + + "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='m']]/SLIST/LITERAL_TRY" +@@ -63,7 +63,7 @@ public class XpathRegressionUnnecessarySemicolonInTryWithResourcesTest } - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java -@@ -19,6 +19,7 @@ + @Test +- public void testAllowWhenNoBraceAfterSemicolon() throws Exception { ++ void allowWhenNoBraceAfterSemicolon() throws Exception { + final File fileToProcess = + new File( + getPath( +@@ -81,7 +81,7 @@ public class XpathRegressionUnnecessarySemicolonInTryWithResourcesTest + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" + + "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java +@@ -19,14 +19,14 @@ - package com.puppycrawl.tools.checkstyle.site; + package org.checkstyle.suppressionxpathfilter; -+import com.google.common.base.Strings; ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck; import java.io.File; - import java.io.IOException; - import java.io.Reader; -@@ -119,7 +120,7 @@ public class XdocsTemplateParser extends XdocParser { - private void processMacroStart(XmlPullParser parser) throws MacroExecutionException { - macroName = parser.getAttributeValue(null, Attribute.NAME.toString()); - -- if (macroName == null || macroName.isEmpty()) { -+ if (Strings.isNullOrEmpty(macroName)) { - final String message = - String.format( - Locale.ROOT, -@@ -138,7 +139,7 @@ public class XdocsTemplateParser extends XdocParser { - * @throws MacroExecutionException if the parameter name or value is not specified. - */ - private void processParamStart(XmlPullParser parser, Sink sink) throws MacroExecutionException { -- if (macroName != null && !macroName.isEmpty()) { -+ if (!Strings.isNullOrEmpty(macroName)) { - final String paramName = parser.getAttributeValue(null, Attribute.NAME.toString()); - final String paramValue = parser.getAttributeValue(null, Attribute.VALUE.toString()); - ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java -@@ -19,6 +19,9 @@ +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; - package com.puppycrawl.tools.checkstyle.utils; +-public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { ++final class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { -+import static com.google.common.base.Preconditions.checkArgument; -+ -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.FullIdent; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; -@@ -38,7 +41,7 @@ public final class AnnotationUtil { - private static final String FQ_OVERRIDE = "java.lang." + OVERRIDE; + private final String checkName = UnusedImportsCheck.class.getSimpleName(); - /** Simple and fully-qualified {@link Override Override} annotation names. */ -- private static final Set OVERRIDE_ANNOTATIONS = Set.of(OVERRIDE, FQ_OVERRIDE); -+ private static final Set OVERRIDE_ANNOTATIONS = ImmutableSet.of(OVERRIDE, FQ_OVERRIDE); +@@ -36,7 +36,7 @@ public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { + } - /** - * Private utility constructor. -@@ -92,9 +95,7 @@ public final class AnnotationUtil { - * @throws IllegalArgumentException when ast or annotations are null - */ - public static boolean containsAnnotation(DetailAST ast, Set annotations) { -- if (annotations == null) { -- throw new IllegalArgumentException("annotations cannot be null"); -- } -+ checkArgument(annotations != null, "annotations cannot be null"); - boolean result = false; - if (!annotations.isEmpty()) { - final DetailAST firstMatchingAnnotation = -@@ -150,9 +151,7 @@ public final class AnnotationUtil { - * @throws IllegalArgumentException when ast is null - */ - public static DetailAST getAnnotationHolder(DetailAST ast) { -- if (ast == null) { -- throw new IllegalArgumentException(THE_AST_IS_NULL); -- } -+ checkArgument(ast != null, THE_AST_IS_NULL); + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionUnusedImportsOne.java")); - final DetailAST annotationHolder; + final DefaultConfiguration moduleConfig = createModuleConfig(UnusedImportsCheck.class); +@@ -47,14 +47,14 @@ public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { + }; -@@ -182,17 +181,11 @@ public final class AnnotationUtil { - * @throws IllegalArgumentException when ast or annotations are null; when annotation is blank - */ - public static DetailAST getAnnotation(final DetailAST ast, String annotation) { -- if (ast == null) { -- throw new IllegalArgumentException(THE_AST_IS_NULL); -- } -+ checkArgument(ast != null, THE_AST_IS_NULL); - -- if (annotation == null) { -- throw new IllegalArgumentException("the annotation is null"); -- } -+ checkArgument(annotation != null, "the annotation is null"); - -- if (CommonUtil.isBlank(annotation)) { -- throw new IllegalArgumentException("the annotation is empty or spaces"); -- } -+ checkArgument(!CommonUtil.isBlank(annotation), "the annotation is empty or spaces"); - - return findFirstAnnotation( - ast, ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java -@@ -19,6 +19,11 @@ + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/IMPORT/DOT[./IDENT[@text='List']]/DOT/IDENT[@text='java']"); - package com.puppycrawl.tools.checkstyle.utils; + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } -+import static com.google.common.base.Preconditions.checkArgument; -+import static java.util.function.Predicate.not; -+import static java.util.stream.Collectors.joining; -+import static java.util.stream.Collectors.toUnmodifiableSet; -+ - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.FullIdent; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; -@@ -29,9 +34,7 @@ import java.util.Arrays; - import java.util.Collection; - import java.util.List; - import java.util.Set; --import java.util.function.Predicate; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import java.util.stream.Stream; + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionUnusedImportsTwo.java")); - /** Contains utility methods for the checks. */ -@@ -315,9 +318,7 @@ public final class CheckUtil { - */ - private static AccessModifierOption getAccessModifierFromModifiersTokenDirectly( - DetailAST modifiersToken) { -- if (modifiersToken == null) { -- throw new IllegalArgumentException("expected non-null AST-token with type 'MODIFIERS'"); -- } -+ checkArgument(modifiersToken != null, "expected non-null AST-token with type 'MODIFIERS'"); - - AccessModifierOption accessModifier = AccessModifierOption.PACKAGE; - for (DetailAST token = modifiersToken.getFirstChild(); -@@ -369,8 +370,8 @@ public final class CheckUtil { - public static Set parseClassNames(String... classNames) { - return Arrays.stream(classNames) - .flatMap(className -> Stream.of(className, CommonUtil.baseClassName(className))) -- .filter(Predicate.not(String::isEmpty)) -- .collect(Collectors.toUnmodifiableSet()); -+ .filter(not(String::isEmpty)) -+ .collect(toUnmodifiableSet()); - } + final DefaultConfiguration moduleConfig = createModuleConfig(UnusedImportsCheck.class); +@@ -66,7 +66,7 @@ public class XpathRegressionUnusedImportsTest extends AbstractXpathTestSupport { + }; - /** -@@ -391,7 +392,7 @@ public final class CheckUtil { + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/STATIC_IMPORT/DOT" + + "[./IDENT[@text='Entry']]/DOT[./IDENT[@text='Map']]" + + "/DOT/IDENT[@text='java']"); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java +@@ -26,7 +26,7 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; - return lines.stream() - .map(line -> stripIndentAndTrailingWhitespaceFromLine(line, indent)) -- .collect(Collectors.joining(System.lineSeparator(), suffix, suffix)); -+ .collect(joining(System.lineSeparator(), suffix, suffix)); - } +-public class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSupport { ++final class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSupport { + private final String checkName = UnusedLocalVariableCheck.class.getSimpleName(); - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java -@@ -32,7 +32,6 @@ import java.net.URL; - import java.nio.file.Path; - import java.nio.file.Paths; - import java.util.BitSet; --import java.util.Objects; - import java.util.regex.Matcher; - import java.util.regex.Pattern; - import java.util.regex.PatternSyntaxException; -@@ -506,7 +505,7 @@ public final class CommonUtil { - * @return true if the arg is blank. - */ - public static boolean isBlank(String value) { -- return Objects.isNull(value) || indexOfNonWhitespace(value) >= value.length(); -+ return value == null || indexOfNonWhitespace(value) >= value.length(); + @Override +@@ -35,7 +35,7 @@ public class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSup } - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtil.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.utils; + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionUnusedLocalVariableOne.java")); -+import static com.google.common.base.Preconditions.checkArgument; -+ - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.DetailNode; - import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; -@@ -262,9 +264,7 @@ public final class JavadocUtil { - */ - public static String getTokenName(int id) { - final String name = TOKEN_VALUE_TO_NAME.get(id); -- if (name == null) { -- throw new IllegalArgumentException(UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE + id); -- } -+ checkArgument(name != null, "%s%s", UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE, id); - return name; +@@ -71,7 +71,7 @@ public class XpathRegressionUnusedLocalVariableTest extends AbstractXpathTestSup } -@@ -277,9 +277,7 @@ public final class JavadocUtil { - */ - public static int getTokenId(String name) { - final Integer id = TOKEN_NAME_TO_VALUE.get(name); -- if (id == null) { -- throw new IllegalArgumentException("Unknown javadoc token name. Given name " + name); -- } -+ checkArgument(id != null, "Unknown javadoc token name. Given name %s", name); - return id; - } + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionUnusedLocalVariableTwo.java")); ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/ModuleReflectionUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/ModuleReflectionUtil.java -@@ -19,6 +19,8 @@ +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java +@@ -26,7 +26,7 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; - package com.puppycrawl.tools.checkstyle.utils; +-public class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { ++final class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { -+import static com.google.common.collect.ImmutableSet.toImmutableSet; -+ - import com.google.common.reflect.ClassPath; - import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean; - import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; -@@ -33,7 +35,6 @@ import java.lang.reflect.Constructor; - import java.lang.reflect.Modifier; - import java.util.Collection; - import java.util.Set; --import java.util.stream.Collectors; + private final String checkName = UpperEllCheck.class.getSimpleName(); - /** Contains utility methods for module reflection. */ - public final class ModuleReflectionUtil { -@@ -57,7 +58,7 @@ public final class ModuleReflectionUtil { - .flatMap(pkg -> classPath.getTopLevelClasses(pkg).stream()) - .map(ClassPath.ClassInfo::load) - .filter(ModuleReflectionUtil::isCheckstyleModule) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +@@ -36,7 +36,7 @@ public class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { } - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtil.java -@@ -19,6 +19,8 @@ - - package com.puppycrawl.tools.checkstyle.utils; + @Test +- public void testUpperEllOne() throws Exception { ++ void upperEllOne() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionUpperEllFirst.java")); -+import static java.util.Objects.requireNonNullElseGet; -+ - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.Scope; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; -@@ -80,8 +82,8 @@ public final class ScopeUtil { - * @see #getDefaultScope(DetailAST) - */ - public static Scope getScopeFromMods(DetailAST aMods) { -- return Optional.ofNullable(getDeclaredScopeFromMods(aMods)) -- .orElseGet(() -> getDefaultScope(aMods.getParent())); -+ return requireNonNullElseGet( -+ getDeclaredScopeFromMods(aMods), () -> getDefaultScope(aMods.getParent())); + final DefaultConfiguration moduleConfig = createModuleConfig(UpperEllCheck.class); +@@ -59,7 +59,7 @@ public class XpathRegressionUpperEllTest extends AbstractXpathTestSupport { } - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java -@@ -19,6 +19,11 @@ + @Test +- public void testUpperEllTwo() throws Exception { ++ void upperEllTwo() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionUpperEllSecond.java")); - package com.puppycrawl.tools.checkstyle.utils; + final DefaultConfiguration moduleConfig = createModuleConfig(UpperEllCheck.class); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java +@@ -26,7 +26,7 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; -+import static com.google.common.base.Preconditions.checkArgument; -+import static com.google.common.collect.ImmutableMap.toImmutableMap; -+import static java.util.function.Predicate.not; -+import static java.util.stream.Collectors.toUnmodifiableMap; -+ - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import java.lang.reflect.Field; -@@ -31,7 +36,6 @@ import java.util.Optional; - import java.util.ResourceBundle; - import java.util.function.Consumer; - import java.util.function.Predicate; --import java.util.stream.Collectors; - import java.util.stream.IntStream; +-public class XpathRegressionVariableDeclarationUsageDistanceTest extends AbstractXpathTestSupport { ++final class XpathRegressionVariableDeclarationUsageDistanceTest extends AbstractXpathTestSupport { + private final String checkName = VariableDeclarationUsageDistanceCheck.class.getSimpleName(); - /** Contains utility methods for tokens. */ -@@ -91,9 +95,7 @@ public final class TokenUtil { - public static Map nameToValueMapFromPublicIntFields(Class cls) { - return Arrays.stream(cls.getDeclaredFields()) - .filter(fld -> Modifier.isPublic(fld.getModifiers()) && fld.getType() == Integer.TYPE) -- .collect( -- Collectors.toUnmodifiableMap( -- Field::getName, fld -> getIntFromField(fld, fld.getName()))); -+ .collect(toUnmodifiableMap(Field::getName, fld -> getIntFromField(fld, fld.getName()))); + @Override +@@ -35,7 +35,7 @@ public class XpathRegressionVariableDeclarationUsageDistanceTest extends Abstrac } - /** -@@ -103,8 +105,7 @@ public final class TokenUtil { - * @return inverted map - */ - public static Map invertMap(Map map) { -- return map.entrySet().stream() -- .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); -+ return map.entrySet().stream().collect(toImmutableMap(Map.Entry::getValue, Map.Entry::getKey)); - } + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionVariableDeclarationUsageDistance1.java")); - /** -@@ -136,9 +137,7 @@ public final class TokenUtil { - */ - public static String getTokenName(int id) { - final String name = TOKEN_VALUE_TO_NAME.get(id); -- if (name == null) { -- throw new IllegalArgumentException(String.format(Locale.ROOT, TOKEN_ID_EXCEPTION_FORMAT, id)); -- } -+ checkArgument(name != null, String.format(Locale.ROOT, TOKEN_ID_EXCEPTION_FORMAT, id)); - return name; +@@ -79,7 +79,7 @@ public class XpathRegressionVariableDeclarationUsageDistanceTest extends Abstrac } -@@ -151,10 +150,7 @@ public final class TokenUtil { - */ - public static int getTokenId(String name) { - final Integer id = TOKEN_NAME_TO_VALUE.get(name); -- if (id == null) { -- throw new IllegalArgumentException( -- String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); -- } -+ checkArgument(id != null, String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); - return id; - } - -@@ -166,10 +162,9 @@ public final class TokenUtil { - * @throws IllegalArgumentException when name is unknown - */ - public static String getShortDescription(String name) { -- if (!TOKEN_NAME_TO_VALUE.containsKey(name)) { -- throw new IllegalArgumentException( -- String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); -- } -+ checkArgument( -+ TOKEN_NAME_TO_VALUE.containsKey(name), -+ String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionVariableDeclarationUsageDistance2.java")); - final String tokenTypes = "com.puppycrawl.tools.checkstyle.api.tokentypes"; - final ResourceBundle bundle = ResourceBundle.getBundle(tokenTypes, Locale.ROOT); -@@ -334,7 +329,7 @@ public final class TokenUtil { - public static BitSet asBitSet(String... tokens) { - return Arrays.stream(tokens) - .map(String::trim) -- .filter(Predicate.not(String::isEmpty)) -+ .filter(not(String::isEmpty)) - .mapToInt(TokenUtil::getTokenId) - .collect(BitSet::new, BitSet::set, BitSet::or); - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java -@@ -19,6 +19,7 @@ +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java +@@ -19,14 +19,14 @@ - package com.puppycrawl.tools.checkstyle.utils; + package org.checkstyle.suppressionxpathfilter; -+import com.google.common.collect.ImmutableSet; - import java.util.Arrays; - import java.util.Collections; ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck; + import java.io.File; +-import java.util.Collections; import java.util.List; -@@ -88,6 +89,6 @@ public final class UnmodifiableCollectionUtil { - * @return immutable set - */ - public static Set singleton(T obj) { -- return Collections.singleton(obj); -+ return ImmutableSet.of(obj); + import org.junit.jupiter.api.Test; + +-public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport { ++final class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport { + + private final String checkName = WhitespaceAfterCheck.class.getSimpleName(); + +@@ -36,7 +36,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java -@@ -19,6 +19,9 @@ - package com.puppycrawl.tools.checkstyle.utils; + @Test +- public void testWhitespaceAfterTypecast() throws Exception { ++ void whitespaceAfterTypecast() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionWhitespaceAfterTypecast.java")); -+import static java.util.stream.Collectors.joining; -+import static java.util.stream.Collectors.toUnmodifiableList; -+ - import com.puppycrawl.tools.checkstyle.AstTreeStringPrinter; - import com.puppycrawl.tools.checkstyle.JavaParser; - import com.puppycrawl.tools.checkstyle.api.CheckstyleException; -@@ -34,7 +37,6 @@ import java.util.BitSet; - import java.util.List; - import java.util.Locale; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import net.sf.saxon.Configuration; - import net.sf.saxon.om.Item; - import net.sf.saxon.om.NodeInfo; -@@ -194,7 +196,7 @@ public final class XpathUtil { - return matchingItems.stream() - .map(item -> ((ElementNode) item).getUnderlyingNode()) - .map(AstTreeStringPrinter::printBranch) -- .collect(Collectors.joining(DELIMITER)); -+ .collect(joining(DELIMITER)); - } catch (XPathException ex) { - final String errMsg = - String.format( -@@ -220,6 +222,6 @@ public final class XpathUtil { - final XPathExpression xpathExpression = xpathEvaluator.createExpression(xpath); - final XPathDynamicContext xpathDynamicContext = xpathExpression.createDynamicContext(rootNode); - final List items = xpathExpression.evaluate(xpathDynamicContext); -- return items.stream().map(NodeInfo.class::cast).collect(Collectors.toUnmodifiableList()); -+ return items.stream().map(NodeInfo.class::cast).collect(toUnmodifiableList()); +@@ -48,7 +48,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='SuppressionXpathRegressionWhitespaceAfterTypecast']]/OBJBLOCK" + + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST/RPAREN"); +@@ -57,7 +57,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport } - } ---- a/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java -@@ -19,7 +19,8 @@ - package com.puppycrawl.tools.checkstyle.xpath; + @Test +- public void testWhitespaceAfterNotFollowed() throws Exception { ++ void whitespaceAfterNotFollowed() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionWhitespaceAfterNotFollowed.java")); + +@@ -70,7 +70,7 @@ public class XpathRegressionWhitespaceAfterTest extends AbstractXpathTestSupport + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='SuppressionXpathRegressionWhitespaceAfterNotFollowed']]/OBJBLOCK" + + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/ARRAY_INIT/COMMA"); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java +@@ -19,14 +19,14 @@ + + package org.checkstyle.suppressionxpathfilter; ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAroundCheck; + import java.io.File; -import java.util.Collections; -+import static java.util.Collections.unmodifiableList; -+ import java.util.List; - import net.sf.saxon.Configuration; - import net.sf.saxon.event.Receiver; -@@ -91,7 +92,7 @@ public abstract class AbstractNode implements NodeInfo { - if (children == null) { - children = createChildren(); - } -- return Collections.unmodifiableList(children); -+ return unmodifiableList(children); - } + import org.junit.jupiter.api.Test; - /** ---- a/src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java -+++ b/src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java -@@ -19,6 +19,8 @@ +-public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSupport { ++final class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSupport { - package com.puppycrawl.tools.checkstyle.xpath; + private final String checkName = WhitespaceAroundCheck.class.getSimpleName(); -+import static com.google.common.collect.ImmutableList.toImmutableList; -+ - import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; - import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.FileText; -@@ -27,7 +29,6 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; - import com.puppycrawl.tools.checkstyle.utils.XpathUtil; - import java.util.ArrayList; - import java.util.List; --import java.util.stream.Collectors; +@@ -36,7 +36,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor + } - /** - * Generates xpath queries. Xpath queries are generated based on received {@code DetailAst} element, -@@ -145,7 +146,7 @@ public class XpathQueryGenerator { - public List generate() { - return getMatchingAstElements().stream() - .map(XpathQueryGenerator::generateXpathQuery) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); + @Test +- public void testWhitespaceAroundNotPreceded() throws Exception { ++ void whitespaceAroundNotPreceded() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionWhitespaceAroundNotPreceded.java")); + +@@ -49,7 +49,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='SuppressionXpathRegressionWhitespaceAroundNotPreceded']]/OBJBLOCK" + + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN"); +@@ -58,7 +58,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor } - /** + @Test +- public void testWhitespaceAroundNotFollowed() throws Exception { ++ void whitespaceAroundNotFollowed() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionWhitespaceAroundNotFollowed.java")); + +@@ -71,7 +71,7 @@ public class XpathRegressionWhitespaceAroundTest extends AbstractXpathTestSuppor + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='SuppressionXpathRegressionWhitespaceAroundNotFollowed']]/OBJBLOCK" + + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN"); --- a/src/test/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBeanTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBeanTest.java @@ -34,9 +34,9 @@ import org.apache.commons.beanutils.ConvertUtilsBean; @@ -12796,7 +9735,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport { -@@ -421,7 +424,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -422,7 +425,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport */ protected final void execute(Configuration config, String... filenames) throws Exception { final Checker checker = createChecker(config); @@ -12805,7 +9744,7 @@ checker.process(files); checker.destroy(); } -@@ -442,11 +445,9 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -443,11 +446,9 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport actualViolations.stream() .map(violation -> violation.substring(0, violation.indexOf(':'))) .map(Integer::valueOf) @@ -12819,7 +9758,7 @@ assertWithMessage("Violation lines for %s differ.", file) .that(actualViolationLines) .isEqualTo(expectedViolationLines); -@@ -469,7 +470,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -470,7 +471,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport throws Exception { stream.flush(); stream.reset(); @@ -12828,7 +9767,7 @@ final Checker checker = createChecker(config); final Map> actualViolations = getActualViolations(checker.process(files)); checker.destroy(); -@@ -488,8 +489,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -489,8 +490,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport private Map> getActualViolations(int errorCount) throws IOException { // process each of the lines try (ByteArrayInputStream inputStream = new ByteArrayInputStream(stream.toByteArray()); @@ -12838,7 +9777,7 @@ final Map> actualViolations = new HashMap<>(); for (String line = lnr.readLine(); line != null && lnr.getLineNumber() <= errorCount; -@@ -592,7 +592,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -593,7 +593,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport protected static String[] removeSuppressed( String[] actualViolations, String... suppressedViolations) { final List actualViolationsList = @@ -12849,7 +9788,7 @@ } --- a/src/test/java/com/puppycrawl/tools/checkstyle/AbstractPathTestSupport.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/AbstractPathTestSupport.java -@@ -19,12 +19,13 @@ +@@ -19,13 +19,14 @@ package com.puppycrawl.tools.checkstyle; @@ -12859,13 +9798,14 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; ++import java.util.Arrays; + import java.util.Locale; -import java.util.stream.Collectors; -import java.util.stream.Stream; -+import java.util.Arrays; + import org.junit.jupiter.api.BeforeEach; public abstract class AbstractPathTestSupport { - -@@ -95,7 +96,7 @@ public abstract class AbstractPathTestSupport { +@@ -103,7 +104,7 @@ public abstract class AbstractPathTestSupport { * @return joined strings */ public static String addEndOfLine(String... strings) { @@ -13637,7 +10577,16 @@ final String[] expected = { "4: " + getCheckMessage(LineLengthCheck.class, MSG_KEY, 75, 238), }; -@@ -1918,7 +1916,7 @@ public class CheckerTest extends AbstractModuleTestSupport { +@@ -1652,7 +1650,7 @@ public class CheckerTest extends AbstractModuleTestSupport { + } + + @Test +- public void testViolationMessageOnIoException() throws Exception { ++ void violationMessageOnIoException() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(CheckWhichThrowsError.class); + + final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class); +@@ -1939,7 +1937,7 @@ public class CheckerTest extends AbstractModuleTestSupport { } public List getMethodCalls() { @@ -13648,7 +10597,23 @@ public boolean isInitCalled() { --- a/src/test/java/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java -@@ -74,7 +74,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -24,6 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; + import static org.mockito.Mockito.mockConstruction; + import static org.mockito.Mockito.when; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.ConfigurationLoader.IgnoredModulesOptions; + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.api.Configuration; +@@ -34,7 +35,6 @@ import java.lang.reflect.Method; + import java.nio.file.Files; + import java.nio.file.Paths; + import java.util.ArrayList; +-import java.util.Collections; + import java.util.List; + import java.util.Properties; + import org.junit.jupiter.api.Test; +@@ -75,7 +75,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13657,7 +10622,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -92,7 +92,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -93,7 +93,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13666,7 +10631,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -112,7 +112,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -113,7 +113,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13675,7 +10640,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -133,14 +133,14 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -134,14 +134,14 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13692,7 +10657,7 @@ final DefaultConfiguration config = (DefaultConfiguration) loadConfiguration("InputConfigurationLoaderEmpty.xml", new Properties()); -@@ -148,7 +148,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -149,7 +149,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13701,7 +10666,7 @@ try { loadConfiguration("InputConfigurationLoaderMissingPropertyName.xml"); assertWithMessage("missing property name").fail(); -@@ -166,7 +166,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -167,7 +167,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13710,7 +10675,7 @@ try { final String fName = getPath("InputConfigurationLoaderMissingPropertyName.xml"); ConfigurationLoader.loadConfiguration( -@@ -187,7 +187,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -188,7 +188,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13719,7 +10684,7 @@ try { loadConfiguration("InputConfigurationLoaderMissingPropertyValue.xml"); assertWithMessage("missing property value").fail(); -@@ -205,7 +205,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -206,7 +206,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13728,7 +10693,7 @@ try { loadConfiguration("InputConfigurationLoaderMissingConfigName.xml"); assertWithMessage("missing module name").fail(); -@@ -223,7 +223,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -224,7 +224,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13737,7 +10702,7 @@ try { loadConfiguration("InputConfigurationLoaderMissingConfigParent.xml"); assertWithMessage("missing module parent").fail(); -@@ -241,7 +241,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -242,7 +242,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13746,7 +10711,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -279,7 +279,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -280,7 +280,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13755,7 +10720,17 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -316,7 +316,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -293,8 +293,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { + final List messages = new ArrayList<>(grandchildren[0].getMessages().values()); + final String expectedKey = "name.invalidPattern"; + final List expectedMessages = +- Collections.singletonList( +- "Member ''{0}'' must start with ''m'' (checked pattern ''{1}'')."); ++ ImmutableList.of("Member ''{0}'' must start with ''m'' (checked pattern ''{1}'')."); + assertWithMessage("Messages should contain key: " + expectedKey) + .that(grandchildren[0].getMessages()) + .containsKey(expectedKey); +@@ -321,7 +320,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13764,7 +10739,7 @@ final String[] testValues = { "", "a", "$a", "{a", "{a}", "a}", "$a}", "$", "a$b", }; -@@ -331,7 +331,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -336,7 +335,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13773,7 +10748,7 @@ final Properties props = initProperties(); try { final String value = -@@ -348,7 +348,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -353,7 +352,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13782,7 +10757,7 @@ final Properties props = initProperties(); try { final String value = -@@ -366,7 +366,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -371,7 +370,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13791,7 +10766,16 @@ final String[][] testValues = { {"${a}", "A"}, {"x${a}", "xA"}, -@@ -399,7 +399,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -404,7 +403,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { + } + + @Test +- public void testSystemEntity() throws Exception { ++ void systemEntity() throws Exception { + final Properties props = new Properties(); + props.setProperty("checkstyle.basedir", "basedir"); + +@@ -419,7 +418,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13800,7 +10784,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -416,7 +416,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -436,7 +435,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13809,7 +10793,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -433,7 +433,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -453,7 +452,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13818,7 +10802,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); -@@ -452,7 +452,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -472,7 +471,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13827,7 +10811,7 @@ final Class aClassParent = ConfigurationLoader.class; final Constructor ctorParent = aClassParent.getDeclaredConstructor( -@@ -481,7 +481,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -501,7 +500,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13836,7 +10820,7 @@ try { loadConfiguration("InputConfigurationLoaderNonexistentProperty.xml"); assertWithMessage("exception in expected").fail(); -@@ -505,7 +505,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -525,7 +524,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13845,7 +10829,7 @@ final DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader.loadConfiguration( -@@ -519,7 +519,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -539,7 +538,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13854,7 +10838,7 @@ final DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader.loadConfiguration( -@@ -536,7 +536,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -556,7 +555,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13863,7 +10847,7 @@ final DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader.loadConfiguration( -@@ -549,7 +549,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -569,7 +568,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13872,7 +10856,7 @@ try { ConfigurationLoader.loadConfiguration( ";InputConfigurationLoaderModuleIgnoreSeverity.xml", -@@ -565,7 +565,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -585,7 +584,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13881,7 +10865,7 @@ final DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader.loadConfiguration( -@@ -581,7 +581,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -601,7 +600,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13890,7 +10874,7 @@ final Properties props = new Properties(); final String defaultValue = "defaultValue"; -@@ -594,7 +594,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -614,7 +613,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13899,7 +10883,7 @@ final DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader.loadConfiguration( -@@ -608,7 +608,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -628,7 +627,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13908,7 +10892,7 @@ final List propertyRefs = new ArrayList<>(); final List fragments = new ArrayList<>(); -@@ -618,7 +618,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -638,7 +637,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13917,7 +10901,7 @@ final Properties props = new Properties(); props.setProperty("checkstyle.basedir", "basedir"); final String fName = getPath("InputConfigurationLoaderChecks.xml"); -@@ -643,7 +643,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -663,7 +662,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13926,7 +10910,7 @@ try (MockedConstruction mocked = mockConstruction( DefaultConfiguration.class, -@@ -671,7 +671,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { +@@ -691,7 +690,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { } @Test @@ -13935,6 +10919,15 @@ final String[] configFiles = { "InputConfigurationLoaderOldConfig0.xml", "InputConfigurationLoaderOldConfig1.xml", +@@ -739,7 +738,7 @@ public class ConfigurationLoaderTest extends AbstractPathTestSupport { + } + + @Test +- public void testDefaultValuesForNonDefinedProperties() throws Exception { ++ void defaultValuesForNonDefinedProperties() throws Exception { + final Properties props = new Properties(); + props.setProperty("checkstyle.charset.base", "UTF"); + --- a/src/test/java/com/puppycrawl/tools/checkstyle/DefaultConfigurationTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/DefaultConfigurationTest.java @@ -26,10 +26,10 @@ import java.util.Map; @@ -14045,7 +11038,7 @@ -public class DefaultLoggerTest { +final class DefaultLoggerTest { - private static final Locale DEFAULT_LOCALE = Locale.getDefault(); + private static final Locale DEFAULT_LOCALE = Locale.ENGLISH; @AfterEach - public void tearDown() { @@ -14192,7 +11185,7 @@ - public void testNewCtor() throws Exception { + void newCtor() throws Exception { final ResourceBundle bundle = - ResourceBundle.getBundle(Definitions.CHECKSTYLE_BUNDLE, Locale.ROOT); + ResourceBundle.getBundle(Definitions.CHECKSTYLE_BUNDLE, Locale.ENGLISH); final String auditStartedMessage = bundle.getString(DefaultLogger.AUDIT_STARTED_MESSAGE); @@ -284,8 +284,8 @@ public class DefaultLoggerTest { dl.auditStarted(null); @@ -14239,7 +11232,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; -@@ -29,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +@@ -28,7 +29,6 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; import java.io.File; import java.io.Writer; import java.lang.reflect.Method; @@ -14247,7 +11240,7 @@ import java.nio.file.Files; import java.text.MessageFormat; import java.util.ArrayList; -@@ -44,7 +44,7 @@ import org.junit.jupiter.api.Test; +@@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; /** TestCase to check DetailAST. */ @@ -14256,7 +11249,7 @@ // Ignores file which are not meant to have root node intentionally. public static final Set NO_ROOT_FILES = -@@ -75,7 +75,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -74,7 +74,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14265,7 +11258,7 @@ final DetailAstImpl ast = new DetailAstImpl(); ast.setText("test"); ast.setType(1); -@@ -95,7 +95,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -94,7 +94,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14274,7 +11267,7 @@ final CommonToken token = new CommonToken(1); token.setText("test"); token.setLine(2); -@@ -111,7 +111,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -110,7 +110,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14283,7 +11276,7 @@ final DetailAstImpl root = new DetailAstImpl(); final DetailAstImpl firstLevelA = new DetailAstImpl(); final DetailAstImpl firstLevelB = new DetailAstImpl(); -@@ -147,7 +147,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -146,7 +146,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14292,7 +11285,7 @@ final DetailAstImpl root = new DetailAstImpl(); final DetailAstImpl child = new DetailAstImpl(); root.setFirstChild(child); -@@ -157,7 +157,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -156,7 +156,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14301,7 +11294,7 @@ final DetailAstImpl root = new DetailAstImpl(); final DetailAstImpl firstLevelA = new DetailAstImpl(); final DetailAstImpl firstLevelB = new DetailAstImpl(); -@@ -186,7 +186,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -185,7 +185,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14310,7 +11303,7 @@ final DetailAstImpl root = new DetailAstImpl(); final DetailAstImpl firstLevelA = new DetailAstImpl(); -@@ -202,7 +202,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -201,7 +201,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14319,7 +11312,7 @@ final DetailAST previousSibling = new DetailAstImpl(); final DetailAstImpl instance = new DetailAstImpl(); final DetailAstImpl parent = new DetailAstImpl(); -@@ -251,7 +251,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -250,7 +250,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14328,7 +11321,7 @@ final DetailAstImpl child = new DetailAstImpl(); final DetailAST newSibling = new DetailAstImpl(); -@@ -262,7 +262,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -261,7 +261,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14337,7 +11330,7 @@ final DetailAstImpl root = new DetailAstImpl(); final DetailAstImpl firstLevelA = new DetailAstImpl(); final DetailAST firstLevelB = new DetailAstImpl(); -@@ -292,7 +292,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -291,7 +291,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14346,7 +11339,7 @@ final DetailAstImpl root = createToken(null, TokenTypes.CLASS_DEF); final DetailAstImpl modifiers = createToken(root, TokenTypes.MODIFIERS); createToken(modifiers, TokenTypes.LITERAL_PUBLIC); -@@ -313,7 +313,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -312,7 +312,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14355,7 +11348,7 @@ final DetailAstImpl parent = new DetailAstImpl(); final DetailAstImpl child = new DetailAstImpl(); parent.setFirstChild(child); -@@ -349,7 +349,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -348,7 +348,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14364,7 +11357,7 @@ final DetailAST root = new DetailAstImpl(); final BitSet bitSet = new BitSet(); bitSet.set(999); -@@ -359,7 +359,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -358,7 +358,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14373,7 +11366,7 @@ final DetailAstImpl parent = new DetailAstImpl(); final DetailAstImpl child = new DetailAstImpl(); parent.setFirstChild(child); -@@ -385,7 +385,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -384,7 +384,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14382,7 +11375,7 @@ final DetailAST root = new DetailAstImpl(); TestUtil.setInternalState(root, "childCount", 999); -@@ -393,7 +393,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -392,7 +392,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14391,7 +11384,7 @@ final DetailAstImpl parent = new DetailAstImpl(); final DetailAstImpl child = new DetailAstImpl(); final DetailAstImpl sibling = new DetailAstImpl(); -@@ -426,7 +426,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -425,7 +425,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14400,7 +11393,7 @@ final DetailAstImpl parent = new DetailAstImpl(); final DetailAstImpl child = new DetailAstImpl(); parent.setFirstChild(child); -@@ -444,7 +444,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -443,7 +443,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14409,7 +11402,7 @@ final DetailAstImpl parent = new DetailAstImpl(); final DetailAstImpl child = new DetailAstImpl(); final DetailAstImpl sibling = new DetailAstImpl(); -@@ -457,7 +457,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -456,7 +456,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14418,7 +11411,7 @@ final DetailAstImpl parent = new DetailAstImpl(); parent.setText("Parent"); final DetailAstImpl child = new DetailAstImpl(); -@@ -471,7 +471,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -470,7 +470,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14427,7 +11420,7 @@ final DetailAstImpl child = new DetailAstImpl(); final DetailAstImpl newSibling = new DetailAstImpl(); final DetailAstImpl oldParent = new DetailAstImpl(); -@@ -484,7 +484,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -483,7 +483,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14436,7 +11429,7 @@ final DetailAstImpl root1 = new DetailAstImpl(); root1.setLineNo(1); assertWithMessage("Invalid line number").that(root1.getLineNo()).isEqualTo(1); -@@ -510,7 +510,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -509,7 +509,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14445,7 +11438,7 @@ final DetailAstImpl root1 = new DetailAstImpl(); root1.setColumnNo(1); assertWithMessage("Invalid column number").that(root1.getColumnNo()).isEqualTo(1); -@@ -538,7 +538,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -537,7 +537,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14454,7 +11447,7 @@ final DetailAstImpl root = new DetailAstImpl(); final DetailAstImpl firstChild = new DetailAstImpl(); firstChild.setType(TokenTypes.IDENT); -@@ -560,10 +560,10 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -559,10 +559,10 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14464,10 +11457,10 @@ - try (Writer bw = Files.newBufferedWriter(file.toPath(), StandardCharsets.UTF_8)) { + try (Writer bw = Files.newBufferedWriter(file.toPath(), UTF_8)) { + bw.write("/*\ncom.puppycrawl.tools.checkstyle.checks.TodoCommentCheck\n\n\n\n*/\n"); bw.write("class C {\n"); for (int i = 0; i <= 30000; i++) { - bw.write("// " + i + "\n"); -@@ -578,7 +578,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -576,7 +576,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14476,7 +11469,7 @@ final List files = getAllFiles(new File("src/test/resources/com/puppycrawl/tools/checkstyle")); -@@ -594,7 +594,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -592,7 +592,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14485,7 +11478,7 @@ final DetailAstImpl ast = new DetailAstImpl(); ast.setText("text"); ast.setColumnNo(1); -@@ -603,7 +603,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -601,7 +601,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -14494,7 +11487,7 @@ final DetailAstImpl parent = new DetailAstImpl(); final DetailAstImpl child1 = new DetailAstImpl(); parent.setFirstChild(child1); -@@ -616,7 +616,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { +@@ -614,7 +614,7 @@ public class DetailAstImplTest extends AbstractModuleTestSupport { } @Test @@ -15027,24 +12020,45 @@ final String path = getNonCompilablePath("InputJavadocPropertiesGeneratorParseError.java"); try { JavadocPropertiesGenerator.main(path, "--destfile", DESTFILE_ABSOLUTE_PATH); +@@ -315,8 +309,8 @@ public class JavadocPropertiesGeneratorTest extends AbstractPathTestSupport { + } + + @Test +- public void testGetFirstJavadocSentence( +- @SysErr Capturable systemErr, @SysOut Capturable systemOut) throws Exception { ++ void getFirstJavadocSentence(@SysErr Capturable systemErr, @SysOut Capturable systemOut) ++ throws Exception { + final String expectedContent = "EOF1=First Javadoc Sentence."; + + JavadocPropertiesGenerator.main( +@@ -325,7 +319,7 @@ public class JavadocPropertiesGeneratorTest extends AbstractPathTestSupport { + DESTFILE_ABSOLUTE_PATH); + assertWithMessage("Unexpected error log").that(systemErr.getCapturedData()).isEqualTo(""); + assertWithMessage("Unexpected output log").that(systemOut.getCapturedData()).isEqualTo(""); +- final String fileContent = FileUtils.readFileToString(DESTFILE, StandardCharsets.UTF_8); ++ final String fileContent = FileUtils.readFileToString(DESTFILE, UTF_8); + assertWithMessage("File content is not expected") + .that(fileContent.trim()) + .isEqualTo(expectedContent.trim()); --- a/src/test/java/com/puppycrawl/tools/checkstyle/LocalizedMessageTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/LocalizedMessageTest.java -@@ -44,12 +44,12 @@ import org.junitpioneer.jupiter.DefaultLocale; +@@ -44,13 +44,13 @@ import org.junitpioneer.jupiter.DefaultLocale; * @noinspectionreason ClassLoaderInstantiation - Custom class loader is needed to pass URLs for * testing */ -public class LocalizedMessageTest { +final class LocalizedMessageTest { - private static final Locale DEFAULT_LOCALE = Locale.getDefault(); + private static final Locale DEFAULT_LOCALE = Locale.ENGLISH; + @DefaultLocale("en") @Test - public void testNullArgs() { + void nullArgs() { final LocalizedMessage messageClass = new LocalizedMessage( Definitions.CHECKSTYLE_BUNDLE, -@@ -70,7 +70,7 @@ public class LocalizedMessageTest { +@@ -71,7 +71,7 @@ public class LocalizedMessageTest { } @Test @@ -15053,7 +12067,7 @@ final Utf8Control control = new Utf8Control(); final ResourceBundle bundle = control.newBundle( -@@ -92,7 +92,7 @@ public class LocalizedMessageTest { +@@ -93,7 +93,7 @@ public class LocalizedMessageTest { * @noinspectionreason IOResourceOpenedButNotSafelyClosed - no need to close resources in testing */ @Test @@ -15062,7 +12076,7 @@ final AtomicBoolean closed = new AtomicBoolean(); final InputStream inputStream = -@@ -156,7 +156,7 @@ public class LocalizedMessageTest { +@@ -157,7 +157,7 @@ public class LocalizedMessageTest { * @noinspectionreason IOResourceOpenedButNotSafelyClosed - no need to close resources in testing */ @Test @@ -15071,7 +12085,7 @@ final AtomicBoolean closed = new AtomicBoolean(); final InputStream inputStream = -@@ -213,7 +213,7 @@ public class LocalizedMessageTest { +@@ -214,7 +214,7 @@ public class LocalizedMessageTest { } @Test @@ -15080,7 +12094,7 @@ final URL url = new URL( "test", -@@ -240,7 +240,7 @@ public class LocalizedMessageTest { +@@ -241,7 +241,7 @@ public class LocalizedMessageTest { /** Verifies that the language specified with the system property {@code user.language} exists. */ @Test @@ -15089,7 +12103,7 @@ final String language = DEFAULT_LOCALE.getLanguage(); assumeFalse(language.isEmpty(), "Locale not set"); assertWithMessage("Invalid language") -@@ -251,14 +251,14 @@ public class LocalizedMessageTest { +@@ -252,14 +252,14 @@ public class LocalizedMessageTest { /** Verifies that the country specified with the system property {@code user.country} exists. */ @Test @@ -15106,7 +12120,7 @@ final LocalizedMessage violation = createSampleViolation(); LocalizedMessage.setLocale(Locale.FRENCH); -@@ -269,7 +269,7 @@ public class LocalizedMessageTest { +@@ -270,7 +270,7 @@ public class LocalizedMessageTest { @DefaultLocale("fr") @Test @@ -15115,7 +12129,7 @@ LocalizedMessage.setLocale(Locale.US); final LocalizedMessage violation = createSampleViolation(); -@@ -280,7 +280,7 @@ public class LocalizedMessageTest { +@@ -281,7 +281,7 @@ public class LocalizedMessageTest { @DefaultLocale("fr") @Test @@ -15124,7 +12138,7 @@ LocalizedMessage.setLocale(Locale.ROOT); final LocalizedMessage violation = createSampleViolation(); -@@ -297,7 +297,7 @@ public class LocalizedMessageTest { +@@ -298,7 +298,7 @@ public class LocalizedMessageTest { } @AfterEach @@ -16486,7 +13500,19 @@ final PackageObjectFactory objectFactory = new PackageObjectFactory(packages, classLoader, TRY_IN_ALL_REGISTERED_PACKAGES); -@@ -557,9 +558,9 @@ public class PackageObjectFactoryTest { +@@ -562,9 +563,9 @@ public class PackageObjectFactoryTest { + * It ensures that ModuleReflectionUtil.getCheckstyleModules is not executed in this case. + */ + @Test +- public void testCreateObjectWithNameContainingPackageSeparatorWithoutSearch() throws Exception { ++ void createObjectWithNameContainingPackageSeparatorWithoutSearch() throws Exception { + final ClassLoader classLoader = ClassLoader.getSystemClassLoader(); +- final Set packages = Collections.singleton(BASE_PACKAGE); ++ final Set packages = ImmutableSet.of(BASE_PACKAGE); + final PackageObjectFactory objectFactory = + new PackageObjectFactory(packages, classLoader, TRY_IN_ALL_REGISTERED_PACKAGES); + +@@ -588,9 +589,9 @@ public class PackageObjectFactoryTest { } @Test @@ -16498,6 +13524,15 @@ final PackageObjectFactory objectFactory = new PackageObjectFactory(packages, classLoader, SEARCH_REGISTERED_PACKAGES); final CheckstyleException ex = +@@ -611,7 +612,7 @@ public class PackageObjectFactoryTest { + } + + @Test +- public void testExceptionMessage() { ++ void exceptionMessage() { + final String barPackage = BASE_PACKAGE + ".packageobjectfactory.bar"; + final String fooPackage = BASE_PACKAGE + ".packageobjectfactory.foo"; + final String zooPackage = BASE_PACKAGE + ".packageobjectfactory.zoo"; --- a/src/test/java/com/puppycrawl/tools/checkstyle/PropertiesExpanderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/PropertiesExpanderTest.java @@ -24,10 +24,10 @@ import static com.google.common.truth.Truth.assertWithMessage; @@ -16622,8 +13657,8 @@ + void cacheDirectoryDoesNotExistAndShouldBeCreated() throws IOException { final Configuration config = new DefaultConfiguration("myName"); final String filePath = - String.format( -@@ -249,7 +249,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + String.format(Locale.ENGLISH, "%s%2$stemp%2$scache.temp", temporaryFolder, File.separator); +@@ -248,7 +248,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -16632,7 +13667,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String fileName = "temp.cache"; final Path filePath = Paths.get(fileName); -@@ -262,7 +262,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -261,7 +261,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -16641,7 +13676,7 @@ final DefaultConfiguration config = new DefaultConfiguration("myConfig"); config.addProperty("attr", "value"); -@@ -314,11 +314,11 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -313,11 +313,11 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { * @noinspectionreason ResultOfMethodCallIgnored - Setup for mockito to only mock toByteArray to * throw exception. */ @@ -16656,7 +13691,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -353,7 +353,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -352,7 +352,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -16665,7 +13700,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -392,8 +392,8 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -391,8 +391,8 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { * @param rawMessages exception messages separated by ';' */ @ParameterizedTest @@ -16951,7 +13986,7 @@ final ThreadModeSettings singleThreadModeSettings = --- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java -@@ -21,10 +21,13 @@ package com.puppycrawl.tools.checkstyle; +@@ -21,11 +21,15 @@ package com.puppycrawl.tools.checkstyle; import static com.google.common.truth.Truth.assertWithMessage; import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN; @@ -16963,9 +13998,19 @@ +import static org.mockito.Mockito.mockConstruction; +import static org.mockito.Mockito.mockStatic; ++import com.google.common.collect.ImmutableList; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; -@@ -89,10 +92,10 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { + import com.puppycrawl.tools.checkstyle.api.Configuration; +@@ -59,7 +63,6 @@ import java.nio.file.Files; + import java.util.ArrayList; + import java.util.Arrays; + import java.util.Collection; +-import java.util.Collections; + import java.util.HashSet; + import java.util.List; + import java.util.Set; +@@ -91,10 +94,10 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -16978,7 +14023,7 @@ final String content = "public class Main { public static final int k = 5 + 4; }"; writer.write(content); } -@@ -130,7 +133,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -132,7 +135,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { * @throws Exception if an error occurs */ @Test @@ -16987,7 +14032,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(OneTopLevelClassCheck.class); final String[] expected = { "5:1: " -@@ -138,7 +141,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -140,7 +143,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { OneTopLevelClassCheck.class, OneTopLevelClassCheck.MSG_KEY, "InputTreeWalkerInner"), }; try (MockedConstruction mocked = @@ -16996,7 +14041,7 @@ TreeWalkerAuditEvent.class, (mock, context) -> { throw new CheckstyleException("No audit events expected"); -@@ -152,7 +155,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -154,7 +157,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { * that the {@code if (!ordinaryChecks.isEmpty())} condition cannot be removed. */ @Test @@ -17005,7 +14050,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(JavadocParagraphCheck.class); final String[] expected = { "3: " -@@ -160,12 +163,12 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -162,12 +165,12 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { JavadocParagraphCheck.class, JavadocParagraphCheck.MSG_REDUNDANT_PARAGRAPH), }; final String path = getPath("InputTreeWalkerJavadoc.java"); @@ -17020,7 +14065,7 @@ parser.when(() -> JavaParser.parse(any(FileContents.class))).thenReturn(mockAst); // This will re-enable walk(..., AstState.WITH_COMMENTS) parser.when(() -> JavaParser.appendHiddenCommentNodes(mockAst)).thenReturn(realAst); -@@ -179,15 +182,14 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -181,15 +184,14 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { * that the {@code if (!commentChecks.isEmpty())} condition cannot be removed. */ @Test @@ -17038,7 +14083,7 @@ // Ensure that there is no calls to walk(..., AstState.WITH_COMMENTS) parser .when(() -> JavaParser.appendHiddenCommentNodes(any(DetailAST.class))) -@@ -198,10 +200,10 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -200,10 +202,10 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17051,7 +14096,7 @@ final String content = "public class Main { public static final int k = 5 + 4; }"; writer.write(content); } -@@ -210,7 +212,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -212,7 +214,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17060,7 +14105,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); checkConfig.addProperty("tokens", "VARIABLE_DEF, ENUM_DEF, CLASS_DEF, METHOD_DEF," + "IMPORT"); try { -@@ -235,7 +237,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -237,7 +239,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17069,7 +14114,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); final String pathToEmptyFile = File.createTempFile("file", ".java", temporaryFolder).getPath(); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -244,7 +246,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -246,7 +248,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17078,7 +14123,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(JavadocPackageCheck.class); try { -@@ -262,7 +264,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -264,7 +266,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17087,7 +14132,7 @@ final TreeWalker treeWalker = new TreeWalker(); final PackageObjectFactory factory = new PackageObjectFactory(new HashSet<>(), Thread.currentThread().getContextClassLoader()); -@@ -283,7 +285,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -285,7 +287,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17096,7 +14141,7 @@ final TreeWalker treeWalker = new TreeWalker(); final DefaultConfiguration config = new DefaultConfiguration("default config"); treeWalker.setTabWidth(1); -@@ -296,7 +298,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -298,7 +300,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17105,7 +14150,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(BadJavaDocCheck.class); final String pathToEmptyFile = File.createTempFile("file", ".java", temporaryFolder).getPath(); -@@ -320,7 +322,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -322,7 +324,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17114,7 +14159,7 @@ final TreeWalker treeWalker = new TreeWalker(); final PackageObjectFactory factory = new PackageObjectFactory(new HashSet<>(), Thread.currentThread().getContextClassLoader()); -@@ -348,7 +350,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -350,7 +352,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17123,7 +14168,7 @@ final TreeWalker treeWalker = new TreeWalker(); treeWalker.setTabWidth(1); treeWalker.configure(new DefaultConfiguration("default config")); -@@ -360,7 +362,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -362,7 +364,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17132,7 +14177,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(HiddenFieldCheck.class); final Checker checker = createChecker(checkConfig); final PackageObjectFactory factory = -@@ -373,7 +375,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -375,7 +377,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17141,7 +14186,7 @@ final TreeWalker treeWalker = new TreeWalker(); treeWalker.configure(createModuleConfig(TypeNameCheck.class)); final PackageObjectFactory factory = -@@ -396,7 +398,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -398,7 +400,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17150,7 +14195,7 @@ final TreeWalker treeWalker = new TreeWalker(); treeWalker.configure(createModuleConfig(TypeNameCheck.class)); final PackageObjectFactory factory = -@@ -419,7 +421,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -421,7 +423,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17159,7 +14204,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(RequiredTokenIsEmptyIntArray.class); final String pathToEmptyFile = File.createTempFile("file", ".java", temporaryFolder).getPath(); -@@ -428,7 +430,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -430,7 +432,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17168,7 +14213,7 @@ final TreeWalker treeWalker = new TreeWalker(); final PackageObjectFactory factory = new PackageObjectFactory(new HashSet<>(), Thread.currentThread().getContextClassLoader()); -@@ -443,7 +445,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -445,7 +447,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17177,7 +14222,7 @@ final TreeWalker treeWalker = new TreeWalker(); treeWalker.configure(createModuleConfig(TypeNameCheck.class)); treeWalker.configure(createModuleConfig(CommentsIndentationCheck.class)); -@@ -470,7 +472,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -472,7 +474,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17186,7 +14231,7 @@ final TreeWalker treeWalker = new TreeWalker(); final PackageObjectFactory factory = new PackageObjectFactory(new HashSet<>(), Thread.currentThread().getContextClassLoader()); -@@ -490,7 +492,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -492,7 +494,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17195,7 +14240,7 @@ final DefaultConfiguration filterConfig = createModuleConfig(SuppressionCommentFilter.class); filterConfig.addProperty("checkCPP", "false"); -@@ -511,7 +513,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -513,7 +515,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17204,7 +14249,16 @@ final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class); treeWalkerConfig.addChild(createModuleConfig(WhitespaceAroundCheck.class)); treeWalkerConfig.addChild(createModuleConfig(WhitespaceAfterCheck.class)); -@@ -525,7 +527,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -527,7 +529,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { + } + + @Test +- public void testMultiCheckOfSameTypeNoIdResultsInOrderingByHash() throws Exception { ++ void multiCheckOfSameTypeNoIdResultsInOrderingByHash() throws Exception { + + final DefaultConfiguration configuration1 = createModuleConfig(ParameterNameCheck.class); + configuration1.addProperty("format", "^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"); +@@ -557,7 +559,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17213,7 +14267,7 @@ final TreeWalker treeWalker = new TreeWalker(); treeWalker.setSeverity("error"); treeWalker.setTabWidth(100); -@@ -541,7 +543,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -573,7 +575,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17222,7 +14276,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(VerifyInitCheck.class); final File file = File.createTempFile("file", ".pdf", temporaryFolder); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -550,7 +552,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -582,7 +584,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17231,7 +14285,7 @@ VerifyDestroyCheck.resetDestroyWasCalled(); final DefaultConfiguration checkConfig = createModuleConfig(VerifyDestroyCheck.class); final File file = File.createTempFile("file", ".pdf", temporaryFolder); -@@ -562,7 +564,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -594,7 +596,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17240,7 +14294,7 @@ VerifyDestroyCheck.resetDestroyWasCalled(); final DefaultConfiguration checkConfig = createModuleConfig(VerifyDestroyCommentCheck.class); final File file = File.createTempFile("file", ".pdf", temporaryFolder); -@@ -574,7 +576,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -606,7 +608,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17249,7 +14303,7 @@ final DefaultConfiguration filterConfig = createModuleConfig(SuppressionXpathFilter.class); filterConfig.addProperty("file", getPath("InputTreeWalkerSuppressionXpathFilter.xml")); final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class); -@@ -597,7 +599,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -629,7 +631,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17258,7 +14312,7 @@ final DefaultConfiguration filterConfig = createModuleConfig(SuppressionXpathFilter.class); filterConfig.addProperty("file", getPath("InputTreeWalkerSuppressionXpathFilterAbsolute.xml")); final DefaultConfiguration checkConfig = createModuleConfig(LeftCurlyCheck.class); -@@ -617,7 +619,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { +@@ -649,7 +651,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { } @Test @@ -17267,6 +14321,24 @@ final DefaultConfiguration checkConfig = createModuleConfig(EmptyStatementCheck.class); final DefaultConfiguration filterConfig = createModuleConfig(SuppressWithNearbyCommentFilter.class); +@@ -673,7 +675,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { + * @throws Exception if file is not found + */ + @Test +- public void testOrderOfCheckExecution() throws Exception { ++ void orderOfCheckExecution() throws Exception { + + final DefaultConfiguration configuration1 = createModuleConfig(AaCheck.class); + configuration1.addProperty("id", "2"); +@@ -684,7 +686,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { + treeWalkerConfig.addChild(configuration2); + treeWalkerConfig.addChild(configuration1); + +- final List files = Collections.singletonList(new File(getPath("InputTreeWalker2.java"))); ++ final List files = ImmutableList.of(new File(getPath("InputTreeWalker2.java"))); + final Checker checker = createChecker(treeWalkerConfig); + + try { --- a/src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/XMLLoggerTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; @@ -18284,10 +15356,10 @@ @Test - public void testCheck() throws Exception { + void check() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(ViolationAstCheck.class); - final String[] expected = { -@@ -377,10 +377,11 @@ public class AbstractCheckTest extends AbstractModuleTestSupport { + "6:1: Violation.", + }; +@@ -375,10 +375,11 @@ public class AbstractCheckTest extends AbstractModuleTestSupport { * file as none of the checks try to modify the tokens. */ @Test @@ -18427,7 +15499,7 @@ + void lineColumnLog() throws Exception { final ViolationFileSetCheck check = new ViolationFileSetCheck(); check.configure(new DefaultConfiguration("filesetcheck")); - final File file = new File(getPath("InputAbstractFileSetLineColumn.txt")); + final File file = new File(getPath("InputAbstractFileSetLineColumn.java")); @@ -174,7 +174,7 @@ public class AbstractFileSetCheckTest extends AbstractModuleTestSupport { } @@ -18443,10 +15515,10 @@ @Test - public void testCheck() throws Exception { + void check() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(ViolationFileSetCheck.class); - final String[] expected = { -@@ -195,7 +195,7 @@ public class AbstractFileSetCheckTest extends AbstractModuleTestSupport { + "1:1: Violation.", + }; +@@ -193,7 +193,7 @@ public class AbstractFileSetCheckTest extends AbstractModuleTestSupport { } @Test @@ -18455,7 +15527,7 @@ final MultiFileViolationFileSetCheck check = new MultiFileViolationFileSetCheck(); check.configure(new DefaultConfiguration("filesetcheck")); final ViolationDispatcher dispatcher = new ViolationDispatcher(); -@@ -229,7 +229,7 @@ public class AbstractFileSetCheckTest extends AbstractModuleTestSupport { +@@ -227,7 +227,7 @@ public class AbstractFileSetCheckTest extends AbstractModuleTestSupport { * as none of the checks try to modify the fileExtensions. */ @Test @@ -19025,17 +16097,17 @@ @Test - public void testTranslation() throws Exception { + void translation() throws Exception { - final Configuration checkConfig = createModuleConfig(TestFileSetCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verify(checkConfig, getPath("InputFileSetIllegalTokens.java"), expected); -@@ -45,7 +45,7 @@ public class FileSetCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser(getPath("InputFileSetIllegalTokens.java"), expected); + +@@ -44,7 +44,7 @@ public class FileSetCheckTest extends AbstractModuleTestSupport { } @Test - public void testProcessCallsFinishBeforeCallingDestroy() throws Exception { + void processCallsFinishBeforeCallingDestroy() throws Exception { - final Configuration checkConfig = createModuleConfig(TestFileSetCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputFileSetIllegalTokens.java"), expected); --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/FileTextTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/FileTextTest.java @@ -19834,7 +16906,7 @@ import com.puppycrawl.tools.checkstyle.ConfigurationLoader; import com.puppycrawl.tools.checkstyle.PropertiesExpander; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; -@@ -40,7 +42,6 @@ import java.util.Properties; +@@ -41,7 +43,6 @@ import java.util.Properties; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -19842,7 +16914,7 @@ import org.xml.sax.InputSource; public final class InlineConfigParser { -@@ -231,7 +232,7 @@ public final class InlineConfigParser { +@@ -241,7 +242,7 @@ public final class InlineConfigParser { return lines.stream() .skip(1) .takeWhile(line -> !line.startsWith("*/")) @@ -19906,7 +16978,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -@@ -73,15 +74,15 @@ public final class TestInputConfiguration { +@@ -75,15 +76,15 @@ public final class TestInputConfiguration { } public List getChildrenModules() { @@ -19925,7 +16997,7 @@ } public DefaultConfiguration createConfiguration() { -@@ -156,7 +157,7 @@ public final class TestInputConfiguration { +@@ -162,7 +163,7 @@ public final class TestInputConfiguration { } public List getChildrenModules() { @@ -24977,12 +22049,48 @@ } @Test -- public void testDefault() throws Exception { -+ void testDefault() throws Exception { +- public void testInputFinalLocalVariableOne() throws Exception { ++ void inputFinalLocalVariableOne() throws Exception { final String[] expected = { "17:13: " + getCheckMessage(MSG_KEY, "i"), -@@ -82,7 +82,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -59,7 +59,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariableTwo() throws Exception { ++ void inputFinalLocalVariableTwo() throws Exception { + final String[] expected = { + "24:17: " + getCheckMessage(MSG_KEY, "weird"), + "25:17: " + getCheckMessage(MSG_KEY, "j"), +@@ -69,7 +69,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariableThree() throws Exception { ++ void inputFinalLocalVariableThree() throws Exception { + final String[] expected = { + "14:17: " + getCheckMessage(MSG_KEY, "x"), + "20:21: " + getCheckMessage(MSG_KEY, "x"), +@@ -86,7 +86,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariableFour() throws Exception { ++ void inputFinalLocalVariableFour() throws Exception { + final String[] expected = { + "16:17: " + getCheckMessage(MSG_KEY, "shouldBeFinal"), + "28:17: " + getCheckMessage(MSG_KEY, "shouldBeFinal"), +@@ -98,7 +98,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testFinalLocalVariableFive() throws Exception { ++ void finalLocalVariableFive() throws Exception { + final String[] expected = { + "15:17: " + getCheckMessage(MSG_KEY, "shouldBeFinal"), + "26:17: " + getCheckMessage(MSG_KEY, "shouldBeFinal"), +@@ -110,7 +110,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -24991,16 +22099,52 @@ final String[] expected = { "20:17: " + getCheckMessage(MSG_KEY, "b"), }; -@@ -91,7 +91,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -119,7 +119,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test -- public void testParameter() throws Exception { -+ void parameter() throws Exception { +- public void testInputFinalLocalVariable2One() throws Exception { ++ void inputFinalLocalVariable2One() throws Exception { final String[] expected = { - "53:28: " + getCheckMessage(MSG_KEY, "aArg"), -@@ -102,21 +102,21 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + "52:28: " + getCheckMessage(MSG_KEY, "aArg"), +@@ -128,7 +128,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariable2Two() throws Exception { ++ void inputFinalLocalVariable2Two() throws Exception { + + final String[] excepted = { + "78:36: " + getCheckMessage(MSG_KEY, "_o"), "83:37: " + getCheckMessage(MSG_KEY, "_o1"), +@@ -137,7 +137,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariable2Three() throws Exception { ++ void inputFinalLocalVariable2Three() throws Exception { + + final String[] excepted = {}; + +@@ -145,7 +145,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariable2Four() throws Exception { ++ void inputFinalLocalVariable2Four() throws Exception { + + final String[] excepted = {}; + +@@ -153,7 +153,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputFinalLocalVariable2Five() throws Exception { ++ void inputFinalLocalVariable2Five() throws Exception { + + final String[] excepted = {}; + +@@ -161,21 +161,21 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25025,7 +22169,7 @@ final String[] expected = { "16:20: " + getCheckMessage(MSG_KEY, "a"), "23:13: " + getCheckMessage(MSG_KEY, "x"), -@@ -131,7 +131,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -190,7 +190,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25034,7 +22178,7 @@ final String[] expected = { "23:13: " + getCheckMessage(MSG_KEY, "x"), "29:66: " + getCheckMessage(MSG_KEY, "snippets"), -@@ -143,7 +143,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -202,7 +202,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25043,7 +22187,7 @@ final String[] expected = { "40:16: " + getCheckMessage(MSG_KEY, "result"), }; -@@ -151,7 +151,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -210,7 +210,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25052,7 +22196,7 @@ final String[] expected = { "12:28: " + getCheckMessage(MSG_KEY, "text"), "25:13: " + getCheckMessage(MSG_KEY, "x"), -@@ -160,7 +160,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -219,7 +219,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25061,7 +22205,7 @@ final FinalLocalVariableCheck check = new FinalLocalVariableCheck(); final DetailAstImpl lambdaAst = new DetailAstImpl(); -@@ -175,7 +175,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -234,7 +234,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25070,7 +22214,7 @@ final String[] expected = { "57:13: " + getCheckMessage(MSG_KEY, "i"), -@@ -190,7 +190,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -249,7 +249,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25079,7 +22223,7 @@ final String[] expected = { "39:13: " + getCheckMessage(MSG_KEY, "b"), }; -@@ -199,7 +199,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -258,7 +258,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25088,7 +22232,7 @@ final String[] expected = { "352:16: " + getCheckMessage(MSG_KEY, "c2"), "2195:16: " + getCheckMessage(MSG_KEY, "b"), }; -@@ -207,27 +207,27 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -266,27 +266,27 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25120,7 +22264,7 @@ final String[] expected = { "15:19: " + getCheckMessage(MSG_KEY, "e"), }; -@@ -235,7 +235,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -294,7 +294,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25129,7 +22273,7 @@ final String[] expected = { "13:16: " + getCheckMessage(MSG_KEY, "testSupport"), }; -@@ -243,14 +243,14 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -302,14 +302,14 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25146,7 +22290,7 @@ final String[] expected = { "15:19: " + getCheckMessage(MSG_KEY, "e"), "53:19: " + getCheckMessage(MSG_KEY, "e"), -@@ -262,7 +262,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -321,7 +321,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25155,7 +22299,7 @@ final String[] expected = { "21:13: " + getCheckMessage(MSG_KEY, "a"), "44:13: " + getCheckMessage(MSG_KEY, "b"), -@@ -275,13 +275,13 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -334,13 +334,13 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25171,7 +22315,7 @@ final String[] expected = { "14:44: " + getCheckMessage(MSG_KEY, "a"), "18:44: " + getCheckMessage(MSG_KEY, "a"), -@@ -293,7 +293,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { +@@ -352,7 +352,7 @@ public class FinalLocalVariableCheckTest extends AbstractModuleTestSupport { } @Test @@ -25333,7 +22477,25 @@ final String[] expected = { "23:26: " + getCheckMessage(MSG_KEY, "a"), -@@ -452,7 +452,7 @@ public class HiddenFieldCheckTest extends AbstractModuleTestSupport { +@@ -446,7 +446,7 @@ public class HiddenFieldCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testHiddenFieldInnerRecordsImplicitlyStatic() throws Exception { ++ void hiddenFieldInnerRecordsImplicitlyStatic() throws Exception { + + final String[] expected = { + "35:30: " + getCheckMessage(MSG_KEY, "pointer"), +@@ -457,7 +457,7 @@ public class HiddenFieldCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testHiddenFieldRecordsImplicitlyStaticClassComparison() throws Exception { ++ void hiddenFieldRecordsImplicitlyStaticClassComparison() throws Exception { + + final String[] expected = { + "49:27: " + getCheckMessage(MSG_KEY, "x"), +@@ -475,7 +475,7 @@ public class HiddenFieldCheckTest extends AbstractModuleTestSupport { * @throws Exception when code tested throws exception */ @Test @@ -25342,7 +22504,7 @@ final HiddenFieldCheck check = new HiddenFieldCheck(); final DetailAST root = JavaParser.parseFile( -@@ -464,7 +464,7 @@ public class HiddenFieldCheckTest extends AbstractModuleTestSupport { +@@ -487,7 +487,7 @@ public class HiddenFieldCheckTest extends AbstractModuleTestSupport { assertWithMessage("State is not cleared on beginTree") .that( TestUtil.isStatefulFieldClearedDuringBeginTree( @@ -25998,7 +23160,7 @@ + void starImports() throws Exception { final String[] expected = { - "25:5: " + getCheckMessage(MSG_KEY, "List"), + "24:5: " + getCheckMessage(MSG_KEY, "List"), @@ -237,7 +237,7 @@ public class IllegalTypeCheckTest extends AbstractModuleTestSupport { } @@ -26736,7 +23898,15 @@ final String[] expected = { "14:9: " + getCheckMessage(MSG_KEY, "default"), }; -@@ -68,7 +68,7 @@ public class MissingSwitchDefaultCheckTest extends AbstractModuleTestSupport { +@@ -68,14 +68,14 @@ public class MissingSwitchDefaultCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testNullCaseLabel() throws Exception { ++ void nullCaseLabel() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser( + getNonCompilablePath("InputMissingSwitchDefaultCheckNullCaseLabel.java"), expected); } @Test @@ -26745,7 +23915,7 @@ final String[] expected = { "14:9: " + getCheckMessage(MSG_KEY, "default"), "26:9: " + getCheckMessage(MSG_KEY, "default"), -@@ -78,7 +78,7 @@ public class MissingSwitchDefaultCheckTest extends AbstractModuleTestSupport { +@@ -85,7 +85,7 @@ public class MissingSwitchDefaultCheckTest extends AbstractModuleTestSupport { } @Test @@ -26754,7 +23924,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( getNonCompilablePath("InputMissingSwitchDefaultCheckSwitchExpressionsThree.java"), -@@ -86,7 +86,7 @@ public class MissingSwitchDefaultCheckTest extends AbstractModuleTestSupport { +@@ -93,7 +93,7 @@ public class MissingSwitchDefaultCheckTest extends AbstractModuleTestSupport { } @Test @@ -27193,12 +24363,30 @@ } @Test -- public void testDefault() throws Exception { -+ void testDefault() throws Exception { +- public void testDefaultOne() throws Exception { ++ void defaultOne() throws Exception { final String[] expected = { "23:12: " + getCheckMessage(MSG_KEY), "28:12: " + getCheckMessage(MSG_KEY), -@@ -62,7 +62,7 @@ public class NoEnumTrailingCommaCheckTest extends AbstractModuleTestSupport { +@@ -48,7 +48,7 @@ public class NoEnumTrailingCommaCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testDefaultTwo() throws Exception { ++ void defaultTwo() throws Exception { + final String[] expected = { + "20:55: " + getCheckMessage(MSG_KEY), + "24:14: " + getCheckMessage(MSG_KEY), +@@ -64,7 +64,7 @@ public class NoEnumTrailingCommaCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testDefaultThree() throws Exception { ++ void defaultThree() throws Exception { + final String[] expected = { + "13:21: " + getCheckMessage(MSG_KEY), + "33:10: " + getCheckMessage(MSG_KEY), +@@ -76,7 +76,7 @@ public class NoEnumTrailingCommaCheckTest extends AbstractModuleTestSupport { } @Test @@ -30627,9 +27815,9 @@ - public void testDefaultOperation() throws Exception { + void defaultOperation() throws Exception { final String[] expected = { - "12:54: " + getCheckMessage(MSG_KEY, "com.puppycrawl." + "tools.checkstyle.checks.imports.*"), - "14:15: " + getCheckMessage(MSG_KEY, "java.io.*"), -@@ -48,7 +48,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { + "12:15: " + getCheckMessage(MSG_KEY, "java.io.*"), + "13:17: " + getCheckMessage(MSG_KEY, "java.lang.*"), +@@ -47,7 +47,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { } @Test @@ -30637,8 +27825,8 @@ + void excludes() throws Exception { // allow the java.io/java.lang,javax.swing.WindowConstants star imports final String[] expected2 = { - "12:54: " + getCheckMessage(MSG_KEY, "com.puppycrawl." + "tools.checkstyle.checks.imports.*"), -@@ -58,7 +58,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { + "31:27: " + getCheckMessage(MSG_KEY, "java.io.File.*"), +@@ -56,7 +56,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { } @Test @@ -30646,8 +27834,8 @@ + void allowClassImports() throws Exception { // allow all class star imports final String[] expected2 = { - "30:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), -@@ -69,7 +69,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { + "28:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), +@@ -67,7 +67,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { } @Test @@ -30655,8 +27843,8 @@ + void allowStaticMemberImports() throws Exception { // allow all static star imports final String[] expected2 = { - "12:54: " + getCheckMessage(MSG_KEY, "com.puppycrawl." + "tools.checkstyle.checks.imports.*"), -@@ -80,7 +80,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { + "12:15: " + getCheckMessage(MSG_KEY, "java.io.*"), +@@ -77,7 +77,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { } @Test @@ -30665,7 +27853,7 @@ final AvoidStarImportCheck testCheckObject = new AvoidStarImportCheck(); final int[] actual = testCheckObject.getAcceptableTokens(); final int[] expected = {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT}; -@@ -88,7 +88,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { +@@ -85,7 +85,7 @@ public class AvoidStarImportCheckTest extends AbstractModuleTestSupport { } @Test @@ -30701,8 +27889,8 @@ - public void testDefaultOperation() throws Exception { + void defaultOperation() throws Exception { final String[] expected = { - "26:27: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"), - "28:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), + "24:27: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"), + "26:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), @@ -67,7 +67,7 @@ public class AvoidStaticImportCheckTest extends AbstractModuleTestSupport { } @@ -30711,7 +27899,7 @@ + void starExcludes() throws Exception { // allow the "java.io.File.*" AND "sun.net.ftpclient.FtpClient.*" star imports final String[] expected = { - "28:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), + "26:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), @@ -88,7 +88,7 @@ public class AvoidStaticImportCheckTest extends AbstractModuleTestSupport { } @@ -30720,7 +27908,7 @@ + void memberExcludes() throws Exception { // allow the java.io.File.listRoots and java.lang.Math.E member imports final String[] expected = { - "28:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), + "26:42: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"), @@ -110,7 +110,7 @@ public class AvoidStaticImportCheckTest extends AbstractModuleTestSupport { } @@ -30729,7 +27917,7 @@ + void bogusMemberExcludes() throws Exception { // should NOT mask anything final String[] expected = { - "28:27: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"), + "26:27: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"), @@ -134,7 +134,7 @@ public class AvoidStaticImportCheckTest extends AbstractModuleTestSupport { } @@ -30846,7 +28034,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), "19:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.List"), -@@ -167,7 +167,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -169,7 +169,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30855,7 +28043,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LEX, "java.util.*", "java.util.StringTokenizer"), "18:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.*"), -@@ -186,7 +186,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -188,7 +188,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30864,7 +28052,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LEX, "java.util.*", "java.util.StringTokenizer"), "18:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.*"), -@@ -205,7 +205,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -207,7 +207,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30873,7 +28061,7 @@ final String[] expected = { "16:1: " + getCheckMessage( -@@ -221,14 +221,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -223,14 +223,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30890,7 +28078,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, THIRD, "org.w3c.dom.Node"), }; -@@ -238,7 +238,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -240,7 +240,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30899,7 +28087,7 @@ final String[] expected = { "19:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), -@@ -261,7 +261,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -263,7 +263,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30908,7 +28096,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -269,7 +269,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -271,7 +271,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30917,7 +28105,7 @@ final String[] expected = { "23:1: " + getCheckMessage(MSG_ORDER, THIRD, SPECIAL, "com.google.common.collect.HashMultimap"), -@@ -280,7 +280,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -282,7 +282,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30926,7 +28114,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_LEX, "java.util.Map", "java.util.Map.Entry"), }; -@@ -289,7 +289,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -291,7 +291,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30935,7 +28123,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MSG_ORDER, THIRD, SPECIAL, "com.google.common.annotations.Beta"), }; -@@ -299,7 +299,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -301,7 +301,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30944,16 +28132,16 @@ final DefaultConfiguration checkConfig = createModuleConfig(CustomImportOrderCheck.class); checkConfig.addProperty("specialImportsRegExp", "com"); checkConfig.addProperty("separateLineBetweenGroups", "false"); -@@ -315,7 +315,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -317,7 +317,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test - public void testImportsContainingJava() throws Exception { + void importsContainingJava() throws Exception { final String[] expected = { - "17:1: " - + getCheckMessage( -@@ -328,7 +328,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { + "17:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.google.errorprone.annotations.*"), + }; +@@ -327,7 +327,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30962,7 +28150,7 @@ final CustomImportOrderCheck testCheckObject = new CustomImportOrderCheck(); final int[] actual = testCheckObject.getAcceptableTokens(); final int[] expected = { -@@ -341,7 +341,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -340,7 +340,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { @Test // UT uses Reflection to avoid removing null-validation from static method, // which is a candidate for utility method in the future @@ -30971,7 +28159,7 @@ final Class clazz = CustomImportOrderCheck.class; final Object t = clazz.getConstructor().newInstance(); final Method method = clazz.getDeclaredMethod("getFullImportIdent", DetailAST.class); -@@ -353,7 +353,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -352,7 +352,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30980,7 +28168,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.*"), "21:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.List"), -@@ -373,7 +373,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -372,7 +372,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30989,7 +28177,7 @@ final String[] expected = { "23:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.*"), "24:1: " -@@ -388,7 +388,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -387,7 +387,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -30998,7 +28186,7 @@ final String[] expected = { "25:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.locks.LockSupport"), -@@ -399,7 +399,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -398,7 +398,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31007,7 +28195,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -407,7 +407,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -406,7 +406,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31016,7 +28204,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -432,7 +432,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -431,7 +431,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31025,7 +28213,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -455,7 +455,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -454,7 +454,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31034,7 +28222,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -477,7 +477,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -476,7 +476,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31043,7 +28231,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -499,14 +499,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -498,14 +498,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31059,8 +28247,8 @@ + void defaultConfiguration() throws Exception { final String[] expected = { "20:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.awt.Button"), - "32:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "com.puppycrawl.tools.checkstyle.*"), -@@ -516,7 +516,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { + "32:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.io.*"), +@@ -515,7 +515,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31069,7 +28257,7 @@ final String[] expected = { "23:1: " + getCheckMessage( -@@ -559,28 +559,28 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -558,28 +558,28 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31102,7 +28290,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "org.junit.Test"), }; -@@ -589,7 +589,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -588,7 +588,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31111,7 +28299,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.*"), "19:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.HashMap"), -@@ -601,7 +601,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -600,7 +600,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31120,7 +28308,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.sun.accessibility.internal.resources.*"), "22:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Arrays"), -@@ -614,7 +614,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -613,7 +613,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31129,7 +28317,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), "25:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "org.apache.*"), -@@ -625,7 +625,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -624,7 +624,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31138,7 +28326,7 @@ final String[] expected = { "14:112: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), "15:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.google.common.annotations.Beta"), -@@ -636,7 +636,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -635,7 +635,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31147,7 +28335,7 @@ final String[] expected = { "14:118: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), }; -@@ -645,7 +645,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -644,7 +644,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31156,7 +28344,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "javax.swing.WindowConstants.*"), "24:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.awt.Button"), -@@ -664,7 +664,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -663,7 +663,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31165,7 +28353,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STATIC, "java.util.Collections.*"), "18:1: " -@@ -678,7 +678,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -677,7 +677,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31174,7 +28362,7 @@ final String[] expected = { "30:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.BitSet"), "45:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.HashSet"), -@@ -691,7 +691,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -690,7 +690,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31183,7 +28371,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "java.awt.Button"), "23:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "java.awt.Dialog"), -@@ -707,7 +707,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -706,7 +706,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31248,8 +28436,8 @@ - public void testWithSupplied() throws Exception { + void withSupplied() throws Exception { final String[] expected = { - "14:1: " + getCheckMessage(MSG_KEY, "java.io.*"), - "28:1: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"), + "12:1: " + getCheckMessage(MSG_KEY, "java.io.*"), + "26:1: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"), @@ -53,13 +53,13 @@ public class IllegalImportCheckTest extends AbstractModuleTestSupport { } @@ -31282,8 +28470,8 @@ - public void testIllegalClasses() throws Exception { + void illegalClasses() throws Exception { final String[] expected = { - "16:1: " + getCheckMessage(MSG_KEY, "java.sql.Connection"), - "20:1: " + getCheckMessage(MSG_KEY, "org.junit.jupiter.api.*"), + "14:1: " + getCheckMessage(MSG_KEY, "java.sql.Connection"), + "18:1: " + getCheckMessage(MSG_KEY, "org.junit.jupiter.api.*"), @@ -86,7 +86,7 @@ public class IllegalImportCheckTest extends AbstractModuleTestSupport { } @@ -31291,8 +28479,8 @@ - public void testIllegalClassesStarImport() throws Exception { + void illegalClassesStarImport() throws Exception { final String[] expected = { - "14:1: " + getCheckMessage(MSG_KEY, "java.io.*"), - "20:1: " + getCheckMessage(MSG_KEY, "org.junit.jupiter.api.*"), + "12:1: " + getCheckMessage(MSG_KEY, "java.io.*"), + "18:1: " + getCheckMessage(MSG_KEY, "org.junit.jupiter.api.*"), @@ -96,7 +96,7 @@ public class IllegalImportCheckTest extends AbstractModuleTestSupport { } @@ -31300,8 +28488,8 @@ - public void testIllegalPackagesRegularExpression() throws Exception { + void illegalPackagesRegularExpression() throws Exception { final String[] expected = { - "17:1: " + getCheckMessage(MSG_KEY, "java.util.List"), - "18:1: " + getCheckMessage(MSG_KEY, "java.util.List"), + "15:1: " + getCheckMessage(MSG_KEY, "java.util.List"), + "16:1: " + getCheckMessage(MSG_KEY, "java.util.List"), @@ -110,7 +110,7 @@ public class IllegalImportCheckTest extends AbstractModuleTestSupport { } @@ -31309,8 +28497,8 @@ - public void testIllegalClassesRegularExpression() throws Exception { + void illegalClassesRegularExpression() throws Exception { final String[] expected = { - "17:1: " + getCheckMessage(MSG_KEY, "java.util.List"), - "18:1: " + getCheckMessage(MSG_KEY, "java.util.List"), + "15:1: " + getCheckMessage(MSG_KEY, "java.util.List"), + "16:1: " + getCheckMessage(MSG_KEY, "java.util.List"), @@ -120,7 +120,7 @@ public class IllegalImportCheckTest extends AbstractModuleTestSupport { } @@ -31318,8 +28506,8 @@ - public void testIllegalPackagesAndClassesRegularExpression() throws Exception { + void illegalPackagesAndClassesRegularExpression() throws Exception { final String[] expected = { - "17:1: " + getCheckMessage(MSG_KEY, "java.util.List"), - "18:1: " + getCheckMessage(MSG_KEY, "java.util.List"), + "15:1: " + getCheckMessage(MSG_KEY, "java.util.List"), + "16:1: " + getCheckMessage(MSG_KEY, "java.util.List"), --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java @@ -39,7 +39,7 @@ import java.util.List; @@ -31644,7 +28832,15 @@ final String[] expected = { "11:1: " + getCheckMessage(MSG_DISALLOWED, "java.awt.Image"), }; -@@ -408,7 +408,7 @@ public class ImportControlCheckTest extends AbstractModuleTestSupport { +@@ -408,14 +408,14 @@ public class ImportControlCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testImportControlFileName2() throws Exception { ++ void importControlFileName2() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWithInlineConfigParser(getPath("InputImportControlTestRegexpInFile2.java"), expected); } @Test @@ -31954,7 +29150,7 @@ - public void testWildcard() throws Exception { + void wildcard() throws Exception { final String[] expected = { - "25:1: " + getCheckMessage(MSG_ORDERING, "javax.crypto.Cipher"), + "24:1: " + getCheckMessage(MSG_ORDERING, "javax.crypto.Cipher"), }; @@ -324,7 +324,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @@ -31963,9 +29159,9 @@ - public void testWildcardUnspecified() throws Exception { + void wildcardUnspecified() throws Exception { final String[] expected = { - "23:1: " - + getCheckMessage( -@@ -336,14 +336,14 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { + "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "javax.crypto.Cipher"), + }; +@@ -333,14 +333,14 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31982,7 +29178,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.antlr.v4.runtime.*"), "24:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), -@@ -353,7 +353,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -350,7 +350,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31991,7 +29187,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.antlr.v4.runtime.*"), "24:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), -@@ -362,7 +362,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -359,7 +359,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32000,7 +29196,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.lang.Math.PI"), -@@ -371,7 +371,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -368,7 +368,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32009,7 +29205,7 @@ final String[] expected = { "24:1: " + getCheckMessage(MSG_ORDERING, "java.util.Set"), }; -@@ -383,7 +383,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -380,7 +380,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { * Tests that a non-static import after a static import correctly gives an error if order=bottom. */ @Test @@ -32018,7 +29214,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_ORDERING, "java.lang.Math.PI"), }; -@@ -395,7 +395,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -392,7 +392,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { * Tests that a non-static import before a static import correctly gives an error if order=top. */ @Test @@ -32027,7 +29223,7 @@ final String[] expected = { "24:1: " + getCheckMessage(MSG_ORDERING, "java.util.Set"), }; -@@ -404,7 +404,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -401,7 +401,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32036,7 +29232,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.lang.Math.PI"), -@@ -413,19 +413,19 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -410,19 +410,19 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32059,7 +29255,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MSG_SEPARATION, "org.antlr.v4.runtime.CommonToken.*"), "23:1: " + getCheckMessage(MSG_ORDERING, "java.util.Set"), -@@ -434,7 +434,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -431,7 +431,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32068,7 +29264,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.lang.Math.PI"), -@@ -445,7 +445,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -442,7 +442,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32077,7 +29273,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.antlr.v4.runtime.*"), "24:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), -@@ -456,7 +456,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -453,7 +453,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32086,7 +29282,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.antlr.v4.runtime.*"), "24:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), -@@ -467,7 +467,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -464,7 +464,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32095,7 +29291,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.lang.Math.*"), -@@ -477,7 +477,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -474,7 +474,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32104,7 +29300,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.lang.Math.*"), -@@ -487,7 +487,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -484,7 +484,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32113,7 +29309,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Set"), "23:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.lang.Math.*"), -@@ -499,7 +499,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -496,7 +496,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32122,7 +29318,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class); checkConfig.addProperty("groups", "/^javax"); -@@ -521,7 +521,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -518,7 +518,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32131,7 +29327,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_ORDERING, "java.awt.Dialog"), "23:1: " + getCheckMessage(MSG_ORDERING, "javax.swing.JComponent"), -@@ -530,7 +530,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -527,7 +527,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32140,7 +29336,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.*"), }; -@@ -546,7 +546,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -543,7 +543,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { * given, so there is no other way to cover this code. */ @Test @@ -32149,7 +29345,7 @@ // Create mock ast final DetailAstImpl astImport = mockAST(TokenTypes.IMPORT, "import", 0, 0); final DetailAstImpl astIdent = mockAST(TokenTypes.IDENT, "myTestImport", 0, 0); -@@ -587,7 +587,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -584,7 +584,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32158,7 +29354,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -595,14 +595,14 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -592,14 +592,14 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32175,7 +29371,7 @@ final String[] expected = { "28:1: " + getCheckMessage(MSG_SEPARATION, "javax.swing.JComponent"), "33:1: " + getCheckMessage(MSG_ORDERING, "org.junit.Test"), -@@ -613,14 +613,14 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -610,14 +610,14 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32192,7 +29388,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_ORDERING, "io.netty.handler.codec.http.HttpHeaders.Names.addDate"), -@@ -630,7 +630,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -627,7 +627,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32201,7 +29397,7 @@ final String[] expected = { "23:1: " + getCheckMessage(MSG_ORDERING, "io.netty.handler.codec.http.HttpHeaders.Names.DATE"), -@@ -640,7 +640,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -637,7 +637,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32210,7 +29406,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_ORDERING, "io.netty.handler.Codec.HTTP.HttpHeaders.tmp.same"), "23:1: " + getCheckMessage(MSG_ORDERING, "io.netty.handler.Codec.HTTP.HttpHeaders.TKN.same"), -@@ -650,7 +650,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -647,7 +647,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32219,7 +29415,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "org.*"), }; -@@ -659,7 +659,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -656,7 +656,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32228,7 +29424,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -667,7 +667,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -664,7 +664,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32237,7 +29433,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -675,7 +675,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -672,7 +672,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32246,7 +29442,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -683,7 +683,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -680,7 +680,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32255,7 +29451,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -691,7 +691,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -688,7 +688,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32264,7 +29460,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_ORDERING, "org.junit.Assert.fail"), "23:1: " + getCheckMessage(MSG_ORDERING, "org.infinispan.test.TestingUtil.extract"), -@@ -702,7 +702,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -699,7 +699,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32273,7 +29469,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -710,7 +710,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -707,7 +707,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32282,7 +29478,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -718,7 +718,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -715,7 +715,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32291,7 +29487,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -726,7 +726,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -723,7 +723,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32300,7 +29496,7 @@ final String[] expected = { "25:1: " + getCheckMessage(MSG_ORDERING, "java.util.Set"), }; -@@ -742,7 +742,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -739,7 +739,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { * @throws Exception when code tested throws exception */ @Test @@ -32309,7 +29505,7 @@ final ImportOrderCheck check = new ImportOrderCheck(); final DetailAST root = JavaParser.parseFile( -@@ -756,7 +756,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -753,7 +753,7 @@ public class ImportOrderCheckTest extends AbstractModuleTestSupport { .that( TestUtil.isStatefulFieldClearedDuringBeginTree( check, @@ -32640,8 +29836,8 @@ + void withoutProcessJavadoc() throws Exception { final String[] expected = { "11:8: " - + getCheckMessage( -@@ -111,7 +112,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { + + getCheckMessage(MSG_KEY, "com.google.errorprone.annotations." + "concurrent.GuardedBy"), +@@ -106,7 +107,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32649,8 +29845,8 @@ + void processJavadoc() throws Exception { final String[] expected = { "11:8: " - + getCheckMessage( -@@ -133,27 +134,27 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { + + getCheckMessage(MSG_KEY, "com.google.errorprone.annotations." + "concurrent.GuardedBy"), +@@ -125,27 +126,27 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32682,7 +29878,7 @@ final String[] expected = { "13:8: " + getCheckMessage(MSG_KEY, "java.util.ArrayList"), }; -@@ -161,20 +162,20 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -153,20 +154,20 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32706,7 +29902,7 @@ final UnusedImportsCheck testCheckObject = new UnusedImportsCheck(); final int[] actual = testCheckObject.getRequiredTokens(); final int[] expected = { -@@ -202,7 +203,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -194,7 +195,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32715,7 +29911,7 @@ final UnusedImportsCheck testCheckObject = new UnusedImportsCheck(); final int[] actual = testCheckObject.getAcceptableTokens(); final int[] expected = { -@@ -230,7 +231,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -222,7 +223,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32724,7 +29920,7 @@ final String[] expected = { "12:8: " + getCheckMessage(MSG_KEY, "java.util.Arrays"), "13:8: " + getCheckMessage(MSG_KEY, "java.lang.String"), -@@ -240,7 +241,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -232,7 +233,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32733,7 +29929,7 @@ final String[] expected = { "10:8: " + getCheckMessage(MSG_KEY, "java.lang.String"), "11:8: " + getCheckMessage(MSG_KEY, "java.lang.Math"), -@@ -258,7 +259,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -250,7 +251,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32742,7 +29938,7 @@ final String[] expected = { "11:8: " + getCheckMessage(MSG_KEY, "java.util.List"), }; -@@ -266,7 +267,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -258,7 +259,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32751,7 +29947,7 @@ final String[] expected = { "10:8: " + getCheckMessage(MSG_KEY, "module"), }; -@@ -275,7 +276,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -267,7 +268,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32760,7 +29956,7 @@ final String[] expected = { "19:8: " + getCheckMessage(MSG_KEY, "javax.swing.JToolBar"), "20:8: " + getCheckMessage(MSG_KEY, "javax.swing.JToggleButton"), -@@ -285,7 +286,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -277,7 +278,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32769,7 +29965,7 @@ final String[] expected = { "12:8: " + getCheckMessage(MSG_KEY, "java.util.Map"), "13:8: " + getCheckMessage(MSG_KEY, "java.util.Set"), -@@ -299,7 +300,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -291,7 +292,7 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -32778,7 +29974,7 @@ final String[] expected = { "11:8: " + getCheckMessage(MSG_KEY, "java.awt.Rectangle"), "13:8: " + getCheckMessage(MSG_KEY, "java.awt.event.KeyEvent"), -@@ -308,14 +309,15 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { +@@ -300,14 +301,15 @@ public class UnusedImportsCheckTest extends AbstractModuleTestSupport { } @Test @@ -33443,7 +30639,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("basicOffset", "4"); -@@ -1120,7 +1118,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1131,7 +1129,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33452,7 +30648,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1137,7 +1135,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1148,7 +1146,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33461,7 +30657,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "8"); -@@ -1154,7 +1152,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1165,7 +1163,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33470,7 +30666,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "2"); -@@ -1171,7 +1169,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1182,7 +1180,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33479,7 +30675,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "2"); -@@ -1201,7 +1199,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1212,7 +1210,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33488,7 +30684,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "2"); -@@ -1218,7 +1216,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1229,7 +1227,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33497,7 +30693,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1280,7 +1278,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1291,7 +1289,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33506,7 +30702,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "2"); -@@ -1304,7 +1302,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1315,7 +1313,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33515,7 +30711,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "2"); -@@ -1326,7 +1324,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1337,7 +1335,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33524,7 +30720,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1388,7 +1386,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1399,7 +1397,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33533,7 +30729,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1405,7 +1403,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1416,7 +1414,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33542,7 +30738,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1451,7 +1449,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1462,7 +1460,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33551,7 +30747,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1503,7 +1501,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1514,7 +1512,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33560,7 +30756,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1567,7 +1565,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1578,7 +1576,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33569,7 +30765,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1659,7 +1657,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1670,7 +1668,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33578,7 +30774,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1705,7 +1703,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1716,7 +1714,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33587,7 +30783,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1722,7 +1720,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1733,7 +1731,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33596,7 +30792,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1770,7 +1768,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1781,7 +1779,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33605,7 +30801,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1787,7 +1785,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1798,7 +1796,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33614,7 +30810,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1804,7 +1802,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1815,7 +1813,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33623,7 +30819,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1839,7 +1837,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1850,7 +1848,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33632,7 +30828,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1856,7 +1854,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1867,7 +1865,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33641,7 +30837,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1873,7 +1871,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1884,7 +1882,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33650,7 +30846,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1893,7 +1891,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1904,7 +1902,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33659,7 +30855,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1910,7 +1908,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1921,7 +1919,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33668,7 +30864,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1927,7 +1925,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1938,7 +1936,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33677,7 +30873,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1945,7 +1943,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1956,7 +1954,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33686,7 +30882,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1963,7 +1961,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1974,7 +1972,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33695,7 +30891,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -1979,7 +1977,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -1990,7 +1988,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33704,7 +30900,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("basicOffset", "1"); -@@ -2006,7 +2004,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2017,7 +2015,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33713,7 +30909,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2024,7 +2022,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2035,7 +2033,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33722,7 +30918,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2046,7 +2044,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2057,7 +2055,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33731,7 +30927,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2067,7 +2065,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2078,7 +2076,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33740,7 +30936,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("basicOffset", "8"); checkConfig.addProperty("tabWidth", "4"); -@@ -2079,7 +2077,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2090,7 +2088,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33749,7 +30945,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2095,7 +2093,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2106,7 +2104,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33758,7 +30954,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2111,7 +2109,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2122,7 +2120,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33767,7 +30963,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2127,7 +2125,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2138,7 +2136,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33776,7 +30972,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2143,7 +2141,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2154,7 +2152,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33785,7 +30981,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2161,7 +2159,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2172,7 +2170,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33794,7 +30990,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2176,7 +2174,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2187,7 +2185,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33803,7 +30999,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "8"); checkConfig.addProperty("basicOffset", "2"); -@@ -2197,7 +2195,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2208,7 +2206,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33812,7 +31008,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2222,7 +2220,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2233,7 +2231,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33821,7 +31017,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -2230,7 +2228,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2241,7 +2239,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33830,7 +31026,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2240,7 +2238,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2251,7 +2249,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33839,7 +31035,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2250,7 +2248,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2261,7 +2259,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33848,7 +31044,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -2258,7 +2256,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2269,7 +2267,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33857,7 +31053,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2269,7 +2267,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2280,7 +2278,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33866,7 +31062,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "2"); checkConfig.addProperty("basicOffset", "2"); -@@ -2289,7 +2287,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2300,7 +2298,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33875,7 +31071,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2299,7 +2297,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2310,7 +2308,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33884,7 +31080,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2316,7 +2314,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2327,7 +2325,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33893,7 +31089,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2326,7 +2324,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2337,7 +2335,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33902,7 +31098,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "3"); checkConfig.addProperty("basicOffset", "3"); -@@ -2337,7 +2335,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2348,7 +2346,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33911,7 +31107,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2356,7 +2354,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2367,7 +2365,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33920,7 +31116,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2385,7 +2383,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2396,7 +2394,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33929,7 +31125,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "3"); -@@ -2398,7 +2396,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2409,7 +2407,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33938,7 +31134,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String fileName = getPath("InputIndentationSeparatedStatements.java"); -@@ -2407,7 +2405,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2418,7 +2416,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33947,7 +31143,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String fileName = getPath("InputIndentationSeparatedStatementWithSpaces.java"); -@@ -2416,7 +2414,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2427,7 +2425,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33956,7 +31152,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2426,7 +2424,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2437,7 +2435,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33965,7 +31161,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2436,7 +2434,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2447,7 +2445,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33974,7 +31170,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2448,7 +2446,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2459,7 +2457,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33983,7 +31179,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "2"); -@@ -2464,7 +2462,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2475,7 +2473,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33992,7 +31188,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2480,7 +2478,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2491,7 +2489,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34001,7 +31197,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2494,7 +2492,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2505,7 +2503,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34010,7 +31206,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("arrayInitIndent", "4"); -@@ -2539,7 +2537,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2550,7 +2548,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34019,7 +31215,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("forceStrictCondition", "true"); -@@ -2574,7 +2572,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2585,7 +2583,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34028,7 +31224,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("braceAdjustment", "0"); -@@ -2613,7 +2611,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2624,7 +2622,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { * @see IndentComment#getExpectedMessagePostfix(String) */ @Test @@ -34037,7 +31233,7 @@ final Object[] arguments = {"##0##", "##1##", "##2##"}; final String[] messages = { getCheckMessage(MSG_ERROR, arguments), -@@ -2640,7 +2638,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2651,7 +2649,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34046,7 +31242,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -2648,7 +2646,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2659,7 +2657,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34055,7 +31251,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2661,7 +2659,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2673,7 +2671,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34064,7 +31260,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("braceAdjustment", "0"); -@@ -2672,7 +2670,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2684,7 +2682,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34073,7 +31269,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("braceAdjustment", "0"); -@@ -2686,7 +2684,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2698,7 +2696,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34082,7 +31278,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("arrayInitIndent", "2"); -@@ -2710,7 +2708,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2722,7 +2720,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34091,7 +31287,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2734,7 +2732,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2746,7 +2744,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34100,7 +31296,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2750,7 +2748,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2762,7 +2760,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34109,7 +31305,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -2761,7 +2759,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2773,7 +2771,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34118,7 +31314,16 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("caseIndent", "4"); -@@ -2783,7 +2781,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2795,7 +2793,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testIndentationSwitchExpressionDeclarationLeftCurlyNewLine() throws Exception { ++ void indentationSwitchExpressionDeclarationLeftCurlyNewLine() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); + checkConfig.addProperty("tabWidth", "4"); + final String[] expected = { +@@ -2811,7 +2809,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34127,7 +31332,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2800,7 +2798,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2828,7 +2826,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34136,7 +31341,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2817,7 +2815,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2845,7 +2843,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34145,7 +31350,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2832,7 +2830,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2860,7 +2858,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34154,7 +31359,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2844,7 +2842,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2872,7 +2870,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34163,7 +31368,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); final String[] expected = { -@@ -2857,7 +2855,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2885,7 +2883,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34172,7 +31377,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2896,7 +2894,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2924,7 +2922,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34181,7 +31386,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); checkConfig.addProperty("basicOffset", "4"); -@@ -2916,7 +2914,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2944,7 +2942,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34190,7 +31395,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addProperty("tabWidth", "4"); -@@ -2926,7 +2924,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { +@@ -2954,7 +2952,7 @@ public class IndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34201,19 +31406,16 @@ --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheckTest.java -@@ -26,9 +26,9 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocChec +@@ -26,7 +26,7 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocChec import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck.MSG_JAVADOC_WRONG_SINGLETON_TAG; + import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck.MSG_TAG_FORMAT; import static com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck.MSG_SUMMARY_FIRST_SENTENCE; - import static java.util.Arrays.asList; --import static java.util.Collections.singletonList; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.assertj.core.api.Assertions.assertThatCode; -+import com.google.common.collect.ImmutableList; import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; - import com.puppycrawl.tools.checkstyle.api.DetailNode; -@@ -48,7 +48,7 @@ import org.junit.jupiter.api.extension.ExtendWith; +@@ -44,7 +44,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.io.TempDir; @ExtendWith(SystemErrGuard.class) @@ -34222,7 +31424,7 @@ @TempDir public File temporaryFolder; -@@ -67,12 +67,12 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -63,12 +63,12 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { * @param systemErr wrapper for {@code System.err} */ @BeforeEach @@ -34234,36 +31436,35 @@ @Test - public void testJavadocTagsWithoutArgs() throws Exception { + void javadocTagsWithoutArgs() throws Exception { - final DefaultConfiguration checkconfig = createModuleConfig(TempCheck.class); final String[] expected = { - "14: " -@@ -113,7 +113,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "16: " + + getCheckMessage( +@@ -109,7 +109,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testNumberFormatException() throws Exception { + void numberFormatException() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = { - "7: " -@@ -127,14 +127,14 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "8: " + + getCheckMessage( +@@ -123,13 +123,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testCustomTag() throws Exception { + void customTag() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verify(checkConfig, getPath("InputAbstractJavadocCustomTag.java"), expected); + verifyWithInlineConfigParser(getPath("InputAbstractJavadocCustomTag.java"), expected); } @Test - public void testParsingErrors(@SysErr Capturable systemErr) throws Exception { + void parsingErrors(@SysErr Capturable systemErr) throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = { - "8: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), -@@ -145,13 +145,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "9: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), + "16: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 35, "img"), +@@ -139,13 +139,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34276,10 +31477,10 @@ @Test - public void testAntlrError(@SysErr Capturable systemErr) throws Exception { + void antlrError(@SysErr Capturable systemErr) throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = { - "8: " -@@ -163,8 +163,8 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "9: " + + getCheckMessage( +@@ -157,8 +157,8 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34287,55 +31488,55 @@ - @SysErr Capturable systemErr) throws Exception { + void checkReuseAfterParseErrorWithFollowingAntlrErrorInTwoFiles(@SysErr Capturable systemErr) + throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); - final Map> expectedMessages = new LinkedHashMap<>(2); - expectedMessages.put( -@@ -174,7 +174,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { - "13: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 35, "img"))); - expectedMessages.put( - getPath("InputAbstractJavadocInvalidAtSeeReference2.java"), -- singletonList( -+ ImmutableList.of( - "8: " - + getCheckMessage( - MSG_JAVADOC_PARSE_RULE_ERROR, -@@ -192,7 +192,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + final String[] expectedMessagesForFile1 = { + "9: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), + "16: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 35, "img"), +@@ -178,7 +178,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testCheckReuseAfterParseErrorWithFollowingAntlrErrorInSingleFile() throws Exception { + void checkReuseAfterParseErrorWithFollowingAntlrErrorInSingleFile() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = { - "8: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), -@@ -207,7 +207,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "9: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), + "16: " +@@ -190,7 +190,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCache() throws Exception { ++ void cache() throws Exception { + final String[] expected = { + "12: " + getCheckMessage(SummaryJavadocCheck.class, MSG_SUMMARY_FIRST_SENTENCE), + }; +@@ -201,7 +201,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testPosition() throws Exception { + void position() throws Exception { JavadocCatchCheck.clearCounter(); - final DefaultConfiguration checkConfig = createModuleConfig(JavadocCatchCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -218,7 +218,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser(getPath("InputAbstractJavadocPosition.java"), expected); +@@ -213,7 +213,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testPositionWithSinglelineComments() throws Exception { + void positionWithSinglelineComments() throws Exception { JavadocCatchCheck.clearCounter(); - final DefaultConfiguration checkConfig = createModuleConfig(JavadocCatchCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -230,7 +230,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser( +@@ -226,7 +226,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testPositionOnlyComments() throws Exception { + void positionOnlyComments() throws Exception { JavadocCatchCheck.clearCounter(); - final DefaultConfiguration checkConfig = createModuleConfig(JavadocCatchCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -241,7 +241,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser( +@@ -237,7 +237,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34344,7 +31545,7 @@ final int[] defaultJavadocTokens = {JavadocTokenTypes.JAVADOC}; final AbstractJavadocCheck check = new AbstractJavadocCheck() { -@@ -277,7 +277,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -273,7 +273,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34353,7 +31554,7 @@ final int[] defaultJavadocTokens = { JavadocTokenTypes.JAVADOC, JavadocTokenTypes.AREA_HTML_TAG_NAME, -@@ -299,11 +299,11 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -295,11 +295,11 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } }; check.setJavadocTokens("RETURN_LITERAL"); @@ -34364,19 +31565,17 @@ @Test - public void testAcceptableTokensFail() throws Exception { + void acceptableTokensFail() throws Exception { - final DefaultConfiguration checkConfig = - createModuleConfig(TokenIsNotInAcceptablesJavadocCheck.class); - checkConfig.addProperty("javadocTokens", "RETURN_LITERAL"); -@@ -325,7 +325,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + final String path = getPath("InputAbstractJavadocTokensFail.java"); + try { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; +@@ -318,13 +318,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testAcceptableTokensPass() throws Exception { + void acceptableTokensPass() throws Exception { - final DefaultConfiguration checkConfig = - createModuleConfig(TokenIsNotInAcceptablesJavadocCheck.class); - checkConfig.addProperty("javadocTokens", "DEPRECATED_LITERAL"); -@@ -335,7 +335,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputAbstractJavadocTokensPass.java"), expected); } @Test @@ -34385,69 +31584,77 @@ final DefaultConfiguration checkConfig = createModuleConfig(RequiredTokenIsNotInDefaultsJavadocCheck.class); final String pathToEmptyFile = File.createTempFile("empty", ".java", temporaryFolder).getPath(); -@@ -357,7 +357,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -346,7 +346,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testVisitLeaveToken() throws Exception { + void visitLeaveToken() throws Exception { JavadocVisitLeaveCheck.clearCounter(); - final DefaultConfiguration checkConfig = createModuleConfig(JavadocVisitLeaveCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -371,7 +371,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser(getPath("InputAbstractJavadocLeaveToken.java"), expected); +@@ -359,7 +359,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testNoWsBeforeDescriptionInJavadocTags() throws Exception { + void noWsBeforeDescriptionInJavadocTags() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = { - "17: " -@@ -424,7 +424,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "18: " + + getCheckMessage( +@@ -409,7 +409,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testWrongSingletonTagInJavadoc() throws Exception { + void wrongSingletonTagInJavadoc() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(TempCheck.class); final String[] expected = { - "9: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 9, "embed"), -@@ -437,7 +437,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + "10: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 9, "embed"), + "17: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 9, "keygen"), +@@ -422,7 +422,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testNonTightHtmlTagIntolerantCheck() throws Exception { + void nonTightHtmlTagIntolerantCheck() throws Exception { - final DefaultConfiguration checkConfig = - createModuleConfig(NonTightHtmlTagIntolerantCheck.class); - checkConfig.addProperty("violateExecutionOnNonTightHtml", "true"); -@@ -457,7 +457,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + final String[] expected = { + "12: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), + "19: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), +@@ -439,14 +439,14 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testNonTightHtmlTagIntolerantCheckReportingNoViolation() throws Exception { + void nonTightHtmlTagIntolerantCheckReportingNoViolation() throws Exception { - final DefaultConfiguration checkConfig = - createModuleConfig(NonTightHtmlTagIntolerantCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -465,7 +465,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser( + getPath("InputAbstractJavadocNonTightHtmlTagsNoViolation.java"), expected); } @Test - public void testNonTightHtmlTagIntolerantCheckVisitCount() throws Exception { + void nonTightHtmlTagIntolerantCheckVisitCount() throws Exception { - final DefaultConfiguration checkConfig = - createModuleConfig(NonTightHtmlTagIntolerantCheck.class); - checkConfig.addProperty("violateExecutionOnNonTightHtml", "true"); -@@ -491,7 +491,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + final String[] expected = { + "13: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), + "20: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), +@@ -469,7 +469,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testVisitCountForCheckAcceptingJavadocWithNonTightHtml() throws Exception { + void visitCountForCheckAcceptingJavadocWithNonTightHtml() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(NonTightHtmlTagTolerantCheck.class); - checkConfig.addProperty("violateExecutionOnNonTightHtml", "true"); - checkConfig.addProperty("reportVisitJavadocToken", "true"); + final String[] expected = { + "11:4: " + getCheckMessage(NonTightHtmlTagCheck.MSG_KEY, "BODY_TAG_START"), + "12:4: " + getCheckMessage(NonTightHtmlTagCheck.MSG_KEY, "P_TAG_START"), +@@ -511,7 +511,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testVisitCountForCheckAcceptingJavadocWithNonTightHtml3() throws Exception { ++ void visitCountForCheckAcceptingJavadocWithNonTightHtml3() throws Exception { + final String[] expected = { + "29:8: " + getCheckMessage(NonTightHtmlTagCheck.MSG_KEY, "P_TAG_START"), + "36: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheckTest.java @@ -27,7 +27,7 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -35544,54 +32751,54 @@ - public void testJavadocStyleDefaultSettingsOne() throws Exception { + void javadocStyleDefaultSettingsOne() throws Exception { final String[] expected = { - "23: " + getCheckMessage(MSG_NO_PERIOD), - "48: " + getCheckMessage(MSG_NO_PERIOD), -@@ -88,7 +88,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "24: " + getCheckMessage(MSG_NO_PERIOD), + "50: " + getCheckMessage(MSG_NO_PERIOD), +@@ -84,7 +84,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleDefaultSettingsTwo() throws Exception { + void javadocStyleDefaultSettingsTwo() throws Exception { final String[] expected = { - "61:8: " + getCheckMessage(MSG_UNCLOSED_HTML, "
// violation"), - "66: " + getCheckMessage(MSG_NO_PERIOD), -@@ -99,7 +99,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "26:39: " + getCheckMessage(MSG_EXTRA_HTML, ""), + "72:8: " + getCheckMessage(MSG_UNCLOSED_HTML, "
"), +@@ -96,7 +96,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleDefaultSettingsThree() throws Exception { + void javadocStyleDefaultSettingsThree() throws Exception { final String[] expected = { - "103:21: " + getCheckMessage(MSG_EXTRA_HTML, " // violation"), + "109: " + getCheckMessage(MSG_NO_PERIOD), }; -@@ -108,7 +108,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -105,7 +105,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleDefaultSettingsFour() throws Exception { + void javadocStyleDefaultSettingsFour() throws Exception { final String[] expected = { - "29:33: " + getCheckMessage(MSG_UNCLOSED_HTML, " // violation"), - "40: " + getCheckMessage(MSG_NO_PERIOD), -@@ -126,7 +126,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "30:33: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), + "42: " + getCheckMessage(MSG_NO_PERIOD), +@@ -121,7 +121,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleFirstSentenceOne() throws Exception { + void javadocStyleFirstSentenceOne() throws Exception { final String[] expected = { - "23: " + getCheckMessage(MSG_NO_PERIOD), - "48: " + getCheckMessage(MSG_NO_PERIOD), -@@ -139,7 +139,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "24: " + getCheckMessage(MSG_NO_PERIOD), + "50: " + getCheckMessage(MSG_NO_PERIOD), +@@ -134,7 +134,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleFirstSentenceTwo() throws Exception { + void javadocStyleFirstSentenceTwo() throws Exception { final String[] expected = { - "66: " + getCheckMessage(MSG_NO_PERIOD), "99: " + getCheckMessage(MSG_NO_PERIOD), + "67: " + getCheckMessage(MSG_NO_PERIOD), "101: " + getCheckMessage(MSG_NO_PERIOD), }; -@@ -148,14 +148,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -143,14 +143,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35607,26 +32814,26 @@ + void javadocStyleFirstSentenceFour() throws Exception { final String[] expected = { "40: " + getCheckMessage(MSG_NO_PERIOD), - "50: " + getCheckMessage(MSG_NO_PERIOD), -@@ -169,7 +169,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "51: " + getCheckMessage(MSG_NO_PERIOD), +@@ -164,7 +164,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleFirstSentenceFormatOne() throws Exception { + void javadocStyleFirstSentenceFormatOne() throws Exception { final String[] expected = { - "23: " + getCheckMessage(MSG_NO_PERIOD), - "33: " + getCheckMessage(MSG_NO_PERIOD), -@@ -184,7 +184,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "24: " + getCheckMessage(MSG_NO_PERIOD), + "35: " + getCheckMessage(MSG_NO_PERIOD), +@@ -179,7 +179,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleFirstSentenceFormatTwo() throws Exception { + void javadocStyleFirstSentenceFormatTwo() throws Exception { final String[] expected = { - "66: " + getCheckMessage(MSG_NO_PERIOD), "99: " + getCheckMessage(MSG_NO_PERIOD), + "74: " + getCheckMessage(MSG_NO_PERIOD), "108: " + getCheckMessage(MSG_NO_PERIOD), }; -@@ -193,7 +193,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -188,7 +188,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35635,7 +32842,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -201,7 +201,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -196,7 +196,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35643,44 +32850,44 @@ + void javadocStyleFirstSentenceFormatFour() throws Exception { final String[] expected = { "40: " + getCheckMessage(MSG_NO_PERIOD), - "50: " + getCheckMessage(MSG_NO_PERIOD), -@@ -216,7 +216,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "51: " + getCheckMessage(MSG_NO_PERIOD), +@@ -211,7 +211,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testHtml1() throws Exception { + void html1() throws Exception { final String[] expected = { - "55:11: " - + getCheckMessage( -@@ -236,7 +236,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "59:11: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), + "62:7: " + getCheckMessage(MSG_EXTRA_HTML, ""), +@@ -228,7 +228,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testHtml2() throws Exception { + void html2() throws Exception { final String[] expected = { - "67:8: " + getCheckMessage(MSG_UNCLOSED_HTML, "
// violation"), + "68:8: " + getCheckMessage(MSG_UNCLOSED_HTML, "
"), }; -@@ -245,7 +245,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -237,7 +237,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testHtml3() throws Exception { + void html3() throws Exception { final String[] expected = { - "102:21: " + getCheckMessage(MSG_EXTRA_HTML, " // violation"), + "103:21: " + getCheckMessage(MSG_EXTRA_HTML, ""), }; -@@ -254,7 +254,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -246,7 +246,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testHtml4() throws Exception { + void html4() throws Exception { final String[] expected = { - "28:33: " + getCheckMessage(MSG_UNCLOSED_HTML, " // violation"), - "45:11: " -@@ -266,28 +266,28 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "29:33: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), + "47:11: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), +@@ -256,28 +256,28 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35711,9 +32918,9 @@ - public void testScopePublic1() throws Exception { + void scopePublic1() throws Exception { final String[] expected = { - "75: " + getCheckMessage(MSG_NO_PERIOD), - "76:31: " + getCheckMessage(MSG_EXTRA_HTML, " // violation"), -@@ -297,7 +297,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "78: " + getCheckMessage(MSG_NO_PERIOD), + "79:31: " + getCheckMessage(MSG_EXTRA_HTML, ""), +@@ -288,7 +288,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35721,79 +32928,79 @@ + void scopePublic2() throws Exception { final String[] expected = { "83: " + getCheckMessage(MSG_EMPTY), - "101: " + getCheckMessage(MSG_EMPTY), -@@ -307,7 +307,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "102: " + getCheckMessage(MSG_EMPTY), +@@ -299,7 +299,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopePublic3() throws Exception { + void scopePublic3() throws Exception { final String[] expected = { - "103:21: " + getCheckMessage(MSG_EXTRA_HTML, " // violation"), + "104:21: " + getCheckMessage(MSG_EXTRA_HTML, ""), }; -@@ -315,7 +315,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -308,7 +308,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopePublic4() throws Exception { + void scopePublic4() throws Exception { final String[] expected = { - "50: " + getCheckMessage(MSG_NO_PERIOD), - "54: " + getCheckMessage(MSG_NO_PERIOD), -@@ -325,7 +325,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "51: " + getCheckMessage(MSG_NO_PERIOD), + "56: " + getCheckMessage(MSG_NO_PERIOD), +@@ -319,7 +319,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopeProtected1() throws Exception { + void scopeProtected1() throws Exception { final String[] expected = { - "65: " + getCheckMessage(MSG_NO_PERIOD), - "66:23: " + getCheckMessage(MSG_UNCLOSED_HTML, "should fail // violation"), -@@ -337,7 +337,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "67: " + getCheckMessage(MSG_NO_PERIOD), + "68:23: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), +@@ -332,7 +332,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopeProtected2() throws Exception { + void scopeProtected2() throws Exception { final String[] expected = { - "76: " + getCheckMessage(MSG_EMPTY), - "80: " + getCheckMessage(MSG_EMPTY), -@@ -348,7 +348,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "83: " + getCheckMessage(MSG_EMPTY), + "87: " + getCheckMessage(MSG_EMPTY), +@@ -344,7 +344,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopeProtected3() throws Exception { + void scopeProtected3() throws Exception { final String[] expected = { - "103:21: " + getCheckMessage(MSG_EXTRA_HTML, " // violation"), + "104:21: " + getCheckMessage(MSG_EXTRA_HTML, ""), }; -@@ -356,7 +356,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -353,7 +353,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopeProtected4() throws Exception { + void scopeProtected4() throws Exception { final String[] expected = { - "50: " + getCheckMessage(MSG_NO_PERIOD), - "54: " + getCheckMessage(MSG_NO_PERIOD), -@@ -366,7 +366,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "51: " + getCheckMessage(MSG_NO_PERIOD), + "56: " + getCheckMessage(MSG_NO_PERIOD), +@@ -364,7 +364,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopePackage1() throws Exception { + void scopePackage1() throws Exception { final String[] expected = { - "65: " + getCheckMessage(MSG_NO_PERIOD), - "66:24: " + getCheckMessage(MSG_UNCLOSED_HTML, "should fail // violation"), -@@ -380,7 +380,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "67: " + getCheckMessage(MSG_NO_PERIOD), + "68:24: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), +@@ -379,7 +379,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopePackage2() throws Exception { + void scopePackage2() throws Exception { final String[] expected = { - "76: " + getCheckMessage(MSG_EMPTY), - "80: " + getCheckMessage(MSG_EMPTY), + "83: " + getCheckMessage(MSG_EMPTY), + "87: " + getCheckMessage(MSG_EMPTY), @@ -392,7 +392,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @@ -35801,18 +33008,18 @@ - public void testScopePackage3() throws Exception { + void scopePackage3() throws Exception { final String[] expected = { - "103:21: " + getCheckMessage(MSG_EXTRA_HTML, " // violation"), + "104:21: " + getCheckMessage(MSG_EXTRA_HTML, ""), }; -@@ -400,7 +400,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -401,7 +401,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testScopePackage4() throws Exception { + void scopePackage4() throws Exception { final String[] expected = { - "50: " + getCheckMessage(MSG_NO_PERIOD), - "54: " + getCheckMessage(MSG_NO_PERIOD), -@@ -412,14 +412,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "51: " + getCheckMessage(MSG_NO_PERIOD), + "56: " + getCheckMessage(MSG_NO_PERIOD), +@@ -414,14 +414,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35829,7 +33036,7 @@ final String[] expected = { "75: " + getCheckMessage(MSG_EMPTY), "79: " + getCheckMessage(MSG_EMPTY), -@@ -432,21 +432,21 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -434,21 +434,21 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35852,8 +33059,8 @@ - public void testExcludeScope1() throws Exception { + void excludeScope1() throws Exception { final String[] expected = { - "23: " + getCheckMessage(MSG_NO_PERIOD), - "48: " + getCheckMessage(MSG_NO_PERIOD), + "24: " + getCheckMessage(MSG_NO_PERIOD), + "50: " + getCheckMessage(MSG_NO_PERIOD), @@ -465,7 +465,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @@ -35861,9 +33068,9 @@ - public void testExcludeScope2() throws Exception { + void excludeScope2() throws Exception { final String[] expected = { - "68:8: " + getCheckMessage(MSG_UNCLOSED_HTML, "
// violation"), - "73: " + getCheckMessage(MSG_NO_PERIOD), -@@ -474,14 +474,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "69:8: " + getCheckMessage(MSG_UNCLOSED_HTML, "
"), + "75: " + getCheckMessage(MSG_NO_PERIOD), +@@ -475,14 +475,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35878,8 +33085,8 @@ - public void testExcludeScope4() throws Exception { + void excludeScope4() throws Exception { final String[] expected = { - "29:33: " + getCheckMessage(MSG_UNCLOSED_HTML, " // violation"), - "40: " + getCheckMessage(MSG_NO_PERIOD), + "30:33: " + getCheckMessage(MSG_UNCLOSED_HTML, ""), + "42: " + getCheckMessage(MSG_NO_PERIOD), @@ -495,7 +495,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @@ -35896,7 +33103,7 @@ - public void packageInfoInvalid() throws Exception { + void packageInfoInvalid() throws Exception { final String[] expected = { - "16: " + getCheckMessage(MSG_NO_PERIOD), + "17: " + getCheckMessage(MSG_NO_PERIOD), }; @@ -519,7 +519,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @@ -35949,9 +33156,9 @@ - public void testRestrictedTokenSet1() throws Exception { + void restrictedTokenSet1() throws Exception { final String[] expected = { - "73: " + getCheckMessage(MSG_NO_PERIOD), + "74: " + getCheckMessage(MSG_NO_PERIOD), }; -@@ -570,21 +570,21 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -571,21 +571,21 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35974,18 +33181,18 @@ - public void testRestrictedTokenSet4() throws Exception { + void restrictedTokenSet4() throws Exception { final String[] expected = { - "59: " + getCheckMessage(MSG_NO_PERIOD), "91: " + getCheckMessage(MSG_NO_PERIOD), + "53: " + getCheckMessage(MSG_NO_PERIOD), "86: " + getCheckMessage(MSG_NO_PERIOD), }; -@@ -592,7 +592,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -594,7 +594,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testJavadocStyleRecordsAndCompactCtors() throws Exception { + void javadocStyleRecordsAndCompactCtors() throws Exception { final String[] expected = { - "23: " + getCheckMessage(MSG_NO_PERIOD), - "43: " + getCheckMessage(MSG_NO_PERIOD), -@@ -615,7 +615,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "24: " + getCheckMessage(MSG_NO_PERIOD), + "45: " + getCheckMessage(MSG_NO_PERIOD), +@@ -614,7 +614,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -35994,7 +33201,7 @@ final HtmlTag tag = new HtmlTag("id", 3, 5, true, false, ""); assertWithMessage("Invalid toString result") .that(tag.toString()) -@@ -625,14 +625,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -624,14 +624,14 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -36009,18 +33216,18 @@ - public void testInterfaceMemberScopeIsPublic() throws Exception { + void interfaceMemberScopeIsPublic() throws Exception { final String[] expected = { - "20: " + getCheckMessage(MSG_EMPTY), "23: " + getCheckMessage(MSG_EMPTY), + "21: " + getCheckMessage(MSG_EMPTY), "25: " + getCheckMessage(MSG_EMPTY), }; -@@ -642,7 +642,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -641,7 +641,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test - public void testEnumCtorScopeIsPrivate() throws Exception { + void enumCtorScopeIsPrivate() throws Exception { final String[] expected = { - "20: " + getCheckMessage(MSG_EMPTY), - "23: " + getCheckMessage(MSG_EMPTY), -@@ -653,7 +653,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { + "21: " + getCheckMessage(MSG_EMPTY), + "25: " + getCheckMessage(MSG_EMPTY), +@@ -652,7 +652,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -36029,7 +33236,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -661,7 +661,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -660,7 +660,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -36047,7 +33254,7 @@ final String[] expected = { "16: " + getCheckMessage(MSG_NO_PERIOD), "18:16: " -@@ -681,7 +681,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -682,7 +682,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -36056,7 +33263,7 @@ final String[] expected = { "21:4: " + getCheckMessage(MSG_EXTRA_HTML, ""), }; -@@ -689,7 +689,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -691,7 +691,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -36065,7 +33272,7 @@ final String[] expected = { "11: " + getCheckMessage(MSG_NO_PERIOD), }; -@@ -697,7 +697,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { +@@ -700,7 +700,7 @@ public class JavadocStyleCheckTest extends AbstractModuleTestSupport { } @Test @@ -37894,16 +35101,24 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -288,7 +288,7 @@ public class SummaryJavadocCheckTest extends AbstractModuleTestSupport { +@@ -288,14 +288,14 @@ public class SummaryJavadocCheckTest extends AbstractModuleTestSupport { } @Test - public void testSummaryJavaDoc() throws Exception { + void summaryJavaDoc() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWithInlineConfigParser(getPath("InputSummaryJavadoc1.java"), expected); + } + + @Test +- public void testSummaryJavaDoc2() throws Exception { ++ void summaryJavaDoc2() throws Exception { final String[] expected = { "15: " + getCheckMessage(MSG_SUMMARY_JAVADOC), }; -@@ -297,7 +297,7 @@ public class SummaryJavadocCheckTest extends AbstractModuleTestSupport { +@@ -304,7 +304,7 @@ public class SummaryJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -38305,7 +35520,7 @@ - public void testExcludedPackageDirectPackages() throws Exception { + void excludedPackageDirectPackages() throws Exception { final String[] expected = { - "30:1: " + getCheckMessage(MSG_KEY, 2, 0, "[AAClass, ABClass]"), + "28:1: " + getCheckMessage(MSG_KEY, 2, 0, "[BasicHttpContext, TlsCiphers]"), }; @@ -78,7 +78,7 @@ public class ClassDataAbstractionCouplingCheckTest extends AbstractModuleTestSup } @@ -38314,8 +35529,8 @@ - public void testExcludedPackageCommonPackages() throws Exception { + void excludedPackageCommonPackages() throws Exception { final String[] expected = { - "28:1: " + getCheckMessage(MSG_KEY, 2, 0, "[AAClass, ABClass]"), - "32:5: " + getCheckMessage(MSG_KEY, 2, 0, "[BClass, CClass]"), + "28:1: " + getCheckMessage(MSG_KEY, 2, 0, "[BasicHttpContext, TlsCiphers]"), + "32:5: " + getCheckMessage(MSG_KEY, 2, 0, "[BasicClientTlsStrategy, CommandSupport]"), @@ -89,7 +89,7 @@ public class ClassDataAbstractionCouplingCheckTest extends AbstractModuleTestSup } @@ -39475,7 +36690,7 @@ final String[] expected = { "22:17: " + getCheckMessage(MSG_KEY, "public"), -@@ -129,7 +129,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -127,7 +127,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39484,7 +36699,7 @@ final RedundantModifierCheck redundantModifierCheckObj = new RedundantModifierCheck(); final int[] actual = redundantModifierCheckObj.getAcceptableTokens(); final int[] expected = { -@@ -148,7 +148,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -146,7 +146,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39493,7 +36708,7 @@ final RedundantModifierCheck obj = new RedundantModifierCheck(); final DetailAstImpl ast = new DetailAstImpl(); ast.initialize(TokenTypes.LITERAL_NULL, "null"); -@@ -167,7 +167,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -165,7 +165,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39502,7 +36717,7 @@ final RedundantModifierCheck redundantModifierCheckObj = new RedundantModifierCheck(); final int[] actual = redundantModifierCheckObj.getRequiredTokens(); final int[] expected = CommonUtil.EMPTY_INT_ARRAY; -@@ -175,7 +175,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -173,7 +173,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39511,7 +36726,7 @@ final String[] expected = { "12:5: " + getCheckMessage(MSG_KEY, "static"), "16:9: " + getCheckMessage(MSG_KEY, "static"), -@@ -186,7 +186,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -184,7 +184,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39520,7 +36735,7 @@ final String[] expected = { "22:20: " + getCheckMessage(MSG_KEY, "final"), }; -@@ -195,7 +195,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -193,7 +193,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39529,7 +36744,7 @@ final String[] expected = { "38:14: " + getCheckMessage(MSG_KEY, "final"), "43:14: " + getCheckMessage(MSG_KEY, "final"), -@@ -206,7 +206,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -204,7 +204,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39538,7 +36753,7 @@ final String[] expected = { "12:33: " + getCheckMessage(MSG_KEY, "final"), "16:49: " + getCheckMessage(MSG_KEY, "final"), -@@ -219,7 +219,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -217,7 +217,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39547,7 +36762,7 @@ final String[] expected = { "15:16: " + getCheckMessage(MSG_KEY, "final"), "30:16: " + getCheckMessage(MSG_KEY, "final"), }; -@@ -228,7 +228,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -226,7 +226,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39556,7 +36771,7 @@ final String[] expected = { "20:23: " + getCheckMessage(MSG_KEY, "final"), }; -@@ -237,7 +237,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -235,7 +235,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39565,7 +36780,7 @@ final String[] expected = { "22:5: " + getCheckMessage(MSG_KEY, "private"), }; -@@ -246,7 +246,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -244,7 +244,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39574,7 +36789,7 @@ final String[] expected = { "13:17: " + getCheckMessage(MSG_KEY, "final"), }; -@@ -255,7 +255,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -253,7 +253,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39583,7 +36798,7 @@ final String[] expected = { "18:19: " + getCheckMessage(MSG_KEY, "final"), }; -@@ -263,7 +263,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -261,7 +261,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -39592,7 +36807,7 @@ final String[] expected = { "10:5: " + getCheckMessage(MSG_KEY, "public"), "11:5: " + getCheckMessage(MSG_KEY, "static"), -@@ -293,7 +293,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { +@@ -291,7 +291,7 @@ public class RedundantModifierCheckTest extends AbstractModuleTestSupport { } @Test @@ -41109,13 +38324,12 @@ "23:10: " + getCheckMessage(MSG_INVALID_PATTERN, "Third_Name", DEFAULT_PATTERN), --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java -@@ -24,13 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.regexp.RegexpCheck.MSG_DUPL +@@ -24,12 +24,13 @@ import static com.puppycrawl.tools.checkstyle.checks.regexp.RegexpCheck.MSG_DUPL import static com.puppycrawl.tools.checkstyle.checks.regexp.RegexpCheck.MSG_ILLEGAL_REGEXP; import static com.puppycrawl.tools.checkstyle.checks.regexp.RegexpCheck.MSG_REQUIRED_REGEXP; +import com.google.common.collect.ImmutableList; import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; import java.util.List; import org.junit.jupiter.api.Test; @@ -41125,7 +38339,7 @@ @Override protected String getPackageLocation() { -@@ -38,7 +39,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -37,7 +38,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41134,7 +38348,7 @@ final RegexpCheck regexpCheck = new RegexpCheck(); assertWithMessage("RegexpCheck#getAcceptableTokens should return empty array by default") .that(regexpCheck.getAcceptableTokens()) -@@ -46,7 +47,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -45,7 +46,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41143,7 +38357,7 @@ final RegexpCheck checkObj = new RegexpCheck(); assertWithMessage("RegexpCheck#getRequiredTokens should return empty array by default") .that(checkObj.getRequiredTokens()) -@@ -54,13 +55,13 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -53,13 +54,13 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41156,10 +38370,17 @@ @Test - public void testRequiredFail() throws Exception { + void requiredFail() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(RegexpCheck.class); - checkConfig.addProperty("format", "This\\stext is not in the file"); final String[] expected = { -@@ -70,19 +71,19 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { + "1: " + getCheckMessage(MSG_REQUIRED_REGEXP, "This\\stext is not in the file"), + }; +@@ -67,25 +68,25 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testDefault() throws Exception { ++ void testDefault() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputRegexpCheckDefault.java"), expected); } @Test @@ -41182,7 +38403,7 @@ final String[] expected = { "27: " + getCheckMessage(MSG_DUPLICATE_REGEXP, "Boolean x = new Boolean"), "32: " + getCheckMessage(MSG_DUPLICATE_REGEXP, "Boolean x = new Boolean"), -@@ -91,19 +92,19 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -94,19 +95,19 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41205,7 +38426,7 @@ final String[] expected = { "15: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "^import"), "16: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "^import"), -@@ -113,7 +114,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -116,7 +117,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41214,52 +38435,52 @@ final String error = "The error limit has been exceeded, " + "the check is aborting, there may be more unreported errors."; -@@ -125,7 +126,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -128,7 +129,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test - public void testMessagePropertyGood() throws Exception { + void messagePropertyGood() throws Exception { final String[] expected = { - "77: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "Bad line :("), + "78: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "Bad line :("), }; -@@ -133,7 +134,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -136,7 +137,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test - public void testMessagePropertyBad() throws Exception { + void messagePropertyBad() throws Exception { final String[] expected = { - "77: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "System\\.(out)|(err)\\.print(ln)?\\("), + "78: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "System\\.(out)|(err)\\.print(ln)?\\("), }; -@@ -141,7 +142,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -144,7 +145,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test - public void testMessagePropertyBad2() throws Exception { + void messagePropertyBad2() throws Exception { final String[] expected = { - "77: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "System\\.(out)|(err)\\.print(ln)?\\("), + "78: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "System\\.(out)|(err)\\.print(ln)?\\("), }; -@@ -149,7 +150,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -152,7 +153,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test - public void testIgnoreCaseTrue() throws Exception { + void ignoreCaseTrue() throws Exception { final String[] expected = { - "77: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "(?i)SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("), + "78: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "(?i)SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("), }; -@@ -157,7 +158,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -160,7 +161,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test - public void testIgnoreCaseFalse() throws Exception { + void ignoreCaseFalse() throws Exception { final String[] expectedTrue = { - "77: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "(?i)SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("), + "78: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "(?i)SYSTEM\\.(OUT)|(ERR)\\.PRINT(LN)?\\("), }; -@@ -168,14 +169,14 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -171,14 +172,14 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41276,7 +38497,7 @@ // See if the comment is removed properly final String[] expected = { "16: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "don't\\suse trailing comments"), -@@ -184,14 +185,14 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -187,14 +188,14 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41293,7 +38514,7 @@ final String[] expected = { "31: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "c-style\\s1"), }; -@@ -199,26 +200,26 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -202,26 +203,26 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41324,7 +38545,7 @@ final String[] expected = { "34: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "int z"), }; -@@ -226,7 +227,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -229,7 +230,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41333,7 +38554,7 @@ final String[] expected = { "35: " + getCheckMessage(MSG_ILLEGAL_REGEXP, "int y"), }; -@@ -234,21 +235,21 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -237,20 +238,20 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41347,18 +38568,17 @@ @Test - public void testOnFileStartingWithEmptyLine() throws Exception { + void onFileStartingWithEmptyLine() throws Exception { - final DefaultConfiguration checkConfig = createModuleConfig(RegexpCheck.class); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verify(checkConfig, getPath("InputRegexpStartingWithEmptyLine.java"), expected); + verifyWithInlineConfigParser(getPath("InputRegexpStartingWithEmptyLine.java"), expected); } @Test - public void testIgnoreCommentsCppStyleWithIllegalPatternFalse() throws Exception { + void ignoreCommentsCppStyleWithIllegalPatternFalse() throws Exception { // See if the comment is removed properly - final DefaultConfiguration checkConfig = createModuleConfig(RegexpCheck.class); - checkConfig.addProperty("format", "don't use trailing comments"); -@@ -261,18 +262,18 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { + final String[] expected = { + "1: " + getCheckMessage(MSG_REQUIRED_REGEXP, "don't use trailing comments"), +@@ -259,18 +260,18 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -41381,7 +38601,7 @@ final String file1 = getPath("InputRegexpCheckB3.java"); final String file2 = getPath("InputRegexpCheckB4.java"); final List expectedFirstInput = List.of(CommonUtil.EMPTY_STRING_ARRAY); -@@ -281,7 +282,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { +@@ -279,7 +280,7 @@ public class RegexpCheckTest extends AbstractModuleTestSupport { } @Test @@ -46420,7 +43640,7 @@ new AuditEvent( --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java -@@ -42,7 +42,7 @@ import nl.jqno.equalsverifier.EqualsVerifier; +@@ -51,7 +51,7 @@ import nl.jqno.equalsverifier.EqualsVerifier; import nl.jqno.equalsverifier.EqualsVerifierReport; import org.junit.jupiter.api.Test; @@ -46429,7 +43649,7 @@ private static final String[] ALL_MESSAGES = { "45:17: " -@@ -87,7 +87,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -96,7 +96,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46438,7 +43658,7 @@ final String[] messages = { "35:17: " + getCheckMessage( -@@ -139,7 +139,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -148,7 +148,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { // Suppress all checks between default comments @Test @@ -46447,7 +43667,7 @@ final String[] suppressed = { "48:17: " + getCheckMessage( -@@ -155,7 +155,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -164,7 +164,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46456,7 +43676,7 @@ final String[] suppressed = { "75:17: " + getCheckMessage( -@@ -167,7 +167,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -176,7 +176,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46465,7 +43685,7 @@ final String[] suppressed = { "48:17: " + getCheckMessage( -@@ -179,7 +179,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -188,7 +188,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { // Suppress all checks between CS_OFF and CS_ON @Test @@ -46474,7 +43694,7 @@ final String[] suppressed = { "64:17: " + getCheckMessage( -@@ -200,7 +200,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -209,7 +209,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { // Test suppression of checks of only one type // Suppress only ConstantNameCheck between CS_OFF and CS_ON @Test @@ -46483,7 +43703,7 @@ final String[] suppressed = { "71:30: " + getCheckMessage( -@@ -210,7 +210,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -219,7 +219,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46492,7 +43712,7 @@ final String[] suppressed = { "110:11: " + getCheckMessage(IllegalCatchCheck.class, IllegalCatchCheck.MSG_KEY, "Exception"), }; -@@ -218,7 +218,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -227,7 +227,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46501,7 +43721,7 @@ final String[] suppressed = { "54:17: " + getCheckMessage( -@@ -234,7 +234,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -243,7 +243,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46510,7 +43730,7 @@ final String[] suppressed = CommonUtil.EMPTY_STRING_ARRAY; verifySuppressedWithParser("InputSuppressionCommentFilter9.java", suppressed); } -@@ -250,7 +250,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -259,7 +259,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46519,7 +43739,7 @@ final Object tag = getTagsAfterExecutionOnDefaultFilter("//CHECKSTYLE:OFF").get(0); final EqualsVerifierReport ev = EqualsVerifier.forClass(tag.getClass()).usingGetClass().report(); -@@ -258,7 +258,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -267,7 +267,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46528,7 +43748,7 @@ final Object tag = getTagsAfterExecutionOnDefaultFilter("//CHECKSTYLE:OFF").get(0); assertWithMessage("Invalid toString result") .that(tag.toString()) -@@ -268,7 +268,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -277,7 +277,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46537,7 +43757,7 @@ final SuppressionCommentFilter filter = new SuppressionCommentFilter(); filter.setMessageFormat(".*"); final Object tag = getTagsAfterExecution(filter, "filename", "//CHECKSTYLE:ON").get(0); -@@ -280,7 +280,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -289,7 +289,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46546,7 +43766,7 @@ final List> tags1 = getTagsAfterExecutionOnDefaultFilter("//CHECKSTYLE:OFF", " //CHECKSTYLE:ON"); final Comparable tag1 = tags1.get(0); -@@ -302,7 +302,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -311,7 +311,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46555,7 +43775,7 @@ final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class); final DefaultConfiguration filterConfig = createModuleConfig(SuppressionCommentFilter.class); filterConfig.addProperty("checkFormat", "e[l"); -@@ -323,7 +323,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -332,7 +332,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46564,7 +43784,7 @@ final DefaultConfiguration treeWalkerConfig = createModuleConfig(TreeWalker.class); final DefaultConfiguration filterConfig = createModuleConfig(SuppressionCommentFilter.class); filterConfig.addProperty("messageFormat", "e[l"); -@@ -344,7 +344,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -353,7 +353,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46573,7 +43793,7 @@ final SuppressionCommentFilter filter = new SuppressionCommentFilter(); final FileContents contents = new FileContents( -@@ -358,7 +358,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -367,7 +367,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46582,7 +43802,7 @@ final SuppressionCommentFilter filter = new SuppressionCommentFilter(); final FileContents contents = null; final TreeWalkerAuditEvent auditEvent = -@@ -368,7 +368,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -377,7 +377,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46591,7 +43811,7 @@ final String[] suppressedViolation = { "42:17: " + getCheckMessage( -@@ -405,7 +405,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -414,7 +414,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46600,7 +43820,7 @@ final String[] suppressedViolation = { "42:17: " + getCheckMessage( -@@ -442,7 +442,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -451,7 +451,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46609,7 +43829,7 @@ final String[] suppressedViolation = { "42:17: " + getCheckMessage( -@@ -479,7 +479,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -488,7 +488,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46618,7 +43838,7 @@ final String[] suppressedViolation = { "54:17: " + getCheckMessage( -@@ -513,7 +513,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -522,7 +522,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46627,7 +43847,7 @@ final String[] suppressedViolation = { "54:17: " + getCheckMessage( -@@ -547,7 +547,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -556,7 +556,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46636,7 +43856,7 @@ final SuppressionCommentFilter suppressionCommentFilter = new SuppressionCommentFilter(); final FileContents contents = new FileContents( -@@ -566,7 +566,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { +@@ -575,7 +575,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { } @Test @@ -46645,6 +43865,24 @@ final SuppressionCommentFilter suppressionCommentFilter = new SuppressionCommentFilter(); final List tags1 = getTagsAfterExecution(suppressionCommentFilter, "filename1", "//CHECKSTYLE:OFF", "line2"); +@@ -615,7 +615,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCachingByFileContentsInstance() throws Exception { ++ void cachingByFileContentsInstance() throws Exception { + + final File file = new File(getPath("InputSuppressionCommentFilterSuppressById6.java")); + final DetailAST rootAst = JavaParser.parseFile(file, JavaParser.Options.WITH_COMMENTS); +@@ -628,7 +628,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { + } + } + +- final FileContents mockedContents = mock(FileContents.class); ++ final FileContents mockedContents = mock(); + final Map returnValue = fileContents.getSingleLineComments(); + when(mockedContents.getSingleLineComments()) + .thenReturn(returnValue) --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionFilterTest.java @@ -39,7 +39,7 @@ import java.net.URL; @@ -47037,7 +44275,7 @@ + getCheckMessage(ConstantNameCheck.class, MSG_INVALID_PATTERN, "bad_name", PATTERN), --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilterTest.java -@@ -39,7 +39,7 @@ import java.nio.charset.StandardCharsets; +@@ -41,7 +41,7 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import org.junit.jupiter.api.Test; @@ -47046,7 +44284,7 @@ @Override protected String getPackageLocation() { -@@ -47,7 +47,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -49,7 +49,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47055,7 +44293,7 @@ final String[] expected = { "19:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -63,7 +63,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -65,7 +65,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47064,7 +44302,7 @@ final String[] expected = { "19:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -77,7 +77,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -79,7 +79,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47073,7 +44311,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), "21:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), -@@ -94,7 +94,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -96,7 +96,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47082,7 +44320,7 @@ final String[] expected = { "23:11: " + getCheckMessage( -@@ -112,7 +112,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -114,7 +114,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47091,7 +44329,7 @@ final String[] expected = { "27:21: " + getCheckMessage(MagicNumberCheck.class, MSG_KEY, "3.14"), "28:16: " + getCheckMessage(MagicNumberCheck.class, MSG_KEY, "123"), -@@ -128,7 +128,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -130,7 +130,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47100,7 +44338,7 @@ final String xpath = "1@#"; try { final Object test = -@@ -143,7 +143,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -145,7 +145,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47109,7 +44347,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -159,7 +159,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -161,7 +161,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47118,7 +44356,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -173,7 +173,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -175,7 +175,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47127,7 +44365,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -187,7 +187,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -189,7 +189,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47136,7 +44374,7 @@ final SuppressionXpathSingleFilter filter = new SuppressionXpathSingleFilter(); try { filter.setFiles("e[l"); -@@ -200,7 +200,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -202,7 +202,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47145,7 +44383,7 @@ final SuppressionXpathSingleFilter filter = new SuppressionXpathSingleFilter(); try { filter.setChecks("e[l"); -@@ -213,7 +213,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -215,7 +215,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47154,7 +44392,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; final String[] suppressed = CommonUtil.EMPTY_STRING_ARRAY; -@@ -224,7 +224,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -226,7 +226,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47163,7 +44401,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -238,7 +238,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -240,7 +240,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47172,7 +44410,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -254,7 +254,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -256,7 +256,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47181,7 +44419,7 @@ final String[] expected = { "19:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -268,7 +268,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -270,7 +270,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47190,7 +44428,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -281,7 +281,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -283,7 +283,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47199,7 +44437,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -294,7 +294,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -296,7 +296,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47208,7 +44446,7 @@ final String[] expected = { "28:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), "30:21: " + getCheckMessage(MagicNumberCheck.class, MSG_KEY, "3.14"), -@@ -313,7 +313,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -315,7 +315,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47217,7 +44455,7 @@ final String xpath = "//CLASS_DEF[@text='InputSuppressionXpathSingleFilterComplexQuery']"; final SuppressionXpathSingleFilter filter = createSuppressionXpathSingleFilter( -@@ -339,7 +339,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -341,7 +341,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47226,7 +44464,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -353,7 +353,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -355,7 +355,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47235,7 +44473,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -369,7 +369,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -371,7 +371,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47244,7 +44482,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -385,7 +385,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -387,7 +387,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47253,7 +44491,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; -@@ -401,7 +401,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport +@@ -403,7 +403,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport } @Test @@ -47262,6 +44500,15 @@ final String[] expected = { "19:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), }; +@@ -427,7 +427,7 @@ public class SuppressionXpathSingleFilterTest extends AbstractModuleTestSupport + * @throws Exception when there is problem to load Input file + */ + @Test +- public void testUpdateFilterSettingsInRunTime() throws Exception { ++ void updateFilterSettingsInRunTime() throws Exception { + final File file = new File(getPath("InputSuppressionXpathSingleFilterComplexQuery.java")); + + final SuppressionXpathSingleFilter filter = new SuppressionXpathSingleFilter(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test; @@ -51102,38 +48349,18 @@ final Map> allTests = new HashMap<>(); walk( ---- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/ArchUnitCyclesCheckTest.java -+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/ArchUnitCyclesCheckTest.java -@@ -30,7 +30,7 @@ import org.junit.jupiter.api.Disabled; - import org.junit.jupiter.api.Test; - - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13544") --public class ArchUnitCyclesCheckTest { -+final class ArchUnitCyclesCheckTest { - - /** - * This test checks that The frozen violations are present in {@code config/archunit-store} directory. - */ - @Test -- public void testSlicesShouldBeFreeOfCycles() { -+ void slicesShouldBeFreeOfCycles() { - final JavaClasses importedClasses = - new ClassFileImporter() - .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/ArchUnitSuperClassTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/ArchUnitSuperClassTest.java -@@ -43,7 +43,7 @@ import org.junit.jupiter.api.Disabled; +@@ -41,7 +41,7 @@ import java.util.Optional; + import java.util.Set; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13544") -public class ArchUnitSuperClassTest { +final class ArchUnitSuperClassTest { /** * Classes not abiding to {@link #testChecksShouldHaveAllowedAbstractClassAsSuperclass()} rule. -@@ -92,7 +92,7 @@ public class ArchUnitSuperClassTest { +@@ -90,7 +90,7 @@ public class ArchUnitSuperClassTest { * AbstractJavadocCheck} as their super class. */ @Test @@ -51142,7 +48369,7 @@ final JavaClasses checksPackage = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) -@@ -136,7 +136,7 @@ public class ArchUnitSuperClassTest { +@@ -134,7 +134,7 @@ public class ArchUnitSuperClassTest { public void check(JavaClass item, ConditionEvents events) { final Optional superclassOptional = item.getSuperclass(); if (superclassOptional.isPresent()) { @@ -51153,16 +48380,16 @@ final String message = --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/ArchUnitTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/ArchUnitTest.java -@@ -34,7 +34,7 @@ import org.junit.jupiter.api.Disabled; +@@ -32,7 +32,7 @@ import com.tngtech.archunit.lang.EvaluationResult; + import java.util.List; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13544") -public class ArchUnitTest { +final class ArchUnitTest { /** * Suppression list containing violations from {@code classShouldNotDependOnUtilPackages} -@@ -88,7 +88,7 @@ public class ArchUnitTest { +@@ -92,7 +92,7 @@ public class ArchUnitTest { * we need to make checkstyle's Check on this. */ @Test @@ -51171,7 +48398,7 @@ // This list contains methods which have been overridden and are set to ignore in this test. final String[] methodsWithOverrideAnnotation = { "processFiltered", -@@ -125,7 +125,7 @@ public class ArchUnitTest { +@@ -129,7 +129,7 @@ public class ArchUnitTest { * Therefore classes in api should not depend on them. */ @Test @@ -51459,33 +48686,7 @@ } --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsJavaDocsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsJavaDocsTest.java -@@ -20,8 +20,10 @@ - package com.puppycrawl.tools.checkstyle.internal; - - import static com.google.common.truth.Truth.assertWithMessage; -+import static java.util.Collections.unmodifiableSet; - - import com.google.common.collect.ImmutableMap; -+import com.google.common.collect.ImmutableSet; - import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; - import com.puppycrawl.tools.checkstyle.Checker; - import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -@@ -55,14 +57,11 @@ import java.nio.file.Files; - import java.nio.file.Path; - import java.nio.file.Paths; - import java.util.ArrayList; --import java.util.Arrays; --import java.util.Collections; - import java.util.HashMap; - import java.util.List; - import java.util.Map; - import java.util.Set; - import java.util.regex.Pattern; --import java.util.stream.Collectors; - import javax.xml.parsers.ParserConfigurationException; - import org.junit.jupiter.api.BeforeEach; - import org.junit.jupiter.api.Test; -@@ -71,7 +70,7 @@ import org.w3c.dom.NamedNodeMap; +@@ -68,7 +68,7 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -51494,33 +48695,7 @@ private static final Map> FULLY_QUALIFIED_CLASS_NAMES = ImmutableMap.>builder() .put("int", int.class) -@@ -103,16 +102,15 @@ public class XdocsJavaDocsTest extends AbstractModuleTestSupport { - .build(); - - private static final Set NON_BASE_TOKEN_PROPERTIES = -- Collections.unmodifiableSet( -- Arrays.stream( -- new String[] { -- "AtclauseOrder - target", -- "DescendantToken - limitedTokens", -- "IllegalType - memberModifiers", -- "MagicNumber - constantWaiverParentToken", -- "MultipleStringLiterals - ignoreOccurrenceContext", -- }) -- .collect(Collectors.toSet())); -+ unmodifiableSet( -+ ImmutableSet.copyOf( -+ new String[] { -+ "AtclauseOrder - target", -+ "DescendantToken - limitedTokens", -+ "IllegalType - memberModifiers", -+ "MagicNumber - constantWaiverParentToken", -+ "MultipleStringLiterals - ignoreOccurrenceContext", -+ })); - - private static final List> CHECK_PROPERTIES = new ArrayList<>(); - private static final Map CHECK_PROPERTY_DOC = new HashMap<>(); -@@ -130,7 +128,7 @@ public class XdocsJavaDocsTest extends AbstractModuleTestSupport { +@@ -115,7 +115,7 @@ public class XdocsJavaDocsTest extends AbstractModuleTestSupport { } @BeforeEach @@ -51529,7 +48704,7 @@ final DefaultConfiguration checkConfig = new DefaultConfiguration(JavaDocCapture.class.getName()); checker = createChecker(checkConfig); -@@ -144,7 +142,7 @@ public class XdocsJavaDocsTest extends AbstractModuleTestSupport { +@@ -129,7 +129,7 @@ public class XdocsJavaDocsTest extends AbstractModuleTestSupport { * method */ @Test @@ -51702,7 +48877,7 @@ final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory(); final Path path = Paths.get(XdocUtil.DIRECTORY_PATH + "/config.xml"); -@@ -1370,7 +1372,7 @@ public class XdocsPagesTest { +@@ -1364,7 +1366,7 @@ public class XdocsPagesTest { final Object[] array = (Object[]) value; valuesStream = Arrays.stream(array); } @@ -51711,7 +48886,7 @@ } if (result.isEmpty()) { -@@ -1399,8 +1401,7 @@ public class XdocsPagesTest { +@@ -1393,8 +1395,7 @@ public class XdocsPagesTest { } else { stream = Arrays.stream((int[]) value); } @@ -51721,7 +48896,7 @@ if (result.isEmpty()) { result = "{}"; } -@@ -1476,7 +1477,7 @@ public class XdocsPagesTest { +@@ -1470,7 +1471,7 @@ public class XdocsPagesTest { result = XmlUtil.getChildrenElements(node).stream() .map(Node::getTextContent) @@ -51730,7 +48905,7 @@ } return result; } -@@ -1690,7 +1691,7 @@ public class XdocsPagesTest { +@@ -1684,7 +1685,7 @@ public class XdocsPagesTest { } @Test @@ -51739,7 +48914,7 @@ for (Path path : XdocUtil.getXdocsStyleFilePaths(XdocUtil.getXdocsFilePaths())) { final String fileName = path.getFileName().toString(); final String styleName = fileName.substring(0, fileName.lastIndexOf('_')); -@@ -1995,7 +1996,7 @@ public class XdocsPagesTest { +@@ -1989,7 +1990,7 @@ public class XdocsPagesTest { } @Test @@ -51837,7 +49012,7 @@ JavadocStyleCheck.class, JavadocMethodCheck.class, JavadocTypeCheck.class, -@@ -128,7 +130,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -122,7 +124,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { "VisibilityModifier"); // Modules that will never have xpath support ever because they not report violations @@ -51846,7 +49021,7 @@ private static final Set SIMPLE_CHECK_NAMES = getSimpleCheckNames(); private static final Map ALLOWED_DIRECTORY_AND_CHECKS = -@@ -148,8 +150,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -142,8 +144,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } private static Map getAllowedDirectoryAndChecks() { @@ -51856,7 +49031,7 @@ } private static Set getInternalModules() { -@@ -159,11 +160,11 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -153,11 +154,11 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { final String[] packageTokens = moduleName.split("\\."); return packageTokens[packageTokens.length - 1]; }) @@ -51870,7 +49045,7 @@ javaDir = Paths.get("src/it/java/" + getPackageLocation()); inputDir = Paths.get(getPath("")); } -@@ -179,12 +180,12 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -173,12 +174,12 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } @Test @@ -51885,7 +49060,7 @@ // add the extra checks abstractJavadocCheckNames.addAll(REGEXP_JAVADOC_CHECKS); final Set abstractJavadocCheckSimpleNames = -@@ -198,7 +199,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -192,7 +193,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } @Test @@ -51894,7 +49069,7 @@ final Set compatibleChecks = new HashSet<>(); final Pattern pattern = Pattern.compile("^XpathRegression(.+)Test\\.java$"); try (DirectoryStream javaPaths = Files.newDirectoryStream(javaDir)) { -@@ -242,7 +243,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -236,7 +237,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { final Set allChecks = new HashSet<>(SIMPLE_CHECK_NAMES); allChecks.removeAll(INCOMPATIBLE_JAVADOC_CHECK_NAMES); allChecks.removeAll(INCOMPATIBLE_CHECK_NAMES); @@ -51903,7 +49078,7 @@ allChecks.removeAll(MISSING_CHECK_NAMES); allChecks.removeAll(NO_VIOLATION_MODULES); allChecks.removeAll(compatibleChecks); -@@ -257,7 +258,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -251,7 +252,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } @Test @@ -52042,17 +49217,15 @@ import java.io.File; import java.io.Reader; -import java.nio.charset.StandardCharsets; + import java.nio.file.Files; import java.nio.file.Path; - import java.util.Set; - import org.apache.maven.doxia.parser.Parser; -@@ -55,13 +56,10 @@ public final class XdocGenerator { + import java.nio.file.StandardCopyOption; +@@ -57,11 +58,10 @@ public final class XdocGenerator { (XdocsTemplateSinkFactory) plexus.lookup(SinkFactory.ROLE, XDOCS_TEMPLATE_HINT); final Sink sink = sinkFactory.createSink( -- outputFile.getParentFile(), -- outputFile.getName(), -- String.valueOf(StandardCharsets.UTF_8)); -+ outputFile.getParentFile(), outputFile.getName(), String.valueOf(UTF_8)); +- tempFile.getParentFile(), tempFile.getName(), String.valueOf(StandardCharsets.UTF_8)); ++ tempFile.getParentFile(), tempFile.getName(), String.valueOf(UTF_8)); final XdocsTemplateParser parser = (XdocsTemplateParser) plexus.lookup(Parser.ROLE, XDOCS_TEMPLATE_HINT); - try (Reader reader = @@ -52985,7 +50158,7 @@ final String[] fileExtensions = {"java"}; final File pdfFile = new File("file.pdf"); assertWithMessage("Invalid file extension") -@@ -170,42 +171,42 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -174,42 +175,42 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53015,7 +50188,7 @@ @Test - public void testRelativeNormalizedPath() { + void relativeNormalizedPath() { - final String relativePath = CommonUtil.relativizeAndNormalizePath("/home", "/home/test"); + final String relativePath = CommonUtil.relativizePath("/home", "/home/test"); assertWithMessage("Invalid relative path").that(relativePath).isEqualTo("test"); } @@ -53023,7 +50196,7 @@ @Test - public void testRelativeNormalizedPathWithNullBaseDirectory() { + void relativeNormalizedPathWithNullBaseDirectory() { - final String relativePath = CommonUtil.relativizeAndNormalizePath(null, "/tmp"); + final String relativePath = CommonUtil.relativizePath(null, "/tmp"); assertWithMessage("Invalid relative path").that(relativePath).isEqualTo("/tmp"); } @@ -53034,7 +50207,7 @@ final String sampleAbsolutePath = new File("src/main/java").getCanonicalPath(); final String absoluteFilePath = sampleAbsolutePath + "/SampleFile.java"; final String basePath = sampleAbsolutePath + PATH_DENORMALIZER; -@@ -216,19 +217,19 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -220,19 +221,19 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53057,7 +50230,7 @@ final Constructor constructor = CommonUtil.getConstructor(String.class, String.class); assertWithMessage("Invalid constructor") -@@ -237,7 +238,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -241,7 +242,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53066,7 +50239,7 @@ final IllegalStateException ex = assertThrows( IllegalStateException.class, -@@ -251,7 +252,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -255,7 +256,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53075,7 +50248,7 @@ final Constructor constructor = String.class.getConstructor(String.class); final String constructedString = CommonUtil.invokeConstructor(constructor, "string"); -@@ -261,7 +262,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -265,7 +266,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { @SuppressWarnings("rawtypes") @Test @@ -53084,7 +50257,7 @@ final Constructor constructor = Dictionary.class.getConstructor(); final IllegalStateException ex = assertThrows( -@@ -276,7 +277,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -280,7 +281,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53093,7 +50266,7 @@ final TestCloseable closeable = new TestCloseable(); CommonUtil.close(null); -@@ -286,7 +287,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -290,7 +291,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53102,7 +50275,7 @@ final IllegalStateException ex = assertThrows( IllegalStateException.class, -@@ -303,7 +304,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -307,7 +308,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53111,7 +50284,7 @@ assertWithMessage("invalid result") .that( CommonUtil.fillTemplateWithStringsByRegexp( -@@ -324,7 +325,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -328,7 +329,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53120,7 +50293,7 @@ assertWithMessage("invalid result") .that(CommonUtil.getFileNameWithoutExtension("filename")) .isEqualTo("filename"); -@@ -337,7 +338,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -341,7 +342,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53129,7 +50302,7 @@ assertWithMessage("Invalid extension") .that(CommonUtil.getFileExtension("filename")) .isEqualTo(""); -@@ -350,133 +351,133 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -354,133 +355,133 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53282,7 +50455,7 @@ final String filename = "/" + getPackageLocation() + "/InputCommonUtilTest_empty_checks.xml"; final URI uri = CommonUtil.getUriByFilename(filename); -@@ -487,7 +488,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -491,7 +492,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53291,7 +50464,7 @@ final String filename = getPackageLocation() + "/InputCommonUtilTest_empty_checks.xml"; final URI uri = CommonUtil.getUriByFilename(filename); -@@ -503,7 +504,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -507,7 +508,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { * interpreted relative to the current package "com/puppycrawl/tools/checkstyle/utils/" */ @Test @@ -53300,7 +50473,7 @@ final String filename = getPackageLocation() + "/InputCommonUtilTest_resource.txt"; final URI uri = CommonUtil.getUriByFilename(filename); assertWithMessage("URI is null for: " + filename).that(uri).isNotNull(); -@@ -514,12 +515,12 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -518,12 +519,12 @@ public class CommonUtilTest extends AbstractPathTestSupport { assertWithMessage("URI is relative to package " + uriRelativeToPackage) .that(uri.toString()) .doesNotContain(uriRelativeToPackage); @@ -53315,7 +50488,7 @@ final String filename = CommonUtil.CLASSPATH_URL_PROTOCOL + getPackageLocation() -@@ -533,7 +534,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -537,7 +538,7 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53324,7 +50497,7 @@ final String filename = CommonUtil.CLASSPATH_URL_PROTOCOL + getPackageLocation() -@@ -547,15 +548,15 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -551,15 +552,15 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -54530,7 +51703,7 @@ --- a/src/test/java/com/puppycrawl/tools/checkstyle/xpath/RootNodeTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/xpath/RootNodeTest.java -@@ -35,7 +35,7 @@ import net.sf.saxon.tree.iter.EmptyIterator; +@@ -36,7 +36,7 @@ import net.sf.saxon.tree.iter.EmptyIterator; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -54539,7 +51712,7 @@ private static RootNode rootNode; -@@ -45,14 +45,14 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -46,14 +46,14 @@ public class RootNodeTest extends AbstractPathTestSupport { } @BeforeEach @@ -54556,7 +51729,7 @@ try { rootNode.compareOrder(null); assertWithMessage("Exception is excepted").fail(); -@@ -64,7 +64,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -65,7 +65,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54565,7 +51738,7 @@ final String xpath = "/"; final List nodes = getXpathItems(xpath, rootNode); assertWithMessage("Invalid number of nodes").that(nodes).hasSize(1); -@@ -78,34 +78,34 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -79,24 +79,24 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54594,6 +51767,18 @@ assertWithMessage("Invalid column number").that(rootNode.getColumnNumber()).isEqualTo(0); } +@@ -106,7 +106,7 @@ public class RootNodeTest extends AbstractPathTestSupport { + * Test exists until https://github.com/checkstyle/checkstyle/issues/4997 + */ + @Test +- public void testNonRealGetColumnNumber() { ++ void nonRealGetColumnNumber() { + final DetailAstImpl nonRealNode = new DetailAstImpl(); + nonRealNode.setType(TokenTypes.PACKAGE_DEF); + nonRealNode.setLineNo(555); +@@ -119,12 +119,12 @@ public class RootNodeTest extends AbstractPathTestSupport { + } + @Test - public void testGetLocalPart() { + void getLocalPart() { @@ -54606,7 +51791,7 @@ try (AxisIterator following = rootNode.iterateAxis(AxisInfo.FOLLOWING)) { assertWithMessage("Result iterator does not match expected") .that(following) -@@ -139,7 +139,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -158,7 +158,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54615,7 +51800,7 @@ final RootNode emptyRootNode = new RootNode(null); assertWithMessage("Empty node should not have children") .that(emptyRootNode.hasChildNodes()) -@@ -158,7 +158,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -177,7 +177,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54624,7 +51809,7 @@ try { rootNode.getStringValue(); assertWithMessage("Exception is excepted").fail(); -@@ -170,7 +170,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -189,7 +189,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54633,7 +51818,7 @@ try { rootNode.getAttributeValue("", ""); assertWithMessage("Exception is excepted").fail(); -@@ -182,7 +182,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -201,7 +201,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54642,7 +51827,7 @@ try { rootNode.getDeclaredNamespaces(null); assertWithMessage("Exception is excepted").fail(); -@@ -194,7 +194,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -213,7 +213,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54651,7 +51836,7 @@ try { rootNode.isId(); assertWithMessage("Exception is excepted").fail(); -@@ -206,7 +206,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -225,7 +225,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54660,7 +51845,7 @@ try { rootNode.isIdref(); assertWithMessage("Exception is excepted").fail(); -@@ -218,7 +218,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -237,7 +237,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54669,7 +51854,7 @@ try { rootNode.isNilled(); assertWithMessage("Exception is excepted").fail(); -@@ -230,7 +230,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -249,7 +249,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54678,7 +51863,7 @@ try { rootNode.isStreamed(); assertWithMessage("Exception is excepted").fail(); -@@ -242,7 +242,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -261,7 +261,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54687,7 +51872,7 @@ try { rootNode.getConfiguration(); assertWithMessage("Exception is excepted").fail(); -@@ -254,7 +254,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -273,7 +273,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54696,7 +51881,7 @@ try { rootNode.setSystemId("1"); assertWithMessage("Exception is excepted").fail(); -@@ -266,7 +266,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -285,7 +285,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54705,7 +51890,7 @@ try { rootNode.getSystemId(); assertWithMessage("Exception is excepted").fail(); -@@ -278,7 +278,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -297,7 +297,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54714,7 +51899,7 @@ try { rootNode.getPublicId(); assertWithMessage("Exception is excepted").fail(); -@@ -290,7 +290,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -309,7 +309,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54723,7 +51908,7 @@ try { rootNode.getBaseURI(); assertWithMessage("Exception is excepted").fail(); -@@ -302,7 +302,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -321,7 +321,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54732,7 +51917,7 @@ try { rootNode.saveLocation(); assertWithMessage("Exception is excepted").fail(); -@@ -314,7 +314,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -333,7 +333,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54741,7 +51926,7 @@ try { rootNode.getUnicodeStringValue(); assertWithMessage("Exception is excepted").fail(); -@@ -326,7 +326,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -345,7 +345,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54750,7 +51935,7 @@ try { rootNode.getFingerprint(); assertWithMessage("Exception is excepted").fail(); -@@ -338,7 +338,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -357,7 +357,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54759,7 +51944,7 @@ try { rootNode.getDisplayName(); assertWithMessage("Exception is excepted").fail(); -@@ -350,7 +350,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -369,7 +369,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54768,7 +51953,7 @@ try { rootNode.getPrefix(); assertWithMessage("Exception is excepted").fail(); -@@ -362,7 +362,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -381,7 +381,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54777,7 +51962,7 @@ try { rootNode.getSchemaType(); assertWithMessage("Exception is excepted").fail(); -@@ -374,7 +374,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -393,7 +393,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54786,7 +51971,7 @@ try { rootNode.atomize(); assertWithMessage("Exception is excepted").fail(); -@@ -386,7 +386,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -405,7 +405,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54795,7 +51980,7 @@ try { rootNode.generateId(null); assertWithMessage("Exception is excepted").fail(); -@@ -398,7 +398,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -417,7 +417,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54804,7 +51989,7 @@ try { rootNode.copy(null, -1, null); assertWithMessage("Exception is excepted").fail(); -@@ -410,7 +410,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -429,7 +429,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -54813,7 +51998,7 @@ try { rootNode.getAllNamespaces(); assertWithMessage("Exception is excepted").fail(); -@@ -422,7 +422,7 @@ public class RootNodeTest extends AbstractPathTestSupport { +@@ -441,7 +441,7 @@ public class RootNodeTest extends AbstractPathTestSupport { } @Test @@ -56118,56 +53303,60 @@ }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheckExamplesTest.java -@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Disabled; +@@ -24,7 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharacte + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class AvoidEscapedUnicodeCharactersCheckExamplesTest +final class AvoidEscapedUnicodeCharactersCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override protected String getPackageLocation() { -@@ -32,35 +32,35 @@ public class AvoidEscapedUnicodeCharactersCheckExamplesTest +@@ -32,7 +32,7 @@ public class AvoidEscapedUnicodeCharactersCheckExamplesTest } @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "16:24: " + getCheckMessage(MSG_KEY), + "18:24: " + getCheckMessage(MSG_KEY), +@@ -45,7 +45,7 @@ public class AvoidEscapedUnicodeCharactersCheckExamplesTest } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "18:24: " + getCheckMessage(MSG_KEY), + "20:24: " + getCheckMessage(MSG_KEY), +@@ -57,7 +57,7 @@ public class AvoidEscapedUnicodeCharactersCheckExamplesTest } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "18:24: " + getCheckMessage(MSG_KEY), + "20:24: " + getCheckMessage(MSG_KEY), +@@ -69,7 +69,7 @@ public class AvoidEscapedUnicodeCharactersCheckExamplesTest } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String[] expected = { + "18:24: " + getCheckMessage(MSG_KEY), + "22:24: " + getCheckMessage(MSG_KEY), +@@ -80,7 +80,7 @@ public class AvoidEscapedUnicodeCharactersCheckExamplesTest } @Test - public void testExample5() throws Exception { + void example5() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example5.txt"), expected); + final String[] expected = { + "18:24: " + getCheckMessage(MSG_KEY, "unitAbbrev1"), + "20:24: " + getCheckMessage(MSG_KEY), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckExamplesTest.java @@ -24,119 +24,119 @@ import org.junit.jupiter.api.Disabled; @@ -56643,10 +53832,10 @@ verifyWithInlineConfigParser(getPath("Example3.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheckExamplesTest.java -@@ -24,14 +24,14 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.UpperEllCheck.MSG_KEY; + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class UpperEllCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class UpperEllCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56657,15 +53846,15 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "13:15: " + getCheckMessage(MSG_KEY, "L"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationExamplesTest.java -@@ -24,35 +24,35 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocati + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class AnnotationLocationExamplesTest extends AbstractExamplesModuleTestSupport { +final class AnnotationLocationExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56676,9 +53865,10 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "31:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "SuppressWarnings"), + "33:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "SuppressWarnings"), +@@ -42,14 +42,14 @@ public class AnnotationLocationExamplesTest extends AbstractExamplesModuleTestSu } @Test @@ -56686,23 +53876,24 @@ + void example2() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + verifyWithInlineConfigParser(getPath("Example2.java"), expected); } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "24:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "Nonnull"), + "26:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "Override"), +@@ -61,7 +61,7 @@ public class AnnotationLocationExamplesTest extends AbstractExamplesModuleTestSu } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String[] expected = { + "33:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "SuppressWarnings"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheckExamplesTest.java @@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationOnSame @@ -56779,7 +53970,7 @@ "26:37: " + getCheckMessage(MSG_KEY_ANNOTATION_TRAILING_COMMA_MISSING), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheckExamplesTest.java -@@ -25,14 +25,14 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.MissingDeprecate +@@ -25,14 +25,14 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocChec import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; @@ -56804,7 +53995,7 @@ + void example2() throws Exception { final String[] expected = { "20: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_DEPRECATED), - "32: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), + "32: " + getCheckMessage(MSG_KEY_UNCLOSED_HTML_TAG, "p"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheckExamplesTest.java @@ -25,7 +25,7 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideC @@ -56836,10 +54027,10 @@ "30:3: " + getCheckMessage(MSG_KEY_ANNOTATION_MISSING_OVERRIDE, "test"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotatio + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class PackageAnnotationCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class PackageAnnotationCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56850,9 +54041,10 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "13:1: " + getCheckMessage(MSG_KEY), + }; +@@ -40,14 +40,14 @@ public class PackageAnnotationCheckExamplesTest extends AbstractExamplesModuleTe } @Test @@ -56860,7 +54052,7 @@ + void example2() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + verifyWithInlineConfigParser(getPath("Example2.java"), expected); } @Test @@ -56868,7 +54060,7 @@ + void example3() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + verifyWithInlineConfigParser(getPath("example3/package-info.java"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheckExamplesTest.java @@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.annotation.SuppressWarnings @@ -56899,10 +54091,10 @@ "44:32: " + getCheckMessage(MSG_KEY_SUPPRESSED_WARNING_NOT_ALLOWED, "unused"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsHolderExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsHolderExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -27,14 +27,14 @@ import com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck; + import com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceAfterCheck; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class SuppressWarningsHolderExamplesTest extends AbstractExamplesModuleTestSupport { +final class SuppressWarningsHolderExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56913,23 +54105,24 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String pattern1 = "^[a-z][a-zA-Z0-9]*$"; + final String pattern2 = "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"; + final String[] expected = { +@@ -55,7 +55,7 @@ public class SuppressWarningsHolderExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "19:15: " + getCheckMessage(ParameterNumberCheck.class, ParameterNumberCheck.MSG_KEY, 7, 8), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.AvoidNestedBlocksChe + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class AvoidNestedBlocksCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class AvoidNestedBlocksCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56940,23 +54133,24 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "17:5: " + getCheckMessage(MSG_KEY_BLOCK_NESTED), + "23:15: " + getCheckMessage(MSG_KEY_BLOCK_NESTED), +@@ -41,7 +41,7 @@ public class AvoidNestedBlocksCheckExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "19:5: " + getCheckMessage(MSG_KEY_BLOCK_NESTED), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -25,14 +25,14 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck.MSG_ + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class EmptyBlockCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class EmptyBlockCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56967,31 +54161,33 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "14:34: " + getCheckMessage(MSG_KEY_BLOCK_NO_STATEMENT, "for"), + "17:9: " + getCheckMessage(MSG_KEY_BLOCK_NO_STATEMENT, "try"), +@@ -42,7 +42,7 @@ public class EmptyBlockCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "21:9: " + getCheckMessage(MSG_KEY_BLOCK_EMPTY, "try"), + }; +@@ -51,7 +51,7 @@ public class EmptyBlockCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "24:16: " + getCheckMessage(MSG_KEY_BLOCK_NO_STATEMENT, "default"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckExamplesTest.java -@@ -24,35 +24,35 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.EmptyCatchBlockCheck + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class EmptyCatchBlockCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class EmptyCatchBlockCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -57002,33 +54198,45 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "16:41: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), + "31:34: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), +@@ -41,7 +41,7 @@ public class EmptyCatchBlockCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "33:34: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), + }; +@@ -50,7 +50,7 @@ public class EmptyCatchBlockCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "18:41: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), + "25:39: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), +@@ -61,7 +61,7 @@ public class EmptyCatchBlockCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; + final String[] expected = { + "51:34: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), + }; +@@ -70,7 +70,7 @@ public class EmptyCatchBlockCheckExamplesTest extends AbstractExamplesModuleTest + } - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + @Test +- public void testExample5() throws Exception { ++ void example5() throws Exception { + final String[] expected = { + "18:34: " + getCheckMessage(MSG_KEY_CATCH_BLOCK_EMPTY), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckExamplesTest.java @@ -26,14 +26,14 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck.MSG_K @@ -57187,10 +54395,10 @@ verifyWithInlineConfigParser(getPath("Example5.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.ArrayTrailingCommaCh + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class ArrayTrailingCommaCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class ArrayTrailingCommaCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -57201,17 +54409,18 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "17:5: " + getCheckMessage(MSG_KEY), "25:5: " + getCheckMessage(MSG_KEY), + }; +@@ -40,7 +40,7 @@ public class ArrayTrailingCommaCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "15:26: " + getCheckMessage(MSG_KEY), + "19:5: " + getCheckMessage(MSG_KEY), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheckExamplesTest.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Disabled; @@ -57386,10 +54595,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheckExamplesTest.java -@@ -24,14 +24,14 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck. + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class EmptyStatementCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class EmptyStatementCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -57400,9 +54609,9 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "15:14: " + getCheckMessage(MSG_KEY), "17:28: " + getCheckMessage(MSG_KEY), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheckExamplesTest.java @@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; @@ -57869,10 +55078,10 @@ verifyWithInlineConfigParser(getPath("Example7.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheckExamplesTest.java -@@ -24,14 +24,14 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class InnerAssignmentCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class InnerAssignmentCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -57883,9 +55092,9 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "21:11: " + getCheckMessage(MSG_KEY), + "22:11: " + getCheckMessage(MSG_KEY), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheckExamplesTest.java @@ -24,49 +24,49 @@ import org.junit.jupiter.api.Disabled; @@ -58413,10 +55622,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckExamplesTest.java -@@ -24,14 +24,14 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.ParameterAssignmentC + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class ParameterAssignmentCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class ParameterAssignmentCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -58427,9 +55636,9 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "21:15: " + getCheckMessage(MSG_KEY, "parameter"), + "34:27: " + getCheckMessage(MSG_KEY, "a"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckExamplesTest.java @@ -24,49 +24,49 @@ import org.junit.jupiter.api.Disabled; @@ -59269,10 +56478,10 @@ verifyWithInlineConfigParser(getPath("Example5.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckExamplesTest.java -@@ -24,49 +24,49 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportChec + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59283,55 +56492,60 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "13:15: " + getCheckMessage(MSG_KEY, "java.io.*"), + "14:29: " + getCheckMessage(MSG_KEY, "java.lang.Math.*"), +@@ -43,7 +43,7 @@ public class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "17:17: " + getCheckMessage(MSG_KEY, "java.util.*"), + }; +@@ -52,7 +52,7 @@ public class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "16:29: " + getCheckMessage(MSG_KEY, "java.lang.Math.*"), + }; +@@ -61,7 +61,7 @@ public class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String[] expected = { + "15:15: " + getCheckMessage(MSG_KEY, "java.io.*"), + "17:17: " + getCheckMessage(MSG_KEY, "java.util.*"), +@@ -72,7 +72,7 @@ public class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample5() throws Exception { + void example5() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example5.txt"), expected); + final String[] expected = { + "17:29: " + getCheckMessage(MSG_KEY, "java.lang.Math.*"), + }; +@@ -81,7 +81,7 @@ public class AvoidStarImportCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample6() throws Exception { + void example6() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example6.txt"), expected); + final String[] expected = { + "18:17: " + getCheckMessage(MSG_KEY, "java.util.*"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.imports.AvoidStaticImportCh + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class AvoidStaticImportCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class AvoidStaticImportCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59342,17 +56556,18 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "12:29: " + getCheckMessage(MSG_KEY, "java.lang.Math.pow"), + "13:31: " + getCheckMessage(MSG_KEY, "java.lang.System.*"), +@@ -41,7 +41,7 @@ public class AvoidStaticImportCheckExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "16:32: " + getCheckMessage(MSG_KEY, "java.lang.Integer.parseInt"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheckExamplesTest.java @@ -24,112 +24,112 @@ import org.junit.jupiter.api.Disabled; @@ -59676,10 +56891,10 @@ verifyWithInlineConfigParser(getPath("Example12.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheckExamplesTest.java -@@ -24,14 +24,14 @@ import org.junit.jupiter.api.Disabled; +@@ -26,14 +26,14 @@ import static com.puppycrawl.tools.checkstyle.checks.imports.RedundantImportChec + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class RedundantImportCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class RedundantImportCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59690,15 +56905,15 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "16:1: " + + getCheckMessage( --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck. + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class UnusedImportsCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class UnusedImportsCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59709,17 +56924,18 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "19:8: " + getCheckMessage(MSG_KEY, "java.lang.String"), + "22:8: " + getCheckMessage(MSG_KEY, "java.util.Map"), +@@ -41,7 +41,7 @@ public class UnusedImportsCheckExamplesTest extends AbstractExamplesModuleTestSu } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "21:8: " + getCheckMessage(MSG_KEY, "java.lang.String"), + "24:8: " + getCheckMessage(MSG_KEY, "java.util.Map"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheckExamplesTest.java @@ -24,77 +24,77 @@ import org.junit.jupiter.api.Disabled; @@ -59875,10 +57091,10 @@ verifyWithInlineConfigParser(getPath("Example1.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheckExamplesTest.java -@@ -24,14 +24,14 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.InvalidJavadocPosit + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class InvalidJavadocPositionCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class InvalidJavadocPositionCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59889,15 +57105,15 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "14:1: " + getCheckMessage(MSG_KEY), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -22,28 +22,28 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class JavadocBlockTagLocationCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class JavadocBlockTagLocationCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59910,7 +57126,7 @@ + void example1() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + verifyWithInlineConfigParser(getPath("Example1.java"), expected); } @Test @@ -59918,13 +57134,21 @@ + void example2() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + verifyWithInlineConfigParser(getPath("Example2.java"), expected); + } + + @Test +- public void testExample3() throws Exception { ++ void example3() throws Exception { + final String[] expected = {}; + + verifyWithInlineConfigParser(getPath("Example3.java"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -25,14 +25,14 @@ import static com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocContentLocat + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class JavadocContentLocationCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class JavadocContentLocationCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59935,17 +57159,18 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "15:3: " + getCheckMessage(MSG_JAVADOC_CONTENT_SECOND_LINE), + }; +@@ -41,7 +41,7 @@ public class JavadocContentLocationCheckExamplesTest extends AbstractExamplesMod } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "22:3: " + getCheckMessage(MSG_JAVADOC_CONTENT_FIRST_LINE), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheckExamplesTest.java @@ -24,56 +24,56 @@ import org.junit.jupiter.api.Disabled; @@ -61217,10 +58442,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractClassNameChe + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class ClassTypeParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class ClassTypeParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61231,25 +58456,27 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String pattern = "^[A-Z]$"; + final String[] expected = { + "14:18: " + getCheckMessage(MSG_ILLEGAL_ABSTRACT_CLASS_NAME, "t", pattern), +@@ -44,7 +44,7 @@ public class ClassTypeParameterNameCheckExamplesTest extends AbstractExamplesMod } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String pattern = "^[A-Z]{2,}$"; + final String[] expected = { + "15:18: " + getCheckMessage(MSG_ILLEGAL_ABSTRACT_CLASS_NAME, "T", pattern), +@@ -57,7 +57,7 @@ public class ClassTypeParameterNameCheckExamplesTest extends AbstractExamplesMod } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String pattern = "(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"; + final String[] expected = { + "16:18: " + getCheckMessage(MSG_ILLEGAL_ABSTRACT_CLASS_NAME, "t", pattern), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckExamplesTest.java @@ -24,7 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck.MS @@ -61317,10 +58544,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/InterfaceTypeParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/InterfaceTypeParameterNameCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class InterfaceTypeParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class InterfaceTypeParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61331,23 +58558,24 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "14:29: " + getCheckMessage(MSG_INVALID_PATTERN, "t", "^[A-Z]$"), +@@ -41,7 +41,7 @@ public class InterfaceTypeParameterNameCheckExamplesTest extends AbstractExample } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "17:28: " + getCheckMessage(MSG_INVALID_PATTERN, "type", "^[a-zA-Z]$"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class LambdaParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class LambdaParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61358,23 +58586,24 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "17:11: " + getCheckMessage(MSG_INVALID_PATTERN, "S", "^[a-z][a-zA-Z0-9]*$"), + }; +@@ -40,7 +40,7 @@ public class LambdaParameterNameCheckExamplesTest extends AbstractExamplesModule } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "20:40: " + getCheckMessage(MSG_INVALID_PATTERN, "_s", "^[a-z]([a-zA-Z]+)*$"), + "25:23: " + getCheckMessage(MSG_INVALID_PATTERN, "Word", "^[a-z]([a-zA-Z]+)*$"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class LocalFinalVariableNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class LocalFinalVariableNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61385,31 +58614,33 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "17:17: " + getCheckMessage(MSG_INVALID_PATTERN, "VAR1", "^[a-z][a-zA-Z0-9]*$"), + "20:17: " + getCheckMessage(MSG_INVALID_PATTERN, "VAR2", "^[a-z][a-zA-Z0-9]*$"), +@@ -41,7 +41,7 @@ public class LocalFinalVariableNameCheckExamplesTest extends AbstractExamplesMod } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "18:17: " + getCheckMessage(MSG_INVALID_PATTERN, "var1", "^[A-Z][A-Z0-9]*$"), + "21:17: " + getCheckMessage(MSG_INVALID_PATTERN, "var2", "^[A-Z][A-Z0-9]*$"), +@@ -51,7 +51,7 @@ public class LocalFinalVariableNameCheckExamplesTest extends AbstractExamplesMod } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "19:17: " + getCheckMessage(MSG_INVALID_PATTERN, "scanner", "^[A-Z][A-Z0-9]*$"), + "23:30: " + getCheckMessage(MSG_INVALID_PATTERN, "ex", "^[A-Z][A-Z0-9]*$"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckExamplesTest.java -@@ -24,42 +24,42 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class LocalVariableNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class LocalVariableNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61420,41 +58651,45 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String pattern = "^[a-z][a-zA-Z0-9]*$"; + final String[] expected = { + "15:14: " + getCheckMessage(MSG_INVALID_PATTERN, "VAR", pattern), +@@ -42,7 +42,7 @@ public class LocalVariableNameCheckExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String pattern = "^[a-z](_?[a-zA-Z0-9]+)*$"; + final String[] expected = { + "17:14: " + getCheckMessage(MSG_INVALID_PATTERN, "VAR", pattern), +@@ -52,7 +52,7 @@ public class LocalVariableNameCheckExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String pattern = "^[a-z](_?[a-zA-Z0-9]+)*$"; + final String[] expected = { + "20:13: " + getCheckMessage(MSG_INVALID_PATTERN, "K", pattern), +@@ -63,7 +63,7 @@ public class LocalVariableNameCheckExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String pattern = "^[a-z][_a-zA-Z0-9]+$"; + final String[] expected = { + "21:9: " + getCheckMessage(MSG_INVALID_PATTERN, "g", pattern), +@@ -77,7 +77,7 @@ public class LocalVariableNameCheckExamplesTest extends AbstractExamplesModuleTe } @Test - public void testExample5() throws Exception { + void example5() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example5.txt"), expected); + final String pattern = "^[a-z][_a-zA-Z0-9]{2,}$"; + final String[] expected = { + "17:9: " + getCheckMessage(MSG_INVALID_PATTERN, "i", pattern), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheckExamplesTest.java @@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.MemberNameCheck.MSG_ @@ -61548,10 +58783,10 @@ "20:8: " + getCheckMessage(MSG_INVALID_PATTERN, "Method4", "^[a-z](_?[a-zA-Z0-9]+)*$"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodTypeParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodTypeParameterNameCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class MethodTypeParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class MethodTypeParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61562,9 +58797,10 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "14:11: " + getCheckMessage(MSG_INVALID_PATTERN, "a", "^[A-Z]$"), + "16:11: " + getCheckMessage(MSG_INVALID_PATTERN, "k", "^[A-Z]$"), +@@ -41,7 +41,7 @@ public class MethodTypeParameterNameCheckExamplesTest extends AbstractExamplesMo } @Test @@ -61572,7 +58808,7 @@ + void example2() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + verifyWithInlineConfigParser(getPath("Example2.java"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckExamplesTest.java @@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; @@ -61602,10 +58838,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckExamplesTest.java -@@ -24,42 +24,42 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheck.M + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class ParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class ParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61616,41 +58852,45 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "14:20: " + getCheckMessage(MSG_INVALID_PATTERN, "V2", "^[a-z][a-zA-Z0-9]*$"), + }; +@@ -40,7 +40,7 @@ public class ParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSu } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "17:20: " + getCheckMessage(MSG_INVALID_PATTERN, "V3", "^[a-z][_a-zA-Z0-9]+$"), + }; +@@ -49,7 +49,7 @@ public class ParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSu } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "16:20: " + getCheckMessage(MSG_INVALID_PATTERN, "V2", "^[a-z][a-zA-Z0-9]*$"), + }; +@@ -58,7 +58,7 @@ public class ParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSu } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String[] expected = { + "16:20: " + getCheckMessage(MSG_INVALID_PATTERN, "v_2", "^[a-z][a-zA-Z0-9]+$"), + "17:20: " + getCheckMessage(MSG_INVALID_PATTERN, "V3", "^[a-z][a-zA-Z0-9]+$"), +@@ -68,7 +68,7 @@ public class ParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSu } @Test - public void testExample5() throws Exception { + void example5() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example5.txt"), expected); + final String[] expected = { + "25:26: " + "Parameter name 'V2' must match pattern '^[a-z]([a-z0-9][a-zA-Z0-9]*)?$'", + "27:23: " + "Parameter name 'b' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'", --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckExamplesTest.java @@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; @@ -61777,10 +59017,10 @@ verifyWithInlineConfigParser(getPath("Example3.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class TypeNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class TypeNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -61791,25 +59031,27 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "15:8: " + getCheckMessage(MSG_INVALID_PATTERN, "Third_Name", "^[A-Z][a-zA-Z0-9]*$"), + "16:17: " + getCheckMessage(MSG_INVALID_PATTERN, "FourthName_", "^[A-Z][a-zA-Z0-9]*$"), +@@ -41,7 +41,7 @@ public class TypeNameCheckExamplesTest extends AbstractExamplesModuleTestSupport } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "16:7: " + getCheckMessage(MSG_INVALID_PATTERN, "Example2", "^[a-z](_?[a-zA-Z0-9]+)*$"), + "18:16: " + getCheckMessage(MSG_INVALID_PATTERN, "SecondName", "^[a-z](_?[a-zA-Z0-9]+)*$"), +@@ -51,7 +51,7 @@ public class TypeNameCheckExamplesTest extends AbstractExamplesModuleTestSupport } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "19:13: " + getCheckMessage(MSG_INVALID_PATTERN, "SecondName", "^I_[a-zA-Z0-9]*$"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckExamplesTest.java @@ -24,98 +24,98 @@ import org.junit.jupiter.api.Disabled; diff --git a/integration-tests/checkstyle-10.12.7-expected-warnings.txt b/integration-tests/checkstyle-10.12.7-expected-warnings.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/integration-tests/checkstyle-10.12.4-init.patch b/integration-tests/checkstyle-10.12.7-init.patch similarity index 82% rename from integration-tests/checkstyle-10.12.4-init.patch rename to integration-tests/checkstyle-10.12.7-init.patch index 59e551e763..0a357c6b16 100644 --- a/integration-tests/checkstyle-10.12.4-init.patch +++ b/integration-tests/checkstyle-10.12.7-init.patch @@ -1,7 +1,7 @@ --- a/pom.xml +++ b/pom.xml -@@ -334,6 +334,12 @@ - 1.1.3 +@@ -349,6 +349,12 @@ + 1.2.0 test + @@ -13,59 +13,42 @@ nl.jqno.equalsverifier equalsverifier -@@ -2397,8 +2403,10 @@ - -Xpkginfo:always - -XDcompilePolicy=simple +@@ -2396,6 +2402,8 @@ -- -Xplugin:ErrorProne -+ -Xplugin:ErrorProne ${error-prone.flags} + -Xplugin:ErrorProne ${error-prone.configuration-args} + -Xmaxwarns + 1000000 -@@ -2406,6 +2414,16 @@ - error_prone_core - ${error-prone.version} +@@ -2405,7 +2413,7 @@ -+ -+ tech.picnic.error-prone-support -+ error-prone-contrib -+ ${error-prone-support.version} -+ -+ -+ tech.picnic.error-prone-support + + tech.picnic.error-prone-support +- error-prone-contrib + refaster-runner -+ ${error-prone-support.version} -+ + ${error-prone-support.version} + - - -@@ -2449,9 +2467,10 @@ - -Xpkginfo:always +@@ -2452,9 +2460,10 @@ -XDcompilePolicy=simple -- -Xplugin:ErrorProne \ -- -XepExcludedPaths:.*[\\/]resources[\\/].* -+ -Xplugin:ErrorProne ${error-prone.flags} + -Xplugin:ErrorProne \ +- -XepExcludedPaths:.*[\\/]resources[\\/].* \ + ${error-prone.configuration-args} + -Xmaxwarns + 1000000 -@@ -2459,6 +2478,16 @@ - error_prone_core - ${error-prone.version} +@@ -2467,6 +2476,11 @@ + error-prone-contrib + ${error-prone-support.version} + + tech.picnic.error-prone-support -+ error-prone-contrib -+ ${error-prone-support.version} -+ -+ -+ tech.picnic.error-prone-support + refaster-runner + ${error-prone-support.version} + @@ -108,7 +91,7 @@ .replace(RESULTS_PLACEHOLDER, String.join(",\n", results)); --- a/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java -@@ -419,6 +419,10 @@ public final class SiteUtil { +@@ -520,6 +520,10 @@ public final class SiteUtil { * @return a set of properties for the given class. */ public static Set getPropertiesForDocumentation(Class clss, Object instance) { @@ -132,7 +115,7 @@ @TempDir --- a/src/test/java/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/ConfigurationLoaderTest.java -@@ -46,6 +46,8 @@ import com.puppycrawl.tools.checkstyle.internal.utils.TestUtil; +@@ -47,6 +47,8 @@ import com.puppycrawl.tools.checkstyle.internal.utils.TestUtil; /** * Unit test for ConfigurationLoader. */ @@ -175,7 +158,7 @@ final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/TreeWalkerTest.java -@@ -79,6 +79,8 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +@@ -81,6 +81,8 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; * @noinspectionreason ClassWithTooManyDependencies - complex tests require a * large number of imports */ diff --git a/integration-tests/checkstyle-10.12.4.sh b/integration-tests/checkstyle-10.12.7.sh similarity index 97% rename from integration-tests/checkstyle-10.12.4.sh rename to integration-tests/checkstyle-10.12.7.sh index 5c5e5e0af3..26494f0b27 100755 --- a/integration-tests/checkstyle-10.12.4.sh +++ b/integration-tests/checkstyle-10.12.7.sh @@ -9,7 +9,7 @@ repos_root="${integration_test_root}/.repos" test_name="$(basename "${0}" .sh)" project=checkstyle repository=https://github.com/checkstyle/checkstyle.git -revision=checkstyle-10.12.4 +revision=checkstyle-10.12.7 if [ "${#}" -gt 2 ] || ([ "${#}" = 2 ] && [ "${1:---sync}" != '--sync' ]); then echo "Usage: ${0} [--sync] []" @@ -116,7 +116,7 @@ function apply_patch() { mvn ${shared_build_flags} ${extra_build_args} \ package "${format_goal}" \ - -Derror-prone.flags="${error_prone_patch_flags}" \ + -Derror-prone.configuration-args="${error_prone_patch_flags}" \ -DskipTests if ! git diff --exit-code; then @@ -147,7 +147,7 @@ apply_patch '' validation_build_log="${report_directory}/${test_name}-validation-build-log.txt" mvn ${shared_build_flags} \ clean package \ - -Derror-prone.flags="${error_prone_validation_flags}" \ + -Derror-prone.configuration-args="${error_prone_validation_flags}" \ -Dtest=' !MetadataGeneratorUtilTest#metadataFilesGenerationAllFiles, !XdocsJavaDocsTest#allCheckSectionJavaDocs' \ From 2af4f79dd09691e842278a8cb219d0f0c353a412 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 27 Jan 2024 14:34:03 +0100 Subject: [PATCH 3/6] Doh --- .github/workflows/run-integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 303cb41979..104b9ccc26 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -28,12 +28,12 @@ jobs: - name: Install project to local Maven repository run: mvn -T1C install -DskipTests -Dverification.skip - name: Run integration test - run: xvfb-run ./integration-tests/checkstyle-10.12.4.sh "${{ runner.temp }}/artifacts" + run: xvfb-run ./integration-tests/checkstyle-10.12.7.sh "${{ runner.temp }}/artifacts" - name: Upload artifacts on failure if: ${{ failure() }} uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: - name: integration-test-checkstyle-10.12.4 + name: integration-test-checkstyle-10.12.7 path: "${{ runner.temp }}/artifacts" - name: Remove installed project artifacts run: mvn build-helper:remove-project-artifact From 33bf6a956355021a9ca044f7139dd3809d40a66a Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 27 Jan 2024 15:14:46 +0100 Subject: [PATCH 4/6] Drop tag from filenames --- .github/workflows/run-integration-tests.yml | 4 ++-- ...pected-changes.patch => checkstyle-expected-changes.patch} | 0 ...expected-warnings.txt => checkstyle-expected-warnings.txt} | 0 .../{checkstyle-10.12.7-init.patch => checkstyle-init.patch} | 0 integration-tests/{checkstyle-10.12.7.sh => checkstyle.sh} | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename integration-tests/{checkstyle-10.12.7-expected-changes.patch => checkstyle-expected-changes.patch} (100%) rename integration-tests/{checkstyle-10.12.7-expected-warnings.txt => checkstyle-expected-warnings.txt} (100%) rename integration-tests/{checkstyle-10.12.7-init.patch => checkstyle-init.patch} (100%) rename integration-tests/{checkstyle-10.12.7.sh => checkstyle.sh} (100%) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 104b9ccc26..b129c2f787 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -28,12 +28,12 @@ jobs: - name: Install project to local Maven repository run: mvn -T1C install -DskipTests -Dverification.skip - name: Run integration test - run: xvfb-run ./integration-tests/checkstyle-10.12.7.sh "${{ runner.temp }}/artifacts" + run: xvfb-run ./integration-tests/checkstyle.sh "${{ runner.temp }}/artifacts" - name: Upload artifacts on failure if: ${{ failure() }} uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 with: - name: integration-test-checkstyle-10.12.7 + name: integration-test-checkstyle path: "${{ runner.temp }}/artifacts" - name: Remove installed project artifacts run: mvn build-helper:remove-project-artifact diff --git a/integration-tests/checkstyle-10.12.7-expected-changes.patch b/integration-tests/checkstyle-expected-changes.patch similarity index 100% rename from integration-tests/checkstyle-10.12.7-expected-changes.patch rename to integration-tests/checkstyle-expected-changes.patch diff --git a/integration-tests/checkstyle-10.12.7-expected-warnings.txt b/integration-tests/checkstyle-expected-warnings.txt similarity index 100% rename from integration-tests/checkstyle-10.12.7-expected-warnings.txt rename to integration-tests/checkstyle-expected-warnings.txt diff --git a/integration-tests/checkstyle-10.12.7-init.patch b/integration-tests/checkstyle-init.patch similarity index 100% rename from integration-tests/checkstyle-10.12.7-init.patch rename to integration-tests/checkstyle-init.patch diff --git a/integration-tests/checkstyle-10.12.7.sh b/integration-tests/checkstyle.sh similarity index 100% rename from integration-tests/checkstyle-10.12.7.sh rename to integration-tests/checkstyle.sh From 59c09b5949344bc0f4924350a7611cec4af94e09 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sun, 28 Jan 2024 11:06:14 +0100 Subject: [PATCH 5/6] Fix issue --- .../checkstyle-expected-changes.patch | 3440 +++++++++++++++++ .../checkstyle-expected-warnings.txt | 139 + integration-tests/checkstyle-init.patch | 19 +- 3 files changed, 3590 insertions(+), 8 deletions(-) diff --git a/integration-tests/checkstyle-expected-changes.patch b/integration-tests/checkstyle-expected-changes.patch index 41af90329b..eac8d9afbf 100644 --- a/integration-tests/checkstyle-expected-changes.patch +++ b/integration-tests/checkstyle-expected-changes.patch @@ -9608,6 +9608,3446 @@ "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + "@text='SuppressionXpathRegressionWhitespaceAroundNotFollowed']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN"); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java +@@ -275,8 +275,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali + /** A converter that converts a string to a pattern. */ + private static final class PatternConverter implements Converter { + +- @SuppressWarnings("unchecked") + @Override ++ @SuppressWarnings("unchecked") + public Object convert(Class type, Object value) { + return CommonUtil.createPattern(value.toString()); + } +@@ -285,8 +285,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali + /** A converter that converts strings to severity level. */ + private static final class SeverityLevelConverter implements Converter { + +- @SuppressWarnings("unchecked") + @Override ++ @SuppressWarnings("unchecked") + public Object convert(Class type, Object value) { + return SeverityLevel.getInstance(value.toString()); + } +@@ -295,8 +295,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali + /** A converter that converts strings to scope. */ + private static final class ScopeConverter implements Converter { + +- @SuppressWarnings("unchecked") + @Override ++ @SuppressWarnings("unchecked") + public Object convert(Class type, Object value) { + return Scope.getInstance(value.toString()); + } +@@ -305,8 +305,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali + /** A converter that converts strings to uri. */ + private static final class UriConverter implements Converter { + +- @SuppressWarnings("unchecked") + @Override ++ @SuppressWarnings("unchecked") + public Object convert(Class type, Object value) { + final String url = value.toString(); + URI result = null; +@@ -329,8 +329,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali + */ + private static final class RelaxedStringArrayConverter implements Converter { + +- @SuppressWarnings("unchecked") + @Override ++ @SuppressWarnings("unchecked") + public Object convert(Class type, Object value) { + final StringTokenizer tokenizer = + new StringTokenizer(value.toString().trim(), COMMA_SEPARATOR); +@@ -355,8 +355,8 @@ public abstract class AbstractAutomaticBean implements Configurable, Contextuali + /** Constant for optimization. */ + private static final AccessModifierOption[] EMPTY_MODIFIER_ARRAY = new AccessModifierOption[0]; + +- @SuppressWarnings("unchecked") + @Override ++ @SuppressWarnings("unchecked") + public Object convert(Class type, Object value) { + // Converts to a String and trims it for the tokenizer. + final StringTokenizer tokenizer = +--- a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++import static com.google.common.collect.ImmutableSet.toImmutableSet; ++ + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; + import com.puppycrawl.tools.checkstyle.api.BeforeExecutionFileFilter; +@@ -50,7 +53,6 @@ import java.util.Locale; + import java.util.Set; + import java.util.SortedSet; + import java.util.TreeSet; +-import java.util.stream.Collectors; + import java.util.stream.Stream; + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; +@@ -215,7 +217,7 @@ public class Checker extends AbstractAutomaticBean implements MessageDispatcher, + final List targetFiles = + files.stream() + .filter(file -> CommonUtil.matchesFileExtension(file, fileExtensions)) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + processFiles(targetFiles); + + // Finish up +@@ -244,7 +246,7 @@ public class Checker extends AbstractAutomaticBean implements MessageDispatcher, + resource -> { + return ((ExternalResourceHolder) resource).getExternalResourceLocations().stream(); + }) +- .collect(Collectors.toSet()); ++ .collect(toImmutableSet()); + } + + /** Notify all listeners about the audit start. */ +--- a/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkState; ++ + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.api.Configuration; + import com.puppycrawl.tools.checkstyle.api.SeverityLevel; +@@ -523,9 +525,7 @@ public final class ConfigurationLoader { + final DefaultConfiguration top = configStack.peek(); + top.addMessage(key, value); + } else { +- if (!METADATA.equals(qName)) { +- throw new IllegalStateException("Unknown name:" + qName + "."); +- } ++ checkState(METADATA.equals(qName), "Unknown name:%s.", qName); + } + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static java.nio.charset.StandardCharsets.UTF_8; ++ + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; + import com.puppycrawl.tools.checkstyle.api.AutomaticBean; +@@ -27,7 +30,6 @@ import java.io.OutputStream; + import java.io.OutputStreamWriter; + import java.io.PrintWriter; + import java.io.Writer; +-import java.nio.charset.StandardCharsets; + + /** + * Simple plain logger for text output. This is maybe not very suitable for a text output into a +@@ -126,21 +128,17 @@ public class DefaultLogger extends AbstractAutomaticBean implements AuditListene + OutputStream errorStream, + OutputStreamOptions errorStreamOptions, + AuditEventFormatter messageFormatter) { +- if (infoStreamOptions == null) { +- throw new IllegalArgumentException("Parameter infoStreamOptions can not be null"); +- } ++ checkArgument(infoStreamOptions != null, "Parameter infoStreamOptions can not be null"); + closeInfo = infoStreamOptions == OutputStreamOptions.CLOSE; +- if (errorStreamOptions == null) { +- throw new IllegalArgumentException("Parameter errorStreamOptions can not be null"); +- } ++ checkArgument(errorStreamOptions != null, "Parameter errorStreamOptions can not be null"); + closeError = errorStreamOptions == OutputStreamOptions.CLOSE; +- final Writer infoStreamWriter = new OutputStreamWriter(infoStream, StandardCharsets.UTF_8); ++ final Writer infoStreamWriter = new OutputStreamWriter(infoStream, UTF_8); + infoWriter = new PrintWriter(infoStreamWriter); + + if (infoStream == errorStream) { + errorWriter = infoWriter; + } else { +- final Writer errorStreamWriter = new OutputStreamWriter(errorStream, StandardCharsets.UTF_8); ++ final Writer errorStreamWriter = new OutputStreamWriter(errorStream, UTF_8); + errorWriter = new PrintWriter(errorStreamWriter); + } + formatter = messageFormatter; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle; + ++import com.google.common.collect.ImmutableSet; + import java.util.Set; + + /** Contains constant definitions common to the package. */ +@@ -29,7 +30,7 @@ public final class Definitions { + + /** Name of modules which are not checks, but are internal modules. */ + public static final Set INTERNAL_MODULES = +- Set.of( ++ ImmutableSet.of( + "com.puppycrawl.tools.checkstyle.meta.JavadocMetadataScraper", + "com.puppycrawl.tools.checkstyle.site.ClassAndPropertiesSettersJavadocScraper"); + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java +@@ -19,19 +19,21 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.Objects.requireNonNullElseGet; ++import static java.util.stream.Collectors.toCollection; ++ ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageLexer; + import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParser; + import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageParserBaseVisitor; + import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import java.util.ArrayList; +-import java.util.Collections; + import java.util.Iterator; + import java.util.List; +-import java.util.Optional; + import java.util.Queue; + import java.util.concurrent.ConcurrentLinkedQueue; +-import java.util.stream.Collectors; + import org.antlr.v4.runtime.BufferedTokenStream; + import org.antlr.v4.runtime.CommonTokenStream; + import org.antlr.v4.runtime.ParserRuleContext; +@@ -406,7 +408,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) +- .collect(Collectors.toList())); ++ .collect(toImmutableList())); + + // We add C style array declarator brackets to TYPE ast + final DetailAstImpl typeAst = (DetailAstImpl) methodDef.findFirstToken(TokenTypes.TYPE); +@@ -469,7 +471,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor children = + ctx.children.stream() + .filter(child -> !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + processChildren(methodDef, children); + + // We add C style array declarator brackets to TYPE ast +@@ -780,7 +782,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) +- .collect(Collectors.toList())); ++ .collect(toImmutableList())); + + // We add C style array declarator brackets to TYPE ast + final DetailAstImpl typeAst = +@@ -852,7 +854,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !child.equals(ctx.LITERAL_SUPER())) +- .collect(Collectors.toList())); ++ .collect(toImmutableList())); + return primaryCtorCall; + } + +@@ -1090,7 +1092,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.VariableModifierContext)) +- .collect(Collectors.toList())); ++ .collect(toImmutableList())); + return catchParameterDef; + } + +@@ -1421,8 +1423,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); ++ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); + + DetailAstPair.addAstChild(currentAst, expressionList); + DetailAstPair.addAstChild(currentAst, create(ctx.RPAREN())); +@@ -1448,8 +1449,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); ++ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); + + methodCall.addChild(expressionList); + methodCall.addChild(create((Token) ctx.RPAREN().getPayload())); +@@ -1508,7 +1508,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor children = + ctx.children.stream() + .filter(child -> !child.equals(ctx.DOUBLE_COLON())) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + processChildren(doubleColon, children); + return doubleColon; + } +@@ -1520,7 +1520,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !child.equals(ctx.QUESTION())) +- .collect(Collectors.toList())); ++ .collect(toImmutableList())); + return root; + } + +@@ -1547,7 +1547,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor descendantList = + binOpList.parallelStream() + .map(this::getInnerBopAst) +- .collect(Collectors.toCollection(ConcurrentLinkedQueue::new)); ++ .collect(toCollection(ConcurrentLinkedQueue::new)); + + bop.addChild(descendantList.poll()); + DetailAstImpl pointer = bop.getFirstChild(); +@@ -1584,8 +1584,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); ++ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); + + final DetailAstImpl dot = create(ctx.DOT()); + dot.addChild(visit(ctx.expr())); +@@ -1618,8 +1617,8 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.PARAMETERS)); ++ requireNonNullElseGet( ++ visit(ctx.formalParameterList()), () -> createImaginary(TokenTypes.PARAMETERS)); + addLastSibling(lparen, parameters); + addLastSibling(lparen, create(ctx.RPAREN())); + return lparen; +@@ -1882,8 +1881,8 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); ++ requireNonNullElseGet( ++ visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); + root.addChild(expressionList); + + root.addChild(create(ctx.RPAREN())); +@@ -1898,8 +1897,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor createImaginary(TokenTypes.ELIST)); ++ requireNonNullElseGet(visit(ctx.expressionList()), () -> createImaginary(TokenTypes.ELIST)); + addLastSibling(lparen, expressionList); + addLastSibling(lparen, create(ctx.RPAREN())); + return lparen; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.nio.charset.StandardCharsets.UTF_8; ++ + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.DetailNode; +@@ -28,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + import java.io.File; + import java.io.IOException; + import java.io.PrintWriter; +-import java.nio.charset.StandardCharsets; + import java.util.function.Consumer; + import java.util.regex.Matcher; + import java.util.regex.Pattern; +@@ -92,7 +93,7 @@ public final class JavadocPropertiesGenerator { + * @throws CheckstyleException if a javadoc comment can not be parsed + */ + private static void writePropertiesFile(CliOptions options) throws CheckstyleException { +- try (PrintWriter writer = new PrintWriter(options.outputFile, StandardCharsets.UTF_8)) { ++ try (PrintWriter writer = new PrintWriter(options.outputFile, UTF_8)) { + final DetailAST top = + JavaParser.parseFile(options.inputFile, JavaParser.Options.WITH_COMMENTS).getFirstChild(); + final DetailAST objBlock = getClassBody(top); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java +@@ -19,13 +19,14 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.nio.charset.StandardCharsets.UTF_8; ++ + import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; + import java.io.IOException; + import java.io.InputStreamReader; + import java.io.Reader; + import java.net.URL; + import java.net.URLConnection; +-import java.nio.charset.StandardCharsets; + import java.text.MessageFormat; + import java.util.Locale; + import java.util.MissingResourceException; +@@ -147,8 +148,7 @@ public class LocalizedMessage { + final URLConnection connection = url.openConnection(); + if (connection != null) { + connection.setUseCaches(!reload); +- try (Reader streamReader = +- new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8)) { ++ try (Reader streamReader = new InputStreamReader(connection.getInputStream(), UTF_8)) { + // Only this line is changed to make it read property files as UTF-8. + resourceBundle = new PropertyResourceBundle(streamReader); + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.util.stream.Collectors.toCollection; ++ + import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; +@@ -38,7 +40,6 @@ import java.util.ArrayList; + import java.util.LinkedList; + import java.util.List; + import java.util.Locale; +-import java.util.Objects; + import java.util.Properties; + import java.util.logging.ConsoleHandler; + import java.util.logging.Filter; +@@ -46,7 +47,6 @@ import java.util.logging.Level; + import java.util.logging.LogRecord; + import java.util.logging.Logger; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; + import picocli.CommandLine; +@@ -274,7 +274,7 @@ public final class Main { + final String stringAst = + AstTreeStringPrinter.printFileAst(file, JavaParser.Options.WITHOUT_COMMENTS); + System.out.print(stringAst); +- } else if (Objects.nonNull(options.xpath)) { ++ } else if (options.xpath != null) { + final String branch = XpathUtil.printXpathBranch(options.xpath, filesToProcess.get(0)); + System.out.print(branch); + } else if (options.printAstWithComments) { +@@ -791,7 +791,7 @@ public final class Main { + .map(File::getAbsolutePath) + .map(Pattern::quote) + .map(pattern -> Pattern.compile("^" + pattern + "$")) +- .collect(Collectors.toCollection(ArrayList::new)); ++ .collect(toCollection(ArrayList::new)); + result.addAll(excludeRegex); + return result; + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.nio.charset.StandardCharsets.UTF_8; ++ + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; + import com.puppycrawl.tools.checkstyle.api.SeverityLevel; +@@ -26,7 +28,6 @@ import java.io.OutputStream; + import java.io.OutputStreamWriter; + import java.io.PrintWriter; + import java.io.Writer; +-import java.nio.charset.StandardCharsets; + + /** Simple logger for metadata generator util. */ + public class MetadataGeneratorLogger extends AbstractAutomaticBean implements AuditListener { +@@ -48,7 +49,7 @@ public class MetadataGeneratorLogger extends AbstractAutomaticBean implements Au + */ + public MetadataGeneratorLogger( + OutputStream outputStream, OutputStreamOptions outputStreamOptions) { +- final Writer errorStreamWriter = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8); ++ final Writer errorStreamWriter = new OutputStreamWriter(outputStream, UTF_8); + errorWriter = new PrintWriter(errorStreamWriter); + formatter = new AuditEventDefaultFormatter(); + closeErrorWriter = outputStreamOptions == OutputStreamOptions.CLOSE; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java +@@ -19,13 +19,14 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.util.Collections.unmodifiableSet; ++ + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import java.io.BufferedInputStream; + import java.io.IOException; + import java.io.InputStream; + import java.net.URL; + import java.util.ArrayDeque; +-import java.util.Collections; + import java.util.Deque; + import java.util.Enumeration; + import java.util.HashMap; +@@ -137,7 +138,7 @@ public final class PackageNamesLoader extends XmlLoader { + throw new CheckstyleException("unable to open one of package files", ex); + } + +- return Collections.unmodifiableSet(result); ++ return unmodifiableSet(result); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java +@@ -19,10 +19,18 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.groupingBy; ++import static java.util.stream.Collectors.joining; ++import static java.util.stream.Collectors.mapping; ++import static java.util.stream.Collectors.toCollection; ++ ++import com.google.common.collect.ImmutableMap; ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.utils.ModuleReflectionUtil; + import java.io.IOException; +-import java.util.Collections; + import java.util.HashMap; + import java.util.HashSet; + import java.util.LinkedHashSet; +@@ -31,7 +39,6 @@ import java.util.Map; + import java.util.Map.Entry; + import java.util.Set; + import java.util.function.Supplier; +-import java.util.stream.Collectors; + import java.util.stream.Stream; + + /** +@@ -126,12 +133,8 @@ public class PackageObjectFactory implements ModuleFactory { + */ + public PackageObjectFactory( + Set packageNames, ClassLoader moduleClassLoader, ModuleLoadOption moduleLoadOption) { +- if (moduleClassLoader == null) { +- throw new IllegalArgumentException(NULL_LOADER_MESSAGE); +- } +- if (packageNames.contains(null)) { +- throw new IllegalArgumentException(NULL_PACKAGE_MESSAGE); +- } ++ checkArgument(moduleClassLoader != null, NULL_LOADER_MESSAGE); ++ checkArgument(!packageNames.contains(null), NULL_PACKAGE_MESSAGE); + + // create a copy of the given set, but retain ordering + packages = new LinkedHashSet<>(packageNames); +@@ -147,14 +150,10 @@ public class PackageObjectFactory implements ModuleFactory { + * @throws IllegalArgumentException if moduleClassLoader is null or packageNames is null + */ + public PackageObjectFactory(String packageName, ClassLoader moduleClassLoader) { +- if (moduleClassLoader == null) { +- throw new IllegalArgumentException(NULL_LOADER_MESSAGE); +- } +- if (packageName == null) { +- throw new IllegalArgumentException(NULL_PACKAGE_MESSAGE); +- } ++ checkArgument(moduleClassLoader != null, NULL_LOADER_MESSAGE); ++ checkArgument(packageName != null, NULL_PACKAGE_MESSAGE); + +- packages = Collections.singleton(packageName); ++ packages = ImmutableSet.of(packageName); + this.moduleClassLoader = moduleClassLoader; + } + +@@ -272,7 +271,7 @@ public class PackageObjectFactory implements ModuleFactory { + returnValue = createObject(fullModuleNames.iterator().next()); + } else { + final String optionalNames = +- fullModuleNames.stream().sorted().collect(Collectors.joining(STRING_SEPARATOR)); ++ fullModuleNames.stream().sorted().collect(joining(STRING_SEPARATOR)); + final LocalizedMessage exceptionMessage = + new LocalizedMessage( + Definitions.CHECKSTYLE_BUNDLE, +@@ -299,12 +298,11 @@ public class PackageObjectFactory implements ModuleFactory { + returnValue = + ModuleReflectionUtil.getCheckstyleModules(packages, loader).stream() + .collect( +- Collectors.groupingBy( ++ groupingBy( + Class::getSimpleName, +- Collectors.mapping( +- Class::getCanonicalName, Collectors.toCollection(HashSet::new)))); ++ mapping(Class::getCanonicalName, toCollection(HashSet::new)))); + } catch (IOException ignore) { +- returnValue = Collections.emptyMap(); ++ returnValue = ImmutableMap.of(); + } + return returnValue; + } +@@ -318,8 +316,8 @@ public class PackageObjectFactory implements ModuleFactory { + public static String getShortFromFullModuleNames(String fullName) { + return NAME_TO_FULL_MODULE_NAME.entrySet().stream() + .filter(entry -> entry.getValue().equals(fullName)) +- .map(Entry::getKey) + .findFirst() ++ .map(Entry::getKey) + .orElse(fullName); + } + +@@ -333,7 +331,7 @@ public class PackageObjectFactory implements ModuleFactory { + private static String joinPackageNamesWithClassName(String className, Set packages) { + return packages.stream() + .collect( +- Collectors.joining( ++ joining( + PACKAGE_SEPARATOR + className + STRING_SEPARATOR, + "", + PACKAGE_SEPARATOR + className)); +@@ -381,7 +379,7 @@ public class PackageObjectFactory implements ModuleFactory { + packages.stream() + .map(packageName -> packageName + PACKAGE_SEPARATOR + name) + .flatMap(className -> Stream.of(className, className + CHECK_SUFFIX)) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + Object instance = null; + for (String possibleName : possibleNames) { + instance = createObject(possibleName); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java +@@ -19,10 +19,11 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++ ++import com.google.common.collect.Maps; + import java.util.Map; + import java.util.Properties; +-import java.util.function.Function; +-import java.util.stream.Collectors; + + /** Resolves external properties from an underlying {@code Properties} object. */ + public final class PropertiesExpander implements PropertyResolver { +@@ -37,12 +38,8 @@ public final class PropertiesExpander implements PropertyResolver { + * @throws IllegalArgumentException when properties argument is null + */ + public PropertiesExpander(Properties properties) { +- if (properties == null) { +- throw new IllegalArgumentException("cannot pass null"); +- } +- values = +- properties.stringPropertyNames().stream() +- .collect(Collectors.toMap(Function.identity(), properties::getProperty)); ++ checkArgument(properties != null, "cannot pass null"); ++ values = Maps.toMap(properties.stringPropertyNames(), properties::getProperty); + } + + @Override +--- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.api.Configuration; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +@@ -93,12 +95,8 @@ public final class PropertyCacheFile { + * @throws IllegalArgumentException when either arguments are null + */ + public PropertyCacheFile(Configuration config, String fileName) { +- if (config == null) { +- throw new IllegalArgumentException("config can not be null"); +- } +- if (fileName == null) { +- throw new IllegalArgumentException("fileName can not be null"); +- } ++ checkArgument(config != null, "config can not be null"); ++ checkArgument(fileName != null, "fileName can not be null"); + this.config = config; + this.fileName = fileName; + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static java.nio.charset.StandardCharsets.UTF_8; ++ + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; + import com.puppycrawl.tools.checkstyle.api.SeverityLevel; +@@ -29,7 +32,6 @@ import java.io.OutputStream; + import java.io.OutputStreamWriter; + import java.io.PrintWriter; + import java.io.StringWriter; +-import java.nio.charset.StandardCharsets; + import java.util.ArrayList; + import java.util.List; + import java.util.Locale; +@@ -107,10 +109,8 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener + */ + public SarifLogger(OutputStream outputStream, OutputStreamOptions outputStreamOptions) + throws IOException { +- if (outputStreamOptions == null) { +- throw new IllegalArgumentException("Parameter outputStreamOptions can not be null"); +- } +- writer = new PrintWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); ++ checkArgument(outputStreamOptions != null, "Parameter outputStreamOptions can not be null"); ++ writer = new PrintWriter(new OutputStreamWriter(outputStream, UTF_8)); + closeStream = outputStreamOptions == OutputStreamOptions.CLOSE; + report = readResource("/com/puppycrawl/tools/checkstyle/sarif/SarifReport.template"); + resultLineColumn = +@@ -307,7 +307,7 @@ public class SarifLogger extends AbstractAutomaticBean implements AuditListener + result.write(buffer, 0, length); + length = inputStream.read(buffer); + } +- return result.toString(StandardCharsets.UTF_8); ++ return result.toString(UTF_8); + } + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.util.stream.Collectors.joining; ++ + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.FileText; +@@ -30,7 +32,6 @@ import java.util.List; + import java.util.Locale; + import java.util.regex.Matcher; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + + /** Class for constructing xpath queries to suppress nodes with specified line and column number. */ + public final class SuppressionsStringPrinter { +@@ -98,6 +99,6 @@ public final class SuppressionsStringPrinter { + final XpathQueryGenerator queryGenerator = + new XpathQueryGenerator(detailAST, lineNumber, columnNumber, fileText, tabWidth); + final List suppressions = queryGenerator.generate(); +- return suppressions.stream().collect(Collectors.joining(LINE_SEPARATOR, "", LINE_SEPARATOR)); ++ return suppressions.stream().collect(joining(LINE_SEPARATOR, "", LINE_SEPARATOR)); + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import java.io.Serializable; + + /** +@@ -93,14 +95,12 @@ public class ThreadModeSettings implements Serializable { + */ + public final String resolveName(String name) { + if (checkerThreadsNumber > 1) { +- if (CHECKER_MODULE_NAME.equals(name)) { +- throw new IllegalArgumentException( +- "Multi thread mode for Checker module is not implemented"); +- } +- if (TREE_WALKER_MODULE_NAME.equals(name)) { +- throw new IllegalArgumentException( +- "Multi thread mode for TreeWalker module is not implemented"); +- } ++ checkArgument( ++ !CHECKER_MODULE_NAME.equals(name), ++ "Multi thread mode for Checker module is not implemented"); ++ checkArgument( ++ !TREE_WALKER_MODULE_NAME.equals(name), ++ "Multi thread mode for TreeWalker module is not implemented"); + } + + return name; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java +@@ -19,6 +19,10 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.collect.ImmutableSet.toImmutableSet; ++import static java.util.Comparator.naturalOrder; ++import static java.util.Comparator.nullsLast; ++ + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +@@ -41,7 +45,6 @@ import java.util.Map; + import java.util.Set; + import java.util.SortedSet; + import java.util.TreeSet; +-import java.util.stream.Collectors; + import java.util.stream.Stream; + + /** Responsible for walking an abstract syntax tree and notifying interested checks at each node. */ +@@ -371,7 +374,7 @@ public final class TreeWalker extends AbstractFileSetCheck implements ExternalRe + resource -> { + return ((ExternalResourceHolder) resource).getExternalResourceLocations().stream(); + }) +- .collect(Collectors.toSet()); ++ .collect(toImmutableSet()); + } + + /** +@@ -403,8 +406,8 @@ public final class TreeWalker extends AbstractFileSetCheck implements ExternalRe + private static SortedSet createNewCheckSortedSet() { + return new TreeSet<>( + Comparator.comparing(check -> check.getClass().getName()) +- .thenComparing(AbstractCheck::getId, Comparator.nullsLast(Comparator.naturalOrder())) +- .thenComparing(AbstractCheck::hashCode)); ++ .thenComparing(AbstractCheck::getId, nullsLast(naturalOrder())) ++ .thenComparingInt(AbstractCheck::hashCode)); + } + + /** State of AST. Indicates whether tree contains certain nodes. */ +--- a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java +@@ -19,6 +19,10 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static java.nio.charset.StandardCharsets.UTF_8; ++import static java.util.Collections.synchronizedList; ++ + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; + import com.puppycrawl.tools.checkstyle.api.AutomaticBean; +@@ -28,9 +32,7 @@ import java.io.OutputStream; + import java.io.OutputStreamWriter; + import java.io.PrintWriter; + import java.io.StringWriter; +-import java.nio.charset.StandardCharsets; + import java.util.ArrayList; +-import java.util.Collections; + import java.util.List; + import java.util.Map; + import java.util.concurrent.ConcurrentHashMap; +@@ -90,10 +92,8 @@ public class XMLLogger extends AbstractAutomaticBean implements AuditListener { + * @throws IllegalArgumentException if outputStreamOptions is null. + */ + public XMLLogger(OutputStream outputStream, OutputStreamOptions outputStreamOptions) { +- writer = new PrintWriter(new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)); +- if (outputStreamOptions == null) { +- throw new IllegalArgumentException("Parameter outputStreamOptions can not be null"); +- } ++ writer = new PrintWriter(new OutputStreamWriter(outputStream, UTF_8)); ++ checkArgument(outputStreamOptions != null, "Parameter outputStreamOptions can not be null"); + closeStream = outputStreamOptions == OutputStreamOptions.CLOSE; + } + +@@ -328,10 +328,10 @@ public class XMLLogger extends AbstractAutomaticBean implements AuditListener { + private static final class FileMessages { + + /** The file error events. */ +- private final List errors = Collections.synchronizedList(new ArrayList<>()); ++ private final List errors = synchronizedList(new ArrayList<>()); + + /** The file exceptions. */ +- private final List exceptions = Collections.synchronizedList(new ArrayList<>()); ++ private final List exceptions = synchronizedList(new ArrayList<>()); + + /** + * Returns the file error events. +--- a/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java +@@ -19,13 +19,14 @@ + + package com.puppycrawl.tools.checkstyle; + ++import static java.nio.charset.StandardCharsets.UTF_8; ++ + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.AuditListener; + import java.io.File; + import java.io.OutputStream; + import java.io.OutputStreamWriter; + import java.io.PrintWriter; +-import java.nio.charset.StandardCharsets; + + /** + * Generates suppressions.xml file, based on violations occurred. See issue scanner.getBasedir() + File.separator + name) + .map(File::new) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + } + + /** Poor man enumeration for the formatter types. */ +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.api; + ++import static java.util.Collections.unmodifiableSet; ++ + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + import java.util.Collections; + import java.util.HashSet; +@@ -107,7 +109,7 @@ public abstract class AbstractCheck extends AbstractViolationReporter { + * @return the set of token names + */ + public final Set getTokenNames() { +- return Collections.unmodifiableSet(tokens); ++ return unmodifiableSet(tokens); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.api; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + import java.io.File; + import java.util.Arrays; +@@ -164,9 +166,7 @@ public abstract class AbstractFileSetCheck extends AbstractViolationReporter + * @throws IllegalArgumentException is argument is null + */ + public final void setFileExtensions(String... extensions) { +- if (extensions == null) { +- throw new IllegalArgumentException("Extensions array can not be null"); +- } ++ checkArgument(extensions != null, "Extensions array can not be null"); + + fileExtensions = new String[extensions.length]; + for (int i = 0; i < extensions.length; i++) { +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.api; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + /** + * Raw event for audit. + * +@@ -69,9 +71,7 @@ public final class AuditEvent { + * @throws IllegalArgumentException if {@code src} is {@code null}. + */ + public AuditEvent(Object src, String fileName, Violation violation) { +- if (src == null) { +- throw new IllegalArgumentException("null source"); +- } ++ checkArgument(src != null, "null source"); + + source = src; + this.fileName = fileName; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java +@@ -19,7 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.api; + +-import java.util.Collections; ++import static java.util.Collections.unmodifiableSet; ++ + import java.util.HashSet; + import java.util.Set; + +@@ -56,7 +57,7 @@ public final class BeforeExecutionFileFilterSet implements BeforeExecutionFileFi + * @return the Filters of the filter set. + */ + public Set getBeforeExecutionFileFilters() { +- return Collections.unmodifiableSet(beforeExecutionFileFilters); ++ return unmodifiableSet(beforeExecutionFileFilters); + } + + @Override +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java +@@ -19,12 +19,13 @@ + + package com.puppycrawl.tools.checkstyle.api; + ++import static java.util.Collections.unmodifiableMap; ++ + import com.puppycrawl.tools.checkstyle.grammar.CommentListener; + import com.puppycrawl.tools.checkstyle.utils.CheckUtil; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + import java.util.ArrayList; + import java.util.Collection; +-import java.util.Collections; + import java.util.HashMap; + import java.util.List; + import java.util.Map; +@@ -293,7 +294,7 @@ public final class FileContents implements CommentListener { + * @return the Map of comments + */ + public Map getSingleLineComments() { +- return Collections.unmodifiableMap(cppComments); ++ return unmodifiableMap(cppComments); + } + + /** +@@ -303,7 +304,7 @@ public final class FileContents implements CommentListener { + * @return the map of comments + */ + public Map> getBlockComments() { +- return Collections.unmodifiableMap(clangComments); ++ return unmodifiableMap(clangComments); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java +@@ -19,7 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.api; + +-import java.util.Collections; ++import static java.util.Collections.unmodifiableSet; ++ + import java.util.HashSet; + import java.util.Set; + +@@ -56,7 +57,7 @@ public class FilterSet implements Filter { + * @return the Filters of the filter set. + */ + public Set getFilters() { +- return Collections.unmodifiableSet(filters); ++ return unmodifiableSet(filters); + } + + @Override +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.api; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import java.util.concurrent.atomic.AtomicInteger; + + /** +@@ -40,9 +42,7 @@ public final class SeverityLevelCounter implements AuditListener { + * @throws IllegalArgumentException when level is null + */ + public SeverityLevelCounter(SeverityLevel level) { +- if (level == null) { +- throw new IllegalArgumentException("'level' cannot be null"); +- } ++ checkArgument(level != null, "'level' cannot be null"); + this.level = level; + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java +@@ -385,7 +385,7 @@ public final class Violation implements Comparable { + && Objects.equals(columnNo, violation.columnNo) + && Objects.equals(columnCharIndex, violation.columnCharIndex) + && Objects.equals(tokenType, violation.tokenType) +- && Objects.equals(severityLevel, violation.severityLevel) ++ && severityLevel == violation.severityLevel + && Objects.equals(moduleId, violation.moduleId) + && Objects.equals(key, violation.key) + && Objects.equals(bundle, violation.bundle) +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java +@@ -265,8 +265,8 @@ public class AvoidEscapedUnicodeCharactersCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void beginTree(DetailAST rootAST) { + singlelineComments = getFileContents().getSingleLineComments(); + blockComments = getFileContents().getBlockComments(); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java +@@ -19,7 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks; + +-import java.nio.charset.StandardCharsets; ++import static java.nio.charset.StandardCharsets.US_ASCII; ++ + import java.util.Arrays; + + /** +@@ -55,7 +56,7 @@ public enum LineSeparatorOption { + * @param sep the line separator, e.g. "\r\n" + */ + LineSeparatorOption(String sep) { +- lineSeparator = sep.getBytes(StandardCharsets.US_ASCII); ++ lineSeparator = sep.getBytes(US_ASCII); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks; + ++import static java.util.Collections.enumeration; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; + import com.puppycrawl.tools.checkstyle.api.FileText; +@@ -27,7 +29,6 @@ import java.io.IOException; + import java.io.InputStream; + import java.nio.file.Files; + import java.util.ArrayList; +-import java.util.Collections; + import java.util.Enumeration; + import java.util.Iterator; + import java.util.List; +@@ -191,7 +192,7 @@ public class OrderedPropertiesCheck extends AbstractFileSetCheck { + /** Returns a copy of the keys. */ + @Override + public Enumeration keys() { +- return Collections.enumeration(keyList); ++ return enumeration(keyList); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java +@@ -19,12 +19,14 @@ + + package com.puppycrawl.tools.checkstyle.checks; + ++import static com.google.common.base.Preconditions.checkArgument; ++ ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.AuditEvent; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; +-import java.util.Collections; + import java.util.HashMap; + import java.util.LinkedList; + import java.util.List; +@@ -296,7 +298,7 @@ public class SuppressWarningsHolder extends AbstractCheck { + */ + private static List getAllAnnotationValues(DetailAST ast) { + // get values of annotation +- List values = Collections.emptyList(); ++ List values = ImmutableList.of(); + final DetailAST lparenAST = ast.findFirstToken(TokenTypes.LPAREN); + if (lparenAST != null) { + final DetailAST nextAST = lparenAST.getNextSibling(); +@@ -378,9 +380,7 @@ public class SuppressWarningsHolder extends AbstractCheck { + * @throws IllegalArgumentException if the AST is invalid + */ + private static String getIdentifier(DetailAST ast) { +- if (ast == null) { +- throw new IllegalArgumentException("Identifier AST expected, but get null."); +- } ++ checkArgument(ast != null, "Identifier AST expected, but get null."); + final String identifier; + if (ast.getType() == TokenTypes.IDENT) { + identifier = ast.getText(); +@@ -436,7 +436,7 @@ public class SuppressWarningsHolder extends AbstractCheck { + final List annotationValues; + switch (ast.getType()) { + case TokenTypes.EXPR: +- annotationValues = Collections.singletonList(getStringExpr(ast)); ++ annotationValues = ImmutableList.of(getStringExpr(ast)); + break; + case TokenTypes.ANNOTATION_ARRAY_INIT: + annotationValues = findAllExpressionsInChildren(ast); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks; + ++import com.google.common.collect.ImmutableSet; ++import com.google.common.collect.Sets; + import com.puppycrawl.tools.checkstyle.Definitions; + import com.puppycrawl.tools.checkstyle.GlobalStatefulCheck; + import com.puppycrawl.tools.checkstyle.LocalizedMessage; +@@ -32,7 +34,6 @@ import java.io.File; + import java.io.InputStream; + import java.nio.file.Files; + import java.nio.file.NoSuchFileException; +-import java.util.Arrays; + import java.util.HashSet; + import java.util.Locale; + import java.util.Map; +@@ -46,7 +47,6 @@ import java.util.TreeSet; + import java.util.concurrent.ConcurrentHashMap; + import java.util.regex.Matcher; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import org.apache.commons.logging.Log; + import org.apache.commons.logging.LogFactory; + +@@ -226,7 +226,7 @@ public class TranslationCheck extends AbstractFileSetCheck { + * @since 6.11 + */ + public void setRequiredTranslations(String... translationCodes) { +- requiredTranslations = Arrays.stream(translationCodes).collect(Collectors.toSet()); ++ requiredTranslations = ImmutableSet.copyOf(translationCodes); + validateUserSpecifiedLanguageCodes(requiredTranslations); + } + +@@ -497,9 +497,7 @@ public class TranslationCheck extends AbstractFileSetCheck { + for (Entry> fileKey : fileKeys.entrySet()) { + final Set currentFileKeys = fileKey.getValue(); + final Set missingKeys = +- keysThatMustExist.stream() +- .filter(key -> !currentFileKeys.contains(key)) +- .collect(Collectors.toSet()); ++ Sets.difference(keysThatMustExist, currentFileKeys).immutableCopy(); + if (!missingKeys.isEmpty()) { + final MessageDispatcher dispatcher = getMessageDispatcher(); + final String path = fileKey.getKey().getAbsolutePath(); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -60,7 +61,7 @@ public class UncommentedMainCheck extends AbstractCheck { + + /** Set of possible String array types. */ + private static final Set STRING_PARAMETER_NAMES = +- Set.of( ++ ImmutableSet.of( + String[].class.getCanonicalName(), + String.class.getCanonicalName(), + String[].class.getSimpleName(), +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.annotation; + ++import static java.util.Objects.requireNonNullElse; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -152,8 +154,7 @@ public final class MissingOverrideCheck extends AbstractCheck { + final DetailAST startNode; + if (modifiers.hasChildren()) { + startNode = +- Optional.ofNullable(ast.getFirstChild().findFirstToken(TokenTypes.ANNOTATION)) +- .orElse(modifiers); ++ requireNonNullElse(ast.getFirstChild().findFirstToken(TokenTypes.ANNOTATION), modifiers); + } else { + startNode = ast.findFirstToken(TokenTypes.TYPE); + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java +@@ -19,13 +19,14 @@ + + package com.puppycrawl.tools.checkstyle.checks.annotation; + ++import static java.util.Objects.requireNonNullElse; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.utils.AnnotationUtil; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +-import java.util.Objects; + import java.util.regex.Matcher; + import java.util.regex.Pattern; + +@@ -162,7 +163,7 @@ public class SuppressWarningsCheck extends AbstractCheck { + final DetailAST token = warningHolder.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); + + // case like '@SuppressWarnings(value = UNUSED)' +- final DetailAST parent = Objects.requireNonNullElse(token, warningHolder); ++ final DetailAST parent = requireNonNullElse(token, warningHolder); + DetailAST warning = parent.findFirstToken(TokenTypes.EXPR); + + // rare case with empty array ex: @SuppressWarnings({}) +@@ -242,10 +243,10 @@ public class SuppressWarningsCheck extends AbstractCheck { + final DetailAST annValuePair = + annotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); + +- final DetailAST annArrayInitParent = Objects.requireNonNullElse(annValuePair, annotation); ++ final DetailAST annArrayInitParent = requireNonNullElse(annValuePair, annotation); + final DetailAST annArrayInit = + annArrayInitParent.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT); +- return Objects.requireNonNullElse(annArrayInit, annotation); ++ return requireNonNullElse(annArrayInit, annotation); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java +@@ -370,7 +370,7 @@ public class FallThroughCheck extends AbstractCheck { + return Optional.ofNullable(getNextNonCommentAst(ast)) + .map(DetailAST::getPreviousSibling) + .map(previous -> previous.getFirstChild().getText()) +- .map(text -> reliefPattern.matcher(text).find()) +- .orElse(Boolean.FALSE); ++ .filter(text -> reliefPattern.matcher(text).find()) ++ .isPresent(); + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import static java.util.stream.Collectors.toCollection; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -28,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.utils.CheckUtil; + import java.util.Arrays; + import java.util.HashSet; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Checks that certain exception types do not appear in a {@code catch} statement. +@@ -74,7 +75,7 @@ public final class IllegalCatchCheck extends AbstractCheck { + "java.lang.RuntimeException", + "java.lang.Throwable", + }) +- .collect(Collectors.toCollection(HashSet::new)); ++ .collect(toCollection(HashSet::new)); + + /** + * Setter to specify exception class names to reject. +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java +@@ -19,16 +19,15 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + 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.utils.CommonUtil; +-import java.util.Arrays; + import java.util.HashSet; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Checks for illegal instantiations where a factory method is preferred. +@@ -314,6 +313,6 @@ public class IllegalInstantiationCheck extends AbstractCheck { + * @since 3.0 + */ + public void setClasses(String... names) { +- classes = Arrays.stream(names).collect(Collectors.toSet()); ++ classes = ImmutableSet.copyOf(names); + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import static java.util.stream.Collectors.toCollection; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -30,7 +32,6 @@ import java.util.Arrays; + import java.util.Collections; + import java.util.HashSet; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Checks that specified types are not declared to be thrown. Declaring that a method throws {@code +@@ -69,7 +70,7 @@ public final class IllegalThrowsCheck extends AbstractCheck { + new String[] { + "finalize", + }) +- .collect(Collectors.toCollection(HashSet::new)); ++ .collect(toCollection(HashSet::new)); + + /** Specify throw class names to reject. */ + private final Set illegalClassNames = +@@ -82,7 +83,7 @@ public final class IllegalThrowsCheck extends AbstractCheck { + "java.lang.RuntimeException", + "java.lang.Throwable", + }) +- .collect(Collectors.toCollection(HashSet::new)); ++ .collect(toCollection(HashSet::new)); + + /** + * Allow to ignore checking overridden methods (marked with {@code Override} or {@code +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java +@@ -19,12 +19,14 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import static java.util.Objects.requireNonNullElse; ++import static java.util.regex.Pattern.CASE_INSENSITIVE; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +-import java.util.Objects; + import java.util.regex.Pattern; + + /** +@@ -124,7 +126,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { + * @since 3.2 + */ + public void setMessage(String message) { +- this.message = Objects.requireNonNullElse(message, ""); ++ this.message = requireNonNullElse(message, ""); + } + + /** +@@ -156,7 +158,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { + private void updateRegexp() { + final int compileFlags; + if (ignoreCase) { +- compileFlags = Pattern.CASE_INSENSITIVE; ++ compileFlags = CASE_INSENSITIVE; + } else { + compileFlags = 0; + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -26,7 +28,6 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + import com.puppycrawl.tools.checkstyle.xpath.AbstractNode; + import com.puppycrawl.tools.checkstyle.xpath.RootNode; + import java.util.List; +-import java.util.stream.Collectors; + import net.sf.saxon.Configuration; + import net.sf.saxon.om.Item; + import net.sf.saxon.sxpath.XPathDynamicContext; +@@ -142,7 +143,7 @@ public class MatchXpathCheck extends AbstractCheck { + final List matchingItems = xpathExpression.evaluate(xpathDynamicContext); + return matchingItems.stream() + .map(item -> (DetailAST) ((AbstractNode) item).getUnderlyingNode()) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + } catch (XPathException ex) { + throw new IllegalStateException("Evaluation of Xpath query failed: " + query, ex); + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import com.google.common.collect.Sets; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -31,7 +32,6 @@ import java.util.HashSet; + import java.util.LinkedList; + import java.util.List; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Checks that for loop control variables are not modified inside the for block. An example is: +@@ -293,9 +293,7 @@ public final class ModifiedControlVariableCheck extends AbstractCheck { + private static Set getVariablesManagedByForLoop(DetailAST ast) { + final Set initializedVariables = getForInitVariables(ast); + final Set iteratingVariables = getForIteratorVariables(ast); +- return initializedVariables.stream() +- .filter(iteratingVariables::contains) +- .collect(Collectors.toSet()); ++ return Sets.intersection(initializedVariables, iteratingVariables).immutableCopy(); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -26,7 +27,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.utils.CheckUtil; + import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import java.util.ArrayDeque; +-import java.util.Collections; + import java.util.Deque; + import java.util.HashSet; + import java.util.Set; +@@ -99,7 +99,7 @@ public final class ParameterAssignmentCheck extends AbstractCheck { + public void beginTree(DetailAST rootAST) { + // clear data + parameterNamesStack.clear(); +- parameterNames = Collections.emptySet(); ++ parameterNames = ImmutableSet.of(); + } + + @Override +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.coding; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++ + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -36,7 +38,6 @@ import java.util.List; + import java.util.Map; + import java.util.Optional; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Checks that a local variable is declared and/or assigned, but not used. Doesn't support { + return hasSameNameAsSuperClass(superClassName, typeDeclDesc); + }) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.checks.design; + ++import static java.util.Objects.requireNonNullElse; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -27,14 +30,11 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; + import com.puppycrawl.tools.checkstyle.utils.ScopeUtil; + import com.puppycrawl.tools.checkstyle.utils.TokenUtil; +-import java.util.Arrays; +-import java.util.Objects; + import java.util.Optional; + import java.util.Set; + import java.util.function.Predicate; + import java.util.regex.Matcher; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + + /** + * Checks that classes are designed for extension (subclass creation). +@@ -176,11 +176,10 @@ public class DesignForExtensionCheck extends AbstractCheck { + + /** Specify annotations which allow the check to skip the method from validation. */ + private Set ignoredAnnotations = +- Arrays.stream( +- new String[] { +- "Test", "Before", "After", "BeforeClass", "AfterClass", +- }) +- .collect(Collectors.toSet()); ++ ImmutableSet.copyOf( ++ new String[] { ++ "Test", "Before", "After", "BeforeClass", "AfterClass", ++ }); + + /** + * Specify the comment text pattern which qualifies a method as designed for extension. Supports +@@ -195,7 +194,7 @@ public class DesignForExtensionCheck extends AbstractCheck { + * @since 7.2 + */ + public void setIgnoredAnnotations(String... ignoredAnnotations) { +- this.ignoredAnnotations = Arrays.stream(ignoredAnnotations).collect(Collectors.toSet()); ++ this.ignoredAnnotations = ImmutableSet.copyOf(ignoredAnnotations); + } + + /** +@@ -396,7 +395,7 @@ public class DesignForExtensionCheck extends AbstractCheck { + */ + private static String getAnnotationName(DetailAST annotation) { + final DetailAST dotAst = annotation.findFirstToken(TokenTypes.DOT); +- final DetailAST parent = Objects.requireNonNullElse(dotAst, annotation); ++ final DetailAST parent = requireNonNullElse(dotAst, annotation); + return parent.findFirstToken(TokenTypes.IDENT).getText(); + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.design; + ++import static java.util.Comparator.comparingInt; ++ + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -310,7 +312,7 @@ public class FinalClassCheck extends AbstractCheck { + private Optional getNearestClassWithSameName( + String className, ToIntFunction countProvider) { + final String dotAndClassName = PACKAGE_SEPARATOR.concat(className); +- final Comparator longestMatch = Comparator.comparingInt(countProvider); ++ final Comparator longestMatch = comparingInt(countProvider); + return innerClasses.entrySet().stream() + .filter(entry -> entry.getKey().endsWith(dotAndClassName)) + .map(Map.Entry::getValue) +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java +@@ -19,11 +19,12 @@ + + package com.puppycrawl.tools.checkstyle.checks.design; + ++import static java.util.Objects.requireNonNullElse; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; +-import java.util.Objects; + + /** + * Restricts throws statements to a specified count. Methods with "Override" or "java.lang.Override" +@@ -167,7 +168,7 @@ public final class ThrowsCountCheck extends AbstractCheck { + */ + private static String getAnnotationName(DetailAST annotation) { + final DetailAST dotAst = annotation.findFirstToken(TokenTypes.DOT); +- final DetailAST parent = Objects.requireNonNullElse(dotAst, annotation); ++ final DetailAST parent = requireNonNullElse(dotAst, annotation); + return parent.findFirstToken(TokenTypes.IDENT).getText(); + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.checks.design; + ++import static java.util.stream.Collectors.toCollection; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -33,7 +36,6 @@ import java.util.HashSet; + import java.util.List; + import java.util.Set; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + + /** + * Checks visibility of class members. Only static final, immutable or annotated by specified +@@ -152,7 +154,7 @@ public class VisibilityModifierCheck extends AbstractCheck { + + /** Default ignore annotations canonical names. */ + private static final Set DEFAULT_IGNORE_ANNOTATIONS = +- Set.of( ++ ImmutableSet.of( + "org.junit.Rule", + "org.junit.ClassRule", + "com.google.common.annotations.VisibleForTesting"); +@@ -685,7 +687,7 @@ public class VisibilityModifierCheck extends AbstractCheck { + private static Set getClassShortNames(Set canonicalClassNames) { + return canonicalClassNames.stream() + .map(CommonUtil::baseClassName) +- .collect(Collectors.toCollection(HashSet::new)); ++ .collect(toCollection(HashSet::new)); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.checks.header; + ++import static com.google.common.base.Preconditions.checkArgument; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.PropertyType; + import com.puppycrawl.tools.checkstyle.XdocsPropertyType; + import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; +@@ -35,7 +38,6 @@ import java.net.URI; + import java.nio.charset.Charset; + import java.nio.charset.UnsupportedCharsetException; + import java.util.ArrayList; +-import java.util.Collections; + import java.util.List; + import java.util.Set; + import java.util.regex.Pattern; +@@ -116,10 +118,9 @@ public abstract class AbstractHeaderCheck extends AbstractFileSetCheck + * @throws IllegalArgumentException if header has already been set + */ + private void checkHeaderNotInitialized() { +- if (!readerLines.isEmpty()) { +- throw new IllegalArgumentException( +- "header has already been set - " + "set either header or headerFile, not both"); +- } ++ checkArgument( ++ readerLines.isEmpty(), ++ "header has already been set - " + "set either header or headerFile, not both"); + } + + /** +@@ -190,9 +191,9 @@ public abstract class AbstractHeaderCheck extends AbstractFileSetCheck + final Set result; + + if (headerFile == null) { +- result = Collections.emptySet(); ++ result = ImmutableSet.of(); + } else { +- result = Collections.singleton(headerFile.toString()); ++ result = ImmutableSet.of(headerFile.toString()); + } + + return result; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.header; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.FileText; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +@@ -263,9 +265,7 @@ public class RegexpHeaderCheck extends AbstractHeaderCheck { + @Override + public void setHeader(String header) { + if (!CommonUtil.isBlank(header)) { +- if (!CommonUtil.isPatternValid(header)) { +- throw new IllegalArgumentException("Unable to parse format: " + header); +- } ++ checkArgument(CommonUtil.isPatternValid(header), "Unable to parse format: %s", header); + super.setHeader(header); + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.imports; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -648,10 +650,10 @@ public class CustomImportOrderCheck extends AbstractCheck { + } else if (ruleStr.startsWith(SAME_PACKAGE_RULE_GROUP)) { + final String rule = ruleStr.substring(ruleStr.indexOf('(') + 1, ruleStr.indexOf(')')); + samePackageMatchingDepth = Integer.parseInt(rule); +- if (samePackageMatchingDepth <= 0) { +- throw new IllegalArgumentException( +- "SAME_PACKAGE rule parameter should be positive integer: " + ruleStr); +- } ++ checkArgument( ++ samePackageMatchingDepth > 0, ++ "SAME_PACKAGE rule parameter should be positive integer: %s", ++ ruleStr); + customOrderRules.add(SAME_PACKAGE_RULE_GROUP); + } else { + throw new IllegalStateException("Unexpected rule: " + ruleStr); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.imports; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +@@ -27,7 +28,6 @@ import com.puppycrawl.tools.checkstyle.api.ExternalResourceHolder; + import com.puppycrawl.tools.checkstyle.api.FullIdent; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import java.net.URI; +-import java.util.Collections; + import java.util.Set; + import java.util.regex.Pattern; + +@@ -167,8 +167,8 @@ public class ImportControlCheck extends AbstractCheck implements ExternalResourc + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void beginTree(DetailAST rootAST) { + currentImportControl = null; + processCurrentFile = path.matcher(getFilePath()).find(); +@@ -207,7 +207,7 @@ public class ImportControlCheck extends AbstractCheck implements ExternalResourc + + @Override + public Set getExternalResourceLocations() { +- return Collections.singleton(file.toString()); ++ return ImmutableSet.of(file.toString()); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.imports; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -658,9 +660,7 @@ public class ImportOrderCheck extends AbstractCheck { + // matches any package + grp = Pattern.compile(""); + } else if (pkg.startsWith(FORWARD_SLASH)) { +- if (!pkg.endsWith(FORWARD_SLASH)) { +- throw new IllegalArgumentException("Invalid group: " + pkg); +- } ++ checkArgument(pkg.endsWith(FORWARD_SLASH), "Invalid group: %s", pkg); + pkg = pkg.substring(1, pkg.length() - 1); + grp = Pattern.compile(pkg); + } else { +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++ + import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser; + import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseErrorMessage; + import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseStatus; +@@ -36,7 +38,6 @@ import java.util.HashSet; + import java.util.Locale; + import java.util.Map; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Base class for Checks that process Javadoc comments. +@@ -182,7 +183,7 @@ public abstract class AbstractJavadocCheck extends AbstractCheck { + validateDefaultJavadocTokens(); + if (javadocTokens.isEmpty()) { + javadocTokens.addAll( +- Arrays.stream(getDefaultJavadocTokens()).boxed().collect(Collectors.toList())); ++ Arrays.stream(getDefaultJavadocTokens()).boxed().collect(toImmutableList())); + } else { + final int[] acceptableJavadocTokens = getAcceptableJavadocTokens(); + Arrays.sort(acceptableJavadocTokens); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java +@@ -19,14 +19,13 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.DetailNode; + import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +-import java.util.Arrays; + import java.util.Set; + import java.util.regex.Matcher; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + + /** + * Checks that a allowedAnnotations = Set.of("Override"); ++ private Set allowedAnnotations = ImmutableSet.of("Override"); + + /** + * Setter to control whether to validate {@code throws} tags. +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java +@@ -257,8 +257,8 @@ public class JavadocStyleCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void visitToken(DetailAST ast) { + if (shouldCheck(ast)) { + final FileContents contents = getFileContents(); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java +@@ -19,6 +19,10 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static java.util.function.Function.identity; ++import static java.util.stream.Collectors.toUnmodifiableMap; ++ + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.Scope; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; +@@ -27,8 +31,6 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import java.util.Arrays; + import java.util.BitSet; + import java.util.Map; +-import java.util.function.Function; +-import java.util.stream.Collectors; + + /** + * This enum defines the various Javadoc tags and their properties. +@@ -299,11 +301,9 @@ public enum JavadocTagInfo { + static { + final JavadocTagInfo[] values = values(); + TEXT_TO_TAG = +- Arrays.stream(values) +- .collect(Collectors.toUnmodifiableMap(JavadocTagInfo::getText, Function.identity())); ++ Arrays.stream(values).collect(toUnmodifiableMap(JavadocTagInfo::getText, identity())); + NAME_TO_TAG = +- Arrays.stream(values) +- .collect(Collectors.toUnmodifiableMap(JavadocTagInfo::getName, Function.identity())); ++ Arrays.stream(values).collect(toUnmodifiableMap(JavadocTagInfo::getName, identity())); + } + + /** The tag text. * */ +@@ -376,15 +376,11 @@ public enum JavadocTagInfo { + * @throws IllegalArgumentException if the text is not a valid tag + */ + public static JavadocTagInfo fromText(final String text) { +- if (text == null) { +- throw new IllegalArgumentException("the text is null"); +- } ++ checkArgument(text != null, "the text is null"); + + final JavadocTagInfo tag = TEXT_TO_TAG.get(text); + +- if (tag == null) { +- throw new IllegalArgumentException("the text [" + text + "] is not a valid Javadoc tag text"); +- } ++ checkArgument(tag != null, "the text [%s] is not a valid Javadoc tag text", text); + + return tag; + } +@@ -399,15 +395,11 @@ public enum JavadocTagInfo { + * {@link JavadocTagInfo#isValidName(String)} + */ + public static JavadocTagInfo fromName(final String name) { +- if (name == null) { +- throw new IllegalArgumentException("the name is null"); +- } ++ checkArgument(name != null, "the name is null"); + + final JavadocTagInfo tag = NAME_TO_TAG.get(name); + +- if (tag == null) { +- throw new IllegalArgumentException("the name [" + name + "] is not a valid Javadoc tag name"); +- } ++ checkArgument(tag != null, "the name [%s] is not a valid Javadoc tag name", name); + + return tag; + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -160,7 +161,7 @@ public class JavadocTypeCheck extends AbstractCheck { + * Specify annotations that allow skipping validation at all. Only short names are allowed, e.g. + * {@code Generated}. + */ +- private Set allowedAnnotations = Set.of("Generated"); ++ private Set allowedAnnotations = ImmutableSet.of("Generated"); + + /** + * Setter to specify the visibility scope where Javadoc comments are checked. +@@ -256,8 +257,8 @@ public class JavadocTypeCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void visitToken(DetailAST ast) { + if (shouldCheck(ast)) { + final FileContents contents = getFileContents(); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java +@@ -126,8 +126,8 @@ public class JavadocVariableCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void visitToken(DetailAST ast) { + if (shouldCheck(ast)) { + final FileContents contents = getFileContents(); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -141,7 +142,7 @@ public class MissingJavadocMethodCheck extends AbstractCheck { + private Pattern ignoreMethodNamesRegex; + + /** Configure annotations that allow missed documentation. */ +- private Set allowedAnnotations = Set.of("Override"); ++ private Set allowedAnnotations = ImmutableSet.of("Override"); + + /** + * Setter to configure annotations that allow missed documentation. +@@ -225,8 +226,8 @@ public class MissingJavadocMethodCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public final void visitToken(DetailAST ast) { + final Scope theScope = ScopeUtil.getScope(ast); + if (shouldCheck(ast, theScope)) { +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -87,7 +88,7 @@ public class MissingJavadocTypeCheck extends AbstractCheck { + * Specify annotations that allow missed documentation. If annotation is present in target sources + * in multiple forms of qualified name, all forms should be listed in this property. + */ +- private Set skipAnnotations = Set.of("Generated"); ++ private Set skipAnnotations = ImmutableSet.of("Generated"); + + /** + * Setter to specify the visibility scope where Javadoc comments are checked. +@@ -143,8 +144,8 @@ public class MissingJavadocTypeCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void visitToken(DetailAST ast) { + if (shouldCheck(ast)) { + final FileContents contents = getFileContents(); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SingleLineJavadocCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SingleLineJavadocCheck.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.javadoc; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.DetailNode; +@@ -70,7 +71,7 @@ public class SingleLineJavadocCheck extends AbstractJavadocCheck { + * href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#CHDBEFIF"> + * block tags which are ignored by the check. + */ +- private Set ignoredTags = Set.of(); ++ private Set ignoredTags = ImmutableSet.of(); + + /** + * Control whether extractInlineTags(String... lines) { + for (String line : lines) { +- if (line.indexOf(LINE_FEED) != -1 || line.indexOf(CARRIAGE_RETURN) != -1) { +- throw new IllegalArgumentException("comment lines cannot contain newlines"); +- } ++ checkArgument( ++ line.indexOf(LINE_FEED) == -1 && line.indexOf(CARRIAGE_RETURN) == -1, ++ "comment lines cannot contain newlines"); + } + + final String commentText = convertLinesToString(lines); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java +@@ -19,6 +19,11 @@ + + package com.puppycrawl.tools.checkstyle.checks.metrics; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.function.Predicate.not; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -29,7 +34,6 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import java.util.ArrayDeque; + import java.util.ArrayList; + import java.util.Arrays; +-import java.util.Collections; + import java.util.Deque; + import java.util.HashMap; + import java.util.List; +@@ -37,9 +41,7 @@ import java.util.Map; + import java.util.Optional; + import java.util.Set; + import java.util.TreeSet; +-import java.util.function.Predicate; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + + /** Base class for coupling calculation. */ + @FileStatefulCheck +@@ -124,7 +126,7 @@ public abstract class AbstractClassCouplingCheck extends AbstractCheck { + "Stream"); + + /** Package names to ignore. */ +- private static final Set DEFAULT_EXCLUDED_PACKAGES = Collections.emptySet(); ++ private static final Set DEFAULT_EXCLUDED_PACKAGES = ImmutableSet.of(); + + /** Pattern to match brackets in a full type name. */ + private static final Pattern BRACKET_PATTERN = Pattern.compile("\\[[^]]*]"); +@@ -207,13 +209,11 @@ public abstract class AbstractClassCouplingCheck extends AbstractCheck { + */ + public final void setExcludedPackages(String... excludedPackages) { + final List invalidIdentifiers = +- Arrays.stream(excludedPackages) +- .filter(Predicate.not(CommonUtil::isName)) +- .collect(Collectors.toList()); +- if (!invalidIdentifiers.isEmpty()) { +- throw new IllegalArgumentException( +- "the following values are not valid identifiers: " + invalidIdentifiers); +- } ++ Arrays.stream(excludedPackages).filter(not(CommonUtil::isName)).collect(toImmutableList()); ++ checkArgument( ++ invalidIdentifiers.isEmpty(), ++ "the following values are not valid identifiers: %s", ++ invalidIdentifiers); + + this.excludedPackages = Set.of(excludedPackages); + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java +@@ -19,18 +19,17 @@ + + package com.puppycrawl.tools.checkstyle.checks.naming; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.utils.CheckUtil; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +-import java.util.Arrays; + import java.util.HashSet; + import java.util.LinkedList; + import java.util.List; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Validates abbreviations (consecutive capital letters) length in identifier name, it also allows +@@ -199,7 +198,7 @@ public class AbbreviationAsWordInNameCheck extends AbstractCheck { + */ + public void setAllowedAbbreviations(String... allowedAbbreviations) { + if (allowedAbbreviations != null) { +- this.allowedAbbreviations = Arrays.stream(allowedAbbreviations).collect(Collectors.toSet()); ++ this.allowedAbbreviations = ImmutableSet.copyOf(allowedAbbreviations); + } + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheck.java +@@ -22,7 +22,6 @@ package com.puppycrawl.tools.checkstyle.checks.naming; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.utils.TokenUtil; +-import java.util.Objects; + + /** + * Checks lambda parameter names. +@@ -70,7 +69,7 @@ public class LambdaParameterNameCheck extends AbstractNameCheck { + public void visitToken(DetailAST ast) { + final boolean isInSwitchRule = ast.getParent().getType() == TokenTypes.SWITCH_RULE; + +- if (Objects.nonNull(ast.findFirstToken(TokenTypes.PARAMETERS))) { ++ if (ast.findFirstToken(TokenTypes.PARAMETERS) != null) { + final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); + TokenUtil.forEachChild(parametersNode, TokenTypes.PARAMETER_DEF, super::visitToken); + } else if (!isInSwitchRule) { +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.checks.regexp; + ++import static java.util.Objects.requireNonNullElse; ++import static java.util.regex.Pattern.CASE_INSENSITIVE; ++ + import com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter; + import java.util.Optional; + import java.util.regex.Pattern; +@@ -242,8 +245,8 @@ public final class DetectorOptions { + * @return DetectorOptions instance. + */ + public DetectorOptions build() { +- message = Optional.ofNullable(message).orElse(""); +- suppressor = Optional.ofNullable(suppressor).orElse(NeverSuppress.INSTANCE); ++ message = requireNonNullElse(message, ""); ++ suppressor = requireNonNullElse(suppressor, NeverSuppress.INSTANCE); + pattern = Optional.ofNullable(format).map(this::createPattern).orElse(null); + return DetectorOptions.this; + } +@@ -257,7 +260,7 @@ public final class DetectorOptions { + private Pattern createPattern(String formatValue) { + int options = compileFlags; + if (ignoreCase) { +- options |= Pattern.CASE_INSENSITIVE; ++ options |= CASE_INSENSITIVE; + } + return Pattern.compile(formatValue, options); + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/MultilineDetector.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/MultilineDetector.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.checks.regexp; + ++import com.google.common.base.Strings; + import com.puppycrawl.tools.checkstyle.api.FileText; + import com.puppycrawl.tools.checkstyle.api.LineColumn; + import java.util.regex.Matcher; +@@ -69,7 +70,7 @@ class MultilineDetector { + resetState(); + + final String format = options.getFormat(); +- if (format == null || format.isEmpty()) { ++ if (Strings.isNullOrEmpty(format)) { + options.getReporter().log(1, MSG_EMPTY); + } else { + matcher = options.getPattern().matcher(fileText.getFullText()); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.checks.regexp; + ++import static java.util.regex.Pattern.MULTILINE; ++ ++import com.google.common.base.Strings; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -151,7 +154,7 @@ public class RegexpCheck extends AbstractCheck { + private int errorCount; + + /** Specify the pattern to match against. */ +- private Pattern format = Pattern.compile("^$", Pattern.MULTILINE); ++ private Pattern format = Pattern.compile("^$", MULTILINE); + + /** The matcher. */ + private Matcher matcher; +@@ -218,7 +221,7 @@ public class RegexpCheck extends AbstractCheck { + * @since 4.0 + */ + public final void setFormat(Pattern pattern) { +- format = CommonUtil.createPattern(pattern.pattern(), Pattern.MULTILINE); ++ format = CommonUtil.createPattern(pattern.pattern(), MULTILINE); + } + + @Override +@@ -237,8 +240,8 @@ public class RegexpCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void beginTree(DetailAST rootAST) { + matcher = format.matcher(getFileContents().getText().getFullText()); + matchCount = 0; +@@ -336,7 +339,7 @@ public class RegexpCheck extends AbstractCheck { + private String getMessage() { + String msg; + +- if (message == null || message.isEmpty()) { ++ if (Strings.isNullOrEmpty(message)) { + msg = format.pattern(); + } else { + msg = message; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheck.java +@@ -19,13 +19,15 @@ + + package com.puppycrawl.tools.checkstyle.checks.regexp; + ++import static java.util.regex.Pattern.DOTALL; ++import static java.util.regex.Pattern.MULTILINE; ++ + import com.puppycrawl.tools.checkstyle.PropertyType; + import com.puppycrawl.tools.checkstyle.StatelessCheck; + import com.puppycrawl.tools.checkstyle.XdocsPropertyType; + import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; + import com.puppycrawl.tools.checkstyle.api.FileText; + import java.io.File; +-import java.util.regex.Pattern; + + /** + * Checks that a specified pattern matches across multiple lines in any file type. +@@ -121,9 +123,9 @@ public class RegexpMultilineCheck extends AbstractFileSetCheck { + final int result; + + if (matchAcrossLines) { +- result = Pattern.DOTALL; ++ result = DOTALL; + } else { +- result = Pattern.MULTILINE; ++ result = MULTILINE; + } + + return result; +--- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java +@@ -102,8 +102,8 @@ public class RegexpSinglelineJavaCheck extends AbstractCheck { + } + + // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 +- @SuppressWarnings("deprecation") + @Override ++ @SuppressWarnings("deprecation") + public void beginTree(DetailAST rootAST) { + MatchSuppressor suppressor = null; + if (ignoreComments) { +--- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java +@@ -356,7 +356,7 @@ public class SuppressWithPlainTextCommentFilter extends AbstractAutomaticBean im + } + final Suppression suppression = (Suppression) other; + return Objects.equals(lineNo, suppression.lineNo) +- && Objects.equals(suppressionType, suppression.suppressionType) ++ && suppressionType == suppression.suppressionType + && Objects.equals(eventSourceRegexp, suppression.eventSourceRegexp) + && Objects.equals(eventMessageRegexp, suppression.eventMessageRegexp) + && Objects.equals(eventIdRegexp, suppression.eventIdRegexp); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java +@@ -483,7 +483,7 @@ public class SuppressionCommentFilter extends AbstractAutomaticBean implements T + final Tag tag = (Tag) other; + return Objects.equals(line, tag.line) + && Objects.equals(column, tag.column) +- && Objects.equals(tagType, tag.tagType) ++ && tagType == tag.tagType + && Objects.equals(text, tag.text) + && Objects.equals(tagCheckRegexp, tag.tagCheckRegexp) + && Objects.equals(tagMessageRegexp, tag.tagMessageRegexp) +--- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.java +@@ -19,13 +19,13 @@ + + package com.puppycrawl.tools.checkstyle.filters; + ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean; + import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; + import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; + import com.puppycrawl.tools.checkstyle.api.ExternalResourceHolder; + import com.puppycrawl.tools.checkstyle.utils.FilterUtil; +-import java.util.Collections; + import java.util.HashSet; + import java.util.Objects; + import java.util.Set; +@@ -186,7 +186,7 @@ public class SuppressionXpathFilter extends AbstractAutomaticBean + + @Override + public Set getExternalResourceLocations() { +- return Collections.singleton(file); ++ return ImmutableSet.of(file); + } + + @Override +--- a/src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.filters; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++ + import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; + import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +@@ -28,7 +30,6 @@ import java.util.List; + import java.util.Objects; + import java.util.Optional; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import net.sf.saxon.Configuration; + import net.sf.saxon.om.Item; + import net.sf.saxon.sxpath.XPathDynamicContext; +@@ -163,7 +164,7 @@ public class XpathFilterElement implements TreeWalkerFilter { + } else { + isMatching = false; + final List nodes = +- getItems(event).stream().map(AbstractNode.class::cast).collect(Collectors.toList()); ++ getItems(event).stream().map(AbstractNode.class::cast).collect(toImmutableList()); + for (AbstractNode abstractNode : nodes) { + isMatching = + abstractNode.getTokenType() == event.getTokenType() +--- a/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.gui; + ++import static java.util.stream.Collectors.joining; ++import static java.util.stream.Collectors.toCollection; ++ + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.utils.XpathUtil; + import com.puppycrawl.tools.checkstyle.xpath.ElementNode; +@@ -36,7 +39,6 @@ import java.util.Collection; + import java.util.Deque; + import java.util.EventObject; + import java.util.List; +-import java.util.stream.Collectors; + import javax.swing.AbstractAction; + import javax.swing.Action; + import javax.swing.JTable; +@@ -203,7 +205,7 @@ public final class TreeTable extends JTable { + XpathUtil.getXpathItems(xpath, new RootNode(rootAST)).stream() + .map(ElementNode.class::cast) + .map(ElementNode::getUnderlyingNode) +- .collect(Collectors.toCollection(ArrayDeque::new)); ++ .collect(toCollection(ArrayDeque::new)); + updateTreeTable(xpath, nodes); + } catch (XPathException exception) { + xpathEditor.setText(xpathEditor.getText() + NEWLINE + exception.getMessage()); +@@ -254,7 +256,7 @@ public final class TreeTable extends JTable { + private static String getAllMatchingXpathQueriesText(Deque nodes) { + return nodes.stream() + .map(XpathQueryGenerator::generateXpathQuery) +- .collect(Collectors.joining(NEWLINE, "", NEWLINE)); ++ .collect(joining(NEWLINE, "", NEWLINE)); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java +@@ -19,6 +19,10 @@ + + package com.puppycrawl.tools.checkstyle.meta; + ++import static java.util.Collections.unmodifiableMap; ++import static java.util.stream.Collectors.joining; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.DetailNode; +@@ -28,7 +32,6 @@ import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; + import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import java.util.ArrayDeque; + import java.util.Arrays; +-import java.util.Collections; + import java.util.Deque; + import java.util.HashMap; + import java.util.HashSet; +@@ -39,7 +42,6 @@ import java.util.Optional; + import java.util.Set; + import java.util.regex.Matcher; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import javax.xml.parsers.ParserConfigurationException; + import javax.xml.transform.TransformerException; + +@@ -98,7 +100,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { + * files. + */ + private static final Set PROPERTIES_TO_NOT_WRITE = +- Set.of( ++ ImmutableSet.of( + "null", + "the charset property of the parent Checker module"); +@@ -477,7 +479,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { + return Arrays.stream(parentNode.getChildren()) + .filter(child -> child.getType() == JavadocTokenTypes.TEXT) + .map(node -> QUOTE_PATTERN.matcher(node.getText().trim()).replaceAll("")) +- .collect(Collectors.joining(" ")); ++ .collect(joining(" ")); + } + + /** +@@ -594,7 +596,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { + * @return map containing module details of supplied checks. + */ + public static Map getModuleDetailsStore() { +- return Collections.unmodifiableMap(MODULE_DETAILS_STORE); ++ return unmodifiableMap(MODULE_DETAILS_STORE); + } + + /** Reset the module detail store of any previous information. */ +@@ -673,7 +675,7 @@ public class JavadocMetadataScraper extends AbstractJavadocCheck { + return getFirstChildOfType(ast, JavadocTokenTypes.TEXT, 0) + .map(DetailNode::getText) + .map(pattern::matcher) +- .map(Matcher::matches) +- .orElse(Boolean.FALSE); ++ .filter(Matcher::matches) ++ .isPresent(); + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.meta; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++ + import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; + import com.puppycrawl.tools.checkstyle.Checker; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +@@ -34,7 +36,6 @@ import java.nio.file.Path; + import java.nio.file.Paths; + import java.util.ArrayList; + import java.util.List; +-import java.util.stream.Collectors; + import java.util.stream.Stream; + + /** Class which handles all the metadata generation and writing calls. */ +@@ -98,7 +99,7 @@ public final class MetadataGeneratorUtil { + || fileName.endsWith("Check.java") + || fileName.endsWith("Filter.java"); + }) +- .collect(Collectors.toList())); ++ .collect(toImmutableList())); + } + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/meta/ModuleDetails.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/meta/ModuleDetails.java +@@ -19,8 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.meta; + ++import static java.util.Collections.unmodifiableList; ++ + import java.util.ArrayList; +-import java.util.Collections; + import java.util.List; + + /** Simple POJO class for module details. */ +@@ -125,7 +126,7 @@ public final class ModuleDetails { + * @return property list of module + */ + public List getProperties() { +- return Collections.unmodifiableList(properties); ++ return unmodifiableList(properties); + } + + /** +@@ -152,7 +153,7 @@ public final class ModuleDetails { + * @return violation message keys of module + */ + public List getViolationMessageKeys() { +- return Collections.unmodifiableList(violationMessageKeys); ++ return unmodifiableList(violationMessageKeys); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/site/ClassAndPropertiesSettersJavadocScraper.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/ClassAndPropertiesSettersJavadocScraper.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.site; + ++import static java.util.Collections.unmodifiableMap; ++ + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.DetailNode; +@@ -27,7 +29,6 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; + import com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition; + import java.beans.Introspector; +-import java.util.Collections; + import java.util.LinkedHashMap; + import java.util.Map; + import java.util.regex.Pattern; +@@ -65,7 +66,7 @@ public class ClassAndPropertiesSettersJavadocScraper extends AbstractJavadocChec + * @return the javadocs. + */ + public static Map getJavadocsForModuleOrProperty() { +- return Collections.unmodifiableMap(JAVADOC_FOR_MODULE_OR_PROPERTY); ++ return unmodifiableMap(JAVADOC_FOR_MODULE_OR_PROPERTY); + } + + @Override +--- a/src/main/java/com/puppycrawl/tools/checkstyle/site/ExampleMacro.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/ExampleMacro.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.site; + ++import static java.util.stream.Collectors.joining; ++ + import java.io.IOException; + import java.nio.file.Files; + import java.nio.file.Path; +@@ -26,7 +28,6 @@ import java.util.ArrayList; + import java.util.Collection; + import java.util.List; + import java.util.Locale; +-import java.util.stream.Collectors; + import org.apache.maven.doxia.macro.AbstractMacro; + import org.apache.maven.doxia.macro.Macro; + import org.apache.maven.doxia.macro.MacroExecutionException; +@@ -121,7 +122,7 @@ public class ExampleMacro extends AbstractMacro { + .dropWhile(line -> !XML_CONFIG_START.equals(line)) + .skip(1) + .takeWhile(line -> !XML_CONFIG_END.equals(line)) +- .collect(Collectors.joining(NEWLINE)); ++ .collect(joining(NEWLINE)); + } + + /** +@@ -136,7 +137,7 @@ public class ExampleMacro extends AbstractMacro { + .dropWhile(line -> !line.contains(CODE_SNIPPET_START)) + .skip(1) + .takeWhile(line -> !line.contains(CODE_SNIPPET_END)) +- .collect(Collectors.joining(NEWLINE)); ++ .collect(joining(NEWLINE)); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java +@@ -19,6 +19,10 @@ + + package com.puppycrawl.tools.checkstyle.site; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.Collections.unmodifiableSet; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.PropertyType; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailNode; +@@ -29,14 +33,12 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import java.io.File; + import java.lang.reflect.Field; + import java.util.Arrays; +-import java.util.Collections; + import java.util.LinkedList; + import java.util.List; + import java.util.Locale; + import java.util.Map; + import java.util.Set; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import org.apache.maven.doxia.macro.AbstractMacro; + import org.apache.maven.doxia.macro.Macro; + import org.apache.maven.doxia.macro.MacroExecutionException; +@@ -54,16 +56,15 @@ public class PropertiesMacro extends AbstractMacro { + + /** Set of properties not inherited from the base token configuration. */ + public static final Set NON_BASE_TOKEN_PROPERTIES = +- Collections.unmodifiableSet( +- Arrays.stream( +- new String[] { +- "AtclauseOrder - target", +- "DescendantToken - limitedTokens", +- "IllegalType - memberModifiers", +- "MagicNumber - constantWaiverParentToken", +- "MultipleStringLiterals - ignoreOccurrenceContext", +- }) +- .collect(Collectors.toSet())); ++ unmodifiableSet( ++ ImmutableSet.copyOf( ++ new String[] { ++ "AtclauseOrder - target", ++ "DescendantToken - limitedTokens", ++ "IllegalType - memberModifiers", ++ "MagicNumber - constantWaiverParentToken", ++ "MultipleStringLiterals - ignoreOccurrenceContext", ++ })); + + /** The precompiled pattern for a comma followed by a space. */ + private static final Pattern COMMA_SPACE_PATTERN = Pattern.compile(", "); +@@ -331,7 +332,7 @@ public class PropertiesMacro extends AbstractMacro { + final List configurableTokens = + SiteUtil.getDifference(check.getAcceptableTokens(), check.getRequiredTokens()).stream() + .map(TokenUtil::getTokenName) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + sink.text("subset of tokens"); + + writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_TOKEN_TYPES, true); +@@ -343,7 +344,7 @@ public class PropertiesMacro extends AbstractMacro { + check.getAcceptableJavadocTokens(), check.getRequiredJavadocTokens()) + .stream() + .map(JavadocUtil::getTokenName) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + sink.text("subset of javadoc tokens"); + writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_JAVADOC_TOKEN_TYPES, true); + } else { +@@ -470,7 +471,7 @@ public class PropertiesMacro extends AbstractMacro { + final List configurableTokens = + SiteUtil.getDifference(check.getDefaultTokens(), check.getRequiredTokens()).stream() + .map(TokenUtil::getTokenName) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_TOKEN_TYPES, true); + } + } else if (SiteUtil.JAVADOC_TOKENS.equals(propertyName)) { +@@ -479,7 +480,7 @@ public class PropertiesMacro extends AbstractMacro { + SiteUtil.getDifference(check.getDefaultJavadocTokens(), check.getRequiredJavadocTokens()) + .stream() + .map(JavadocUtil::getTokenName) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_JAVADOC_TOKEN_TYPES, true); + } else { + final String defaultValue = getDefaultValue(propertyName, field, instance); +--- a/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java +@@ -19,6 +19,14 @@ + + package com.puppycrawl.tools.checkstyle.site; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++import static com.google.common.collect.ImmutableSet.toImmutableSet; ++import static java.util.stream.Collectors.joining; ++import static java.util.stream.Collectors.toSet; ++ ++import com.google.common.base.Strings; ++import com.google.common.collect.ImmutableList; ++import com.google.common.collect.ImmutableSet; + import com.google.common.collect.Lists; + import com.puppycrawl.tools.checkstyle.Checker; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +@@ -72,7 +80,6 @@ import java.util.Optional; + import java.util.Set; + import java.util.TreeSet; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import java.util.stream.IntStream; + import java.util.stream.Stream; + import javax.annotation.Nullable; +@@ -156,7 +163,7 @@ public final class SiteUtil { + + /** Set of properties that are undocumented. Those are internal properties. */ + private static final Set UNDOCUMENTED_PROPERTIES = +- Set.of( ++ ImmutableSet.of( + "SuppressWithNearbyCommentFilter.fileContents", "SuppressionCommentFilter.fileContents"); + + /** Properties that can not be gathered from class instance. */ +@@ -440,7 +447,7 @@ public final class SiteUtil { + (path, attr) -> { + return attr.isRegularFile() && path.toString().endsWith(".xml.template"); + })) { +- return stream.collect(Collectors.toSet()); ++ return stream.collect(toImmutableSet()); + } catch (IOException ioException) { + throw new MacroExecutionException("Failed to find xdocs templates", ioException); + } +@@ -467,7 +474,7 @@ public final class SiteUtil { + } + + // If parent class is not found, check interfaces +- if (parentModuleName == null || parentModuleName.isEmpty()) { ++ if (Strings.isNullOrEmpty(parentModuleName)) { + final Class[] interfaces = moduleClass.getInterfaces(); + for (Class interfaceClass : interfaces) { + parentModuleName = CLASS_TO_PARENT_MODULE.get(interfaceClass); +@@ -477,7 +484,7 @@ public final class SiteUtil { + } + } + +- if (parentModuleName == null || parentModuleName.isEmpty()) { ++ if (Strings.isNullOrEmpty(parentModuleName)) { + final String message = + String.format( + Locale.ROOT, "Failed to find parent module for %s", moduleClass.getSimpleName()); +@@ -505,7 +512,7 @@ public final class SiteUtil { + prop -> { + return !isGlobalProperty(clss, prop) && !isUndocumentedProperty(clss, prop); + }) +- .collect(Collectors.toSet()); ++ .collect(toSet()); + properties.addAll(getNonExplicitProperties(instance, clss)); + return new TreeSet<>(properties); + } +@@ -624,7 +631,7 @@ public final class SiteUtil { + treeWalkerConfig.addChild(scraperCheckConfig); + try { + checker.configure(defaultConfiguration); +- final List filesToProcess = List.of(moduleFile); ++ final List filesToProcess = ImmutableList.of(moduleFile); + checker.process(filesToProcess); + checker.destroy(); + } catch (CheckstyleException checkstyleException) { +@@ -947,9 +954,7 @@ public final class SiteUtil { + if (value != null && Array.getLength(value) > 0) { + result = + removeSquareBrackets( +- Arrays.stream((Pattern[]) value) +- .map(Pattern::pattern) +- .collect(Collectors.joining(COMMA_SPACE))); ++ Arrays.stream((Pattern[]) value).map(Pattern::pattern).collect(joining(COMMA_SPACE))); + } + + if (result.isEmpty()) { +@@ -981,8 +986,7 @@ public final class SiteUtil { + result = ""; + } else { + try (Stream valuesStream = getValuesStream(value)) { +- result = +- valuesStream.map(String.class::cast).sorted().collect(Collectors.joining(COMMA_SPACE)); ++ result = valuesStream.map(String.class::cast).sorted().collect(joining(COMMA_SPACE)); + } + } + +@@ -1023,10 +1027,7 @@ public final class SiteUtil { + private static String getIntArrayPropertyValue(Object value) { + try (IntStream stream = getIntStream(value)) { + String result = +- stream +- .mapToObj(TokenUtil::getTokenName) +- .sorted() +- .collect(Collectors.joining(COMMA_SPACE)); ++ stream.mapToObj(TokenUtil::getTokenName).sorted().collect(joining(COMMA_SPACE)); + if (result.isEmpty()) { + result = CURLY_BRACKETS; + } +@@ -1132,11 +1133,11 @@ public final class SiteUtil { + */ + public static List getDifference(int[] tokens, int... subtractions) { + final Set subtractionsSet = +- Arrays.stream(subtractions).boxed().collect(Collectors.toSet()); ++ Arrays.stream(subtractions).boxed().collect(toImmutableSet()); + return Arrays.stream(tokens) + .boxed() + .filter(token -> !subtractionsSet.contains(token)) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java +@@ -19,6 +19,7 @@ + + package com.puppycrawl.tools.checkstyle.site; + ++import com.google.common.base.Strings; + import java.io.File; + import java.io.IOException; + import java.io.Reader; +@@ -119,7 +120,7 @@ public class XdocsTemplateParser extends XdocParser { + private void processMacroStart(XmlPullParser parser) throws MacroExecutionException { + macroName = parser.getAttributeValue(null, Attribute.NAME.toString()); + +- if (macroName == null || macroName.isEmpty()) { ++ if (Strings.isNullOrEmpty(macroName)) { + final String message = + String.format( + Locale.ROOT, +@@ -138,7 +139,7 @@ public class XdocsTemplateParser extends XdocParser { + * @throws MacroExecutionException if the parameter name or value is not specified. + */ + private void processParamStart(XmlPullParser parser, Sink sink) throws MacroExecutionException { +- if (macroName != null && !macroName.isEmpty()) { ++ if (!Strings.isNullOrEmpty(macroName)) { + final String paramName = parser.getAttributeValue(null, Attribute.NAME.toString()); + final String paramValue = parser.getAttributeValue(null, Attribute.VALUE.toString()); + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.java +@@ -19,6 +19,9 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static com.google.common.base.Preconditions.checkArgument; ++ ++import com.google.common.collect.ImmutableSet; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.FullIdent; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; +@@ -38,7 +41,7 @@ public final class AnnotationUtil { + private static final String FQ_OVERRIDE = "java.lang." + OVERRIDE; + + /** Simple and fully-qualified {@link Override Override} annotation names. */ +- private static final Set OVERRIDE_ANNOTATIONS = Set.of(OVERRIDE, FQ_OVERRIDE); ++ private static final Set OVERRIDE_ANNOTATIONS = ImmutableSet.of(OVERRIDE, FQ_OVERRIDE); + + /** + * Private utility constructor. +@@ -92,9 +95,7 @@ public final class AnnotationUtil { + * @throws IllegalArgumentException when ast or annotations are null + */ + public static boolean containsAnnotation(DetailAST ast, Set annotations) { +- if (annotations == null) { +- throw new IllegalArgumentException("annotations cannot be null"); +- } ++ checkArgument(annotations != null, "annotations cannot be null"); + boolean result = false; + if (!annotations.isEmpty()) { + final DetailAST firstMatchingAnnotation = +@@ -150,9 +151,7 @@ public final class AnnotationUtil { + * @throws IllegalArgumentException when ast is null + */ + public static DetailAST getAnnotationHolder(DetailAST ast) { +- if (ast == null) { +- throw new IllegalArgumentException(THE_AST_IS_NULL); +- } ++ checkArgument(ast != null, THE_AST_IS_NULL); + + final DetailAST annotationHolder; + +@@ -182,17 +181,11 @@ public final class AnnotationUtil { + * @throws IllegalArgumentException when ast or annotations are null; when annotation is blank + */ + public static DetailAST getAnnotation(final DetailAST ast, String annotation) { +- if (ast == null) { +- throw new IllegalArgumentException(THE_AST_IS_NULL); +- } ++ checkArgument(ast != null, THE_AST_IS_NULL); + +- if (annotation == null) { +- throw new IllegalArgumentException("the annotation is null"); +- } ++ checkArgument(annotation != null, "the annotation is null"); + +- if (CommonUtil.isBlank(annotation)) { +- throw new IllegalArgumentException("the annotation is empty or spaces"); +- } ++ checkArgument(!CommonUtil.isBlank(annotation), "the annotation is empty or spaces"); + + return findFirstAnnotation( + ast, +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java +@@ -19,6 +19,11 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static java.util.function.Predicate.not; ++import static java.util.stream.Collectors.joining; ++import static java.util.stream.Collectors.toUnmodifiableSet; ++ + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.FullIdent; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; +@@ -29,9 +34,7 @@ import java.util.Arrays; + import java.util.Collection; + import java.util.List; + import java.util.Set; +-import java.util.function.Predicate; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import java.util.stream.Stream; + + /** Contains utility methods for the checks. */ +@@ -315,9 +318,7 @@ public final class CheckUtil { + */ + private static AccessModifierOption getAccessModifierFromModifiersTokenDirectly( + DetailAST modifiersToken) { +- if (modifiersToken == null) { +- throw new IllegalArgumentException("expected non-null AST-token with type 'MODIFIERS'"); +- } ++ checkArgument(modifiersToken != null, "expected non-null AST-token with type 'MODIFIERS'"); + + AccessModifierOption accessModifier = AccessModifierOption.PACKAGE; + for (DetailAST token = modifiersToken.getFirstChild(); +@@ -369,8 +370,8 @@ public final class CheckUtil { + public static Set parseClassNames(String... classNames) { + return Arrays.stream(classNames) + .flatMap(className -> Stream.of(className, CommonUtil.baseClassName(className))) +- .filter(Predicate.not(String::isEmpty)) +- .collect(Collectors.toUnmodifiableSet()); ++ .filter(not(String::isEmpty)) ++ .collect(toUnmodifiableSet()); + } + + /** +@@ -391,7 +392,7 @@ public final class CheckUtil { + + return lines.stream() + .map(line -> stripIndentAndTrailingWhitespaceFromLine(line, indent)) +- .collect(Collectors.joining(System.lineSeparator(), suffix, suffix)); ++ .collect(joining(System.lineSeparator(), suffix, suffix)); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java +@@ -32,7 +32,6 @@ import java.net.URL; + import java.nio.file.Path; + import java.nio.file.Paths; + import java.util.BitSet; +-import java.util.Objects; + import java.util.regex.Matcher; + import java.util.regex.Pattern; + import java.util.regex.PatternSyntaxException; +@@ -506,7 +505,7 @@ public final class CommonUtil { + * @return true if the arg is blank. + */ + public static boolean isBlank(String value) { +- return Objects.isNull(value) || indexOfNonWhitespace(value) >= value.length(); ++ return value == null || indexOfNonWhitespace(value) >= value.length(); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtil.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static com.google.common.base.Preconditions.checkArgument; ++ + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.DetailNode; + import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +@@ -262,9 +264,7 @@ public final class JavadocUtil { + */ + public static String getTokenName(int id) { + final String name = TOKEN_VALUE_TO_NAME.get(id); +- if (name == null) { +- throw new IllegalArgumentException(UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE + id); +- } ++ checkArgument(name != null, "%s%s", UNKNOWN_JAVADOC_TOKEN_ID_EXCEPTION_MESSAGE, id); + return name; + } + +@@ -277,9 +277,7 @@ public final class JavadocUtil { + */ + public static int getTokenId(String name) { + final Integer id = TOKEN_NAME_TO_VALUE.get(name); +- if (id == null) { +- throw new IllegalArgumentException("Unknown javadoc token name. Given name " + name); +- } ++ checkArgument(id != null, "Unknown javadoc token name. Given name %s", name); + return id; + } + +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/ModuleReflectionUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/ModuleReflectionUtil.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static com.google.common.collect.ImmutableSet.toImmutableSet; ++ + import com.google.common.reflect.ClassPath; + import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean; + import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; +@@ -33,7 +35,6 @@ import java.lang.reflect.Constructor; + import java.lang.reflect.Modifier; + import java.util.Collection; + import java.util.Set; +-import java.util.stream.Collectors; + + /** Contains utility methods for module reflection. */ + public final class ModuleReflectionUtil { +@@ -57,7 +58,7 @@ public final class ModuleReflectionUtil { + .flatMap(pkg -> classPath.getTopLevelClasses(pkg).stream()) + .map(ClassPath.ClassInfo::load) + .filter(ModuleReflectionUtil::isCheckstyleModule) +- .collect(Collectors.toSet()); ++ .collect(toImmutableSet()); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtil.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static java.util.Objects.requireNonNullElseGet; ++ + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.Scope; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; +@@ -78,8 +80,7 @@ public final class ScopeUtil { + * @see #getDefaultScope(DetailAST) + */ + public static Scope getScopeFromMods(DetailAST aMods) { +- return Optional.ofNullable(getDeclaredScopeFromMods(aMods)) +- .orElseGet(() -> getDefaultScope(aMods)); ++ return requireNonNullElseGet(getDeclaredScopeFromMods(aMods), () -> getDefaultScope(aMods)); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java +@@ -19,6 +19,11 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static com.google.common.base.Preconditions.checkArgument; ++import static com.google.common.collect.ImmutableMap.toImmutableMap; ++import static java.util.function.Predicate.not; ++import static java.util.stream.Collectors.toUnmodifiableMap; ++ + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.TokenTypes; + import java.lang.reflect.Field; +@@ -31,7 +36,6 @@ import java.util.Optional; + import java.util.ResourceBundle; + import java.util.function.Consumer; + import java.util.function.Predicate; +-import java.util.stream.Collectors; + import java.util.stream.IntStream; + + /** Contains utility methods for tokens. */ +@@ -91,7 +95,7 @@ public final class TokenUtil { + public static Map nameToValueMapFromPublicIntFields(Class cls) { + return Arrays.stream(cls.getDeclaredFields()) + .filter(fld -> Modifier.isPublic(fld.getModifiers()) && fld.getType() == Integer.TYPE) +- .collect(Collectors.toUnmodifiableMap(Field::getName, fld -> getIntFromField(fld, null))); ++ .collect(toUnmodifiableMap(Field::getName, fld -> getIntFromField(fld, null))); + } + + /** +@@ -101,8 +105,7 @@ public final class TokenUtil { + * @return inverted map + */ + public static Map invertMap(Map map) { +- return map.entrySet().stream() +- .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); ++ return map.entrySet().stream().collect(toImmutableMap(Map.Entry::getValue, Map.Entry::getKey)); + } + + /** +@@ -134,9 +137,7 @@ public final class TokenUtil { + */ + public static String getTokenName(int id) { + final String name = TOKEN_VALUE_TO_NAME.get(id); +- if (name == null) { +- throw new IllegalArgumentException(String.format(Locale.ROOT, TOKEN_ID_EXCEPTION_FORMAT, id)); +- } ++ checkArgument(name != null, String.format(Locale.ROOT, TOKEN_ID_EXCEPTION_FORMAT, id)); + return name; + } + +@@ -149,10 +150,7 @@ public final class TokenUtil { + */ + public static int getTokenId(String name) { + final Integer id = TOKEN_NAME_TO_VALUE.get(name); +- if (id == null) { +- throw new IllegalArgumentException( +- String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); +- } ++ checkArgument(id != null, String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); + return id; + } + +@@ -164,10 +162,9 @@ public final class TokenUtil { + * @throws IllegalArgumentException when name is unknown + */ + public static String getShortDescription(String name) { +- if (!TOKEN_NAME_TO_VALUE.containsKey(name)) { +- throw new IllegalArgumentException( +- String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); +- } ++ checkArgument( ++ TOKEN_NAME_TO_VALUE.containsKey(name), ++ String.format(Locale.ROOT, TOKEN_NAME_EXCEPTION_FORMAT, name)); + + final String tokenTypes = "com.puppycrawl.tools.checkstyle.api.tokentypes"; + final ResourceBundle bundle = ResourceBundle.getBundle(tokenTypes, Locale.ROOT); +@@ -332,7 +329,7 @@ public final class TokenUtil { + public static BitSet asBitSet(String... tokens) { + return Arrays.stream(tokens) + .map(String::trim) +- .filter(Predicate.not(String::isEmpty)) ++ .filter(not(String::isEmpty)) + .mapToInt(TokenUtil::getTokenId) + .collect(BitSet::new, BitSet::set, BitSet::or); + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java +@@ -19,13 +19,15 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static java.util.stream.Collectors.toUnmodifiableList; ++ ++import com.google.common.collect.ImmutableSet; + import java.util.Arrays; + import java.util.Collection; + import java.util.Collections; + import java.util.List; + import java.util.Map; + import java.util.Set; +-import java.util.stream.Collectors; + + /** + * Note: it simply wraps the existing JDK methods to provide a workaround for Pitest survival on +@@ -68,7 +70,7 @@ public final class UnmodifiableCollectionUtil { + * @return An unmodifiable List containing elements of the specified type. + */ + public static List unmodifiableList(Collection items, Class elementType) { +- return items.stream().map(elementType::cast).collect(Collectors.toUnmodifiableList()); ++ return items.stream().map(elementType::cast).collect(toUnmodifiableList()); + } + + /** +@@ -103,6 +105,6 @@ public final class UnmodifiableCollectionUtil { + * @return immutable set + */ + public static Set singleton(T obj) { +- return Collections.singleton(obj); ++ return ImmutableSet.of(obj); + } + } +--- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.utils; + ++import static java.util.stream.Collectors.joining; ++ + import com.puppycrawl.tools.checkstyle.AstTreeStringPrinter; + import com.puppycrawl.tools.checkstyle.JavaParser; + import com.puppycrawl.tools.checkstyle.api.CheckstyleException; +@@ -34,7 +36,6 @@ import java.util.BitSet; + import java.util.List; + import java.util.Locale; + import java.util.regex.Pattern; +-import java.util.stream.Collectors; + import net.sf.saxon.Configuration; + import net.sf.saxon.om.Item; + import net.sf.saxon.om.NodeInfo; +@@ -194,7 +195,7 @@ public final class XpathUtil { + return matchingItems.stream() + .map(item -> ((ElementNode) item).getUnderlyingNode()) + .map(AstTreeStringPrinter::printBranch) +- .collect(Collectors.joining(DELIMITER)); ++ .collect(joining(DELIMITER)); + } catch (XPathException ex) { + final String errMsg = + String.format( +--- a/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java +@@ -19,7 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.xpath; + +-import java.util.Collections; ++import static java.util.Collections.unmodifiableList; ++ + import java.util.List; + import net.sf.saxon.Configuration; + import net.sf.saxon.event.Receiver; +@@ -91,7 +92,7 @@ public abstract class AbstractNode implements NodeInfo { + if (children == null) { + children = createChildren(); + } +- return Collections.unmodifiableList(children); ++ return unmodifiableList(children); + } + + /** +--- a/src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java ++++ b/src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java +@@ -19,6 +19,8 @@ + + package com.puppycrawl.tools.checkstyle.xpath; + ++import static com.google.common.collect.ImmutableList.toImmutableList; ++ + import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.FileText; +@@ -27,7 +29,6 @@ import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + import com.puppycrawl.tools.checkstyle.utils.XpathUtil; + import java.util.ArrayList; + import java.util.List; +-import java.util.stream.Collectors; + + /** + * Generates xpath queries. Xpath queries are generated based on received {@code DetailAst} element, +@@ -145,7 +146,7 @@ public class XpathQueryGenerator { + public List generate() { + return getMatchingAstElements().stream() + .map(XpathQueryGenerator::generateXpathQuery) +- .collect(Collectors.toList()); ++ .collect(toImmutableList()); + } + + /** --- a/src/test/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBeanTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBeanTest.java @@ -34,9 +34,9 @@ import org.apache.commons.beanutils.ConvertUtilsBean; diff --git a/integration-tests/checkstyle-expected-warnings.txt b/integration-tests/checkstyle-expected-warnings.txt index e69de29bb2..736530b8b5 100644 --- a/integration-tests/checkstyle-expected-warnings.txt +++ b/integration-tests/checkstyle-expected-warnings.txt @@ -0,0 +1,139 @@ +src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java:[35,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[117,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[169,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java:[91,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[104,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java:[67,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `do` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/DetailAstImplTest.java:[595,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/PackageNamesLoaderTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/api/FilterSetTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/api/FullIdentTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheckTest.java:[77,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java:[65,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[193,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[206,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[217,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[228,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java:[103,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckTest.java:[46,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheckTest.java:[59,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckTest.java:[50,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheckTest.java:[55,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheckTest.java:[105,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTest.java:[57,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `native` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java:[290,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `static` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java:[373,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `for` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java:[125,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `return` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheckTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheckTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckTest.java:[54,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheckTest.java:[99,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `null` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java:[81,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheckTest.java:[59,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[57,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[75,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheckTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImplTest.java:[30,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfoTest.java:[230,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `throws` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfoTest.java:[294,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `return` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[89,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[102,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[94,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtilTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `extractInlineTags` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java:[189,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `new` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[188,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `extends` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[196,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `implements` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[266,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `throws` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifierOptionTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `case` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheckTest.java:[67,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheckTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java:[48,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `catch` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheckTest.java:[78,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheckTest.java:[47,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheckTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheckTest.java:[120,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java:[195,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthCheckTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java:[94,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java:[93,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `abstract` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java:[73,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheckTest.java:[62,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheckTest.java:[50,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheckTest.java:[51,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheckTest.java:[62,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheckTest.java:[50,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java:[174,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `synchronized` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheckTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCaseDefaultColonCheckTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheckTest.java:[44,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheckTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheckTest.java:[46,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/filters/IntMatchFilterElementTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilterTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElementTest.java:[185,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilterTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilterTest.java:[210,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilterTest.java:[151,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionSingleFilterTest.java:[42,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/grammar/antlr4/Antlr4AstRegressionTest.java:[34,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/CommentsTest.java:[53,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/grammar/java8/DefaultMethodsTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `switch` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/gui/BaseCellEditorTest.java:[31,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `toString` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/utils/CheckUtilTest.java:[71,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) +src/test/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGeneratorTest.java:[205,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGeneratorTest.java:[219,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `import` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGeneratorTest.java:[265,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `switch` is not a valid identifier) diff --git a/integration-tests/checkstyle-init.patch b/integration-tests/checkstyle-init.patch index 0a357c6b16..20192edd62 100644 --- a/integration-tests/checkstyle-init.patch +++ b/integration-tests/checkstyle-init.patch @@ -22,16 +22,19 @@ -@@ -2405,7 +2413,7 @@ - - - tech.picnic.error-prone-support -- error-prone-contrib -+ refaster-runner +@@ -2408,6 +2416,11 @@ + error-prone-contrib ${error-prone-support.version} ++ ++ tech.picnic.error-prone-support ++ refaster-runner ++ ${error-prone-support.version} ++ -@@ -2452,9 +2460,10 @@ + + +@@ -2452,9 +2465,10 @@ -XDcompilePolicy=simple -Xplugin:ErrorProne \ @@ -43,7 +46,7 @@ -@@ -2467,6 +2476,11 @@ +@@ -2467,6 +2481,11 @@ error-prone-contrib ${error-prone-support.version} From 4638392d5425b8020c61c7f56b3ee41e94fa9f34 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Mon, 29 Jan 2024 06:28:51 +0100 Subject: [PATCH 6/6] Upgrade to 10.13.0 --- .../checkstyle-expected-changes.patch | 2485 ++++++++++++----- .../checkstyle-expected-warnings.txt | 19 +- integration-tests/checkstyle-init.patch | 16 +- integration-tests/checkstyle.sh | 2 +- 4 files changed, 1731 insertions(+), 791 deletions(-) diff --git a/integration-tests/checkstyle-expected-changes.patch b/integration-tests/checkstyle-expected-changes.patch index eac8d9afbf..d54a795a85 100644 --- a/integration-tests/checkstyle-expected-changes.patch +++ b/integration-tests/checkstyle-expected-changes.patch @@ -380,8 +380,8 @@ --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java -@@ -24,7 +24,7 @@ import com.puppycrawl.tools.checkstyle.api.Configuration; - import com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDeclarationOrderCheck; +@@ -25,7 +25,7 @@ import com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDeclarationO + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; import org.junit.jupiter.api.Test; -public class OverloadMethodsDeclarationOrderTest extends AbstractGoogleModuleTestSupport { @@ -389,7 +389,7 @@ @Override protected String getPackageLocation() { -@@ -32,7 +32,7 @@ public class OverloadMethodsDeclarationOrderTest extends AbstractGoogleModuleTes +@@ -33,7 +33,7 @@ public class OverloadMethodsDeclarationOrderTest extends AbstractGoogleModuleTes } @Test @@ -398,6 +398,15 @@ final Class clazz = OverloadMethodsDeclarationOrderCheck.class; final String messageKey = "overload.methods.declaration"; +@@ -53,7 +53,7 @@ public class OverloadMethodsDeclarationOrderTest extends AbstractGoogleModuleTes + } + + @Test +- public void testOverloadMethodsDeclarationOrderPrivateAndStaticMethods() throws Exception { ++ void overloadMethodsDeclarationOrderPrivateAndStaticMethods() throws Exception { + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java @@ -24,7 +24,7 @@ import com.puppycrawl.tools.checkstyle.api.Configuration; @@ -3166,6 +3175,151 @@ "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + "@text='SuppressionXpathRegressionBooleanExpressionComplexityThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodThree']]/SLIST/LITERAL_IF"); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java +@@ -21,14 +21,14 @@ package org.checkstyle.suppressionxpathfilter; + + import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.naming.CatchParameterNameCheck; + import java.io.File; +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupport { ++final class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupport { + private final String checkName = CatchParameterNameCheck.class.getSimpleName(); + + @Override +@@ -37,7 +37,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testSimple() throws Exception { ++ void simple() throws Exception { + final String pattern = "^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -50,7 +50,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" +@@ -60,7 +60,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testNested() throws Exception { ++ void nested() throws Exception { + final String pattern = "^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -73,7 +73,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameNested']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='NestedClass']]" +@@ -85,7 +85,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testStaticInit() throws Exception { ++ void staticInit() throws Exception { + final String pattern = "^[a-z][a-zA-Z0-9]+$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -99,7 +99,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameStaticInit']]" + + "/OBJBLOCK/STATIC_INIT/SLIST" +@@ -109,7 +109,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testAnonymous() throws Exception { ++ void anonymous() throws Exception { + final String pattern = "^[a-z][a-zA-Z0-9]+$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -124,7 +124,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameAnonymous']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" +@@ -137,7 +137,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testLambda() throws Exception { ++ void lambda() throws Exception { + final String pattern = "^[A-Z][a-z]+$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -151,7 +151,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameLambda']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='lambdaFunction']]" +@@ -163,7 +163,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testEnum() throws Exception { ++ void testEnum() throws Exception { + final String pattern = "^[A-Z][a-z]+$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -178,7 +178,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/ENUM_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameEnum']]" + + "/OBJBLOCK/ENUM_CONSTANT_DEF[./IDENT[@text='VALUE']]" +@@ -190,7 +190,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + } + + @Test +- public void testInterface() throws Exception { ++ void testInterface() throws Exception { + final String pattern = "^[A-Z][a-z]+$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(CatchParameterNameCheck.class); +@@ -204,7 +204,7 @@ public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupp + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/INTERFACE_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionCatchParameterNameInterface']]" + + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='InnerInterface']]" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java @@ -26,7 +26,7 @@ import java.util.Arrays; @@ -4076,6 +4230,43 @@ final File fileToProcess = new File(getPath("SuppressionXpathRegressionEqualsAvoidNullIgnoreCase.java")); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsHashCodeTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsHashCodeTest.java +@@ -26,14 +26,14 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionEqualsHashCodeTest extends AbstractXpathTestSupport { ++final class XpathRegressionEqualsHashCodeTest extends AbstractXpathTestSupport { + @Override + protected String getCheckName() { + return EqualsHashCodeCheck.class.getSimpleName(); + } + + @Test +- public void testEqualsOnly() throws Exception { ++ void equalsOnly() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionEqualsHashCode1.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(EqualsHashCodeCheck.class); +@@ -58,7 +58,7 @@ public class XpathRegressionEqualsHashCodeTest extends AbstractXpathTestSupport + } + + @Test +- public void testHashCodeOnly() throws Exception { ++ void hashCodeOnly() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionEqualsHashCode2.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(EqualsHashCodeCheck.class); +@@ -83,7 +83,7 @@ public class XpathRegressionEqualsHashCodeTest extends AbstractXpathTestSupport + } + + @Test +- public void testNestedCase() throws Exception { ++ void nestedCase() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionEqualsHashCodeNestedCase.java")); + --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExplicitInitializationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExplicitInitializationTest.java @@ -19,14 +19,14 @@ @@ -4369,6 +4560,78 @@ "/COMPILATION_UNIT/CLASS_DEF" + "[./IDENT[@text='SuppressionXpathRegressionFinalLocalVariable9']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]/SLIST/LITERAL_TRY" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalParametersTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalParametersTest.java +@@ -19,13 +19,14 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck; + import java.io.File; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport { ++final class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport { + + private final String checkName = FinalParametersCheck.class.getSimpleName(); + +@@ -35,7 +36,7 @@ public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport + } + + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionFinalParameters1.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalParametersCheck.class); +@@ -46,7 +47,7 @@ public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalParameters1']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" +@@ -72,7 +73,7 @@ public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport + } + + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionFinalParameters2.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalParametersCheck.class); +@@ -85,7 +86,7 @@ public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalParameters2']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" +@@ -116,7 +117,7 @@ public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport + } + + @Test +- public void testThree() throws Exception { ++ void three() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionFinalParameters3.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalParametersCheck.class); +@@ -129,7 +130,7 @@ public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='SuppressionXpathRegressionFinalParameters3']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='createClass']]/SLIST/" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java @@ -19,15 +19,15 @@ @@ -4853,6 +5116,62 @@ "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalToken2']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myTest']]" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTextTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTextTest.java +@@ -19,15 +19,15 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck; + import java.io.File; + import java.util.Arrays; +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSupport { ++final class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSupport { + + private final String checkName = IllegalTokenTextCheck.class.getSimpleName(); + +@@ -37,7 +37,7 @@ public class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSuppor + } + + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionIllegalTokenText1.java")); + final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenTextCheck.class); +@@ -62,7 +62,7 @@ public class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSuppor + } + + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionIllegalTokenText2.java")); + final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenTextCheck.class); +@@ -90,7 +90,7 @@ public class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSuppor + } + + @Test +- public void testThree() throws Exception { ++ void three() throws Exception { + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionIllegalTokenText3.java")); + final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenTextCheck.class); +@@ -102,7 +102,7 @@ public class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSuppor + IllegalTokenTextCheck.class, IllegalTokenTextCheck.MSG_KEY, "invalidIdentifier"), + }; + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT" + + "/INTERFACE_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalTokenText3']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='invalidIdentifier']"); --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTypeTest.java @@ -19,14 +19,14 @@ @@ -5247,6 +5566,44 @@ final File fileToProcess = new File(getPath("SuppressionXpathRegressionInnerAssignment2.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerTypeLastTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerTypeLastTest.java +@@ -28,7 +28,7 @@ import java.util.Arrays; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionInnerTypeLastTest extends AbstractXpathTestSupport { ++final class XpathRegressionInnerTypeLastTest extends AbstractXpathTestSupport { + + private final String checkName = InnerTypeLastCheck.class.getSimpleName(); + +@@ -38,7 +38,7 @@ public class XpathRegressionInnerTypeLastTest extends AbstractXpathTestSupport { + } + + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionInnerTypeLastOne.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class); +@@ -68,7 +68,7 @@ public class XpathRegressionInnerTypeLastTest extends AbstractXpathTestSupport { + } + + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + + final File fileToProcess = new File(getPath("SuppressionXpathRegressionInnerTypeLastTwo.java")); + +@@ -99,7 +99,7 @@ public class XpathRegressionInnerTypeLastTest extends AbstractXpathTestSupport { + } + + @Test +- public void testThree() throws Exception { ++ void three() throws Exception { + + final File fileToProcess = + new File(getPath("SuppressionXpathRegressionInnerTypeLastThree.java")); --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java @@ -26,7 +26,7 @@ import java.util.Arrays; @@ -5441,6 +5798,79 @@ "/COMPILATION_UNIT/CLASS_DEF" + "[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionSix']]" + "/OBJBLOCK/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavaNCSSTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavaNCSSTest.java +@@ -19,6 +19,7 @@ + + package org.checkstyle.suppressionxpathfilter; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck; + import java.io.File; +@@ -26,7 +27,7 @@ import java.util.List; + import org.junit.jupiter.api.Test; + + // -@cs[AbbreviationAsWordInName] Test should be named as its main class. +-public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { ++final class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + + private final String checkName = JavaNCSSCheck.class.getSimpleName(); + +@@ -36,7 +37,7 @@ public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + } + + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionJavaNCSSOne.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(JavaNCSSCheck.class); +@@ -46,7 +47,7 @@ public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSOne']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", +@@ -61,7 +62,7 @@ public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + } + + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionJavaNCSSTwo.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(JavaNCSSCheck.class); +@@ -73,7 +74,7 @@ public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- List.of( ++ ImmutableList.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='SuppressionXpathRegressionJavaNCSSTwo']]", + "/COMPILATION_UNIT/CLASS_DEF" +@@ -86,7 +87,7 @@ public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + } + + @Test +- public void testThree() throws Exception { ++ void three() throws Exception { + final File fileToProcess = new File(getPath("SuppressionXpathRegressionJavaNCSSThree.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(JavaNCSSCheck.class); +@@ -98,7 +99,7 @@ public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- List.of("/COMPILATION_UNIT", "/COMPILATION_UNIT/PACKAGE_DEF"); ++ ImmutableList.of("/COMPILATION_UNIT", "/COMPILATION_UNIT/PACKAGE_DEF"); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocContentLocationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocContentLocationTest.java @@ -19,14 +19,14 @@ @@ -7667,6 +8097,79 @@ final File fileToProcess = new File(getNonCompilablePath("SuppressionXpathRegression2.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageDeclarationCheck.class); +--- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageNameTest.java ++++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageNameTest.java +@@ -21,14 +21,14 @@ package org.checkstyle.suppressionxpathfilter; + + import static com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck.MSG_KEY; + ++import com.google.common.collect.ImmutableList; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; + import com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck; + import java.io.File; +-import java.util.Collections; + import java.util.List; + import org.junit.jupiter.api.Test; + +-public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { ++final class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + + private final String checkName = PackageNameCheck.class.getSimpleName(); + +@@ -38,7 +38,7 @@ public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + } + + @Test +- public void testOne() throws Exception { ++ void one() throws Exception { + + final File fileToProcess = new File(getPath("SuppressionXpathRegressionPackageNameOne.java")); + +@@ -57,7 +57,7 @@ public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/PACKAGE_DEF/DOT" + + "[./IDENT[@text='packagename']]/DOT" + + "[./IDENT[@text='suppressionxpathfilter']]" +@@ -67,7 +67,7 @@ public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + } + + @Test +- public void testTwo() throws Exception { ++ void two() throws Exception { + + final File fileToProcess = + new File(getNonCompilablePath("SuppressionXpathRegressionPackageName.java")); +@@ -86,7 +86,7 @@ public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/PACKAGE_DEF/DOT[./IDENT" + + "[@text='PACKAGENAME']]/DOT[./IDENT" + + "[@text='suppressionxpathfilter']]" +@@ -96,7 +96,7 @@ public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + } + + @Test +- public void testThree() throws Exception { ++ void three() throws Exception { + + final File fileToProcess = new File(getPath("SuppressionXpathRegressionPackageNameTwo.java")); + +@@ -115,7 +115,7 @@ public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + }; + + final List expectedXpathQueries = +- Collections.singletonList( ++ ImmutableList.of( + "/COMPILATION_UNIT/PACKAGE_DEF/DOT" + + "[./IDENT[@text='packagename']]/DOT" + + "[./IDENT[@text='suppressionxpathfilter']]" --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNameTest.java @@ -19,15 +19,15 @@ @@ -9676,8 +10179,8 @@ package com.puppycrawl.tools.checkstyle; -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; ++import static java.util.stream.Collectors.toUnmodifiableList; ++import static java.util.stream.Collectors.toUnmodifiableSet; + import com.puppycrawl.tools.checkstyle.api.AuditEvent; import com.puppycrawl.tools.checkstyle.api.AuditListener; @@ -9694,8 +10197,8 @@ final List targetFiles = files.stream() .filter(file -> CommonUtil.matchesFileExtension(file, fileExtensions)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); processFiles(targetFiles); // Finish up @@ -9703,8 +10206,8 @@ resource -> { return ((ExternalResourceHolder) resource).getExternalResourceLocations().stream(); }) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } /** Notify all listeners about the audit start. */ @@ -9797,13 +10300,13 @@ --- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java -@@ -19,19 +19,21 @@ +@@ -19,20 +19,22 @@ package com.puppycrawl.tools.checkstyle; -+import static com.google.common.collect.ImmutableList.toImmutableList; +import static java.util.Objects.requireNonNullElseGet; +import static java.util.stream.Collectors.toCollection; ++import static java.util.stream.Collectors.toUnmodifiableList; + +import com.google.common.collect.ImmutableList; import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -9815,32 +10318,33 @@ -import java.util.Collections; import java.util.Iterator; import java.util.List; --import java.util.Optional; +-import java.util.Objects; + import java.util.Optional; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.stream.Collectors; import org.antlr.v4.runtime.BufferedTokenStream; import org.antlr.v4.runtime.CommonTokenStream; import org.antlr.v4.runtime.ParserRuleContext; -@@ -406,7 +408,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); +- .collect(Collectors.toUnmodifiableList())); ++ .collect(toUnmodifiableList())); // We add C style array declarator brackets to TYPE ast final DetailAstImpl typeAst = (DetailAstImpl) methodDef.findFirstToken(TokenTypes.TYPE); -@@ -469,7 +471,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor children = ctx.children.stream() .filter(child -> !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); processChildren(methodDef, children); // We add C style array declarator brackets to TYPE ast -@@ -780,7 +782,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); +- .collect(Collectors.toUnmodifiableList())); ++ .collect(toUnmodifiableList())); // We add C style array declarator brackets to TYPE ast final DetailAstImpl typeAst = -@@ -852,7 +854,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !child.equals(ctx.LITERAL_SUPER())) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); +- .collect(Collectors.toUnmodifiableList())); ++ .collect(toUnmodifiableList())); return primaryCtorCall; } -@@ -1090,7 +1092,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !(child instanceof JavaLanguageParser.VariableModifierContext)) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); +- .collect(Collectors.toUnmodifiableList())); ++ .collect(toUnmodifiableList())); return catchParameterDef; } -@@ -1421,8 +1423,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor children = ctx.children.stream() .filter(child -> !child.equals(ctx.DOUBLE_COLON())) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); processChildren(doubleColon, children); return doubleColon; } -@@ -1520,7 +1520,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor !child.equals(ctx.QUESTION())) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); +- .collect(Collectors.toUnmodifiableList())); ++ .collect(toUnmodifiableList())); return root; } -@@ -1547,7 +1547,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor descendantList = binOpList.parallelStream() .map(this::getInnerBopAst) @@ -9923,7 +10427,7 @@ bop.addChild(descendantList.poll()); DetailAstImpl pointer = bop.getFirstChild(); -@@ -1584,8 +1584,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor buildSimpleStringTemplateArgument(ctx)); + } + +@@ -1773,7 +1772,7 @@ public final class JavaAstVisitor extends JavaLanguageParserBaseVisitor packageName + PACKAGE_SEPARATOR + name) .flatMap(className -> Stream.of(className, className + CHECK_SUFFIX)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); Object instance = null; for (String possibleName : possibleNames) { instance = createObject(possibleName); --- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java -@@ -19,10 +19,11 @@ +@@ -19,10 +19,12 @@ package com.puppycrawl.tools.checkstyle; +import static com.google.common.base.Preconditions.checkArgument; ++import static java.util.function.Function.identity; ++import static java.util.stream.Collectors.toUnmodifiableMap; + -+import com.google.common.collect.Maps; import java.util.Map; import java.util.Properties; -import java.util.function.Function; @@ -10253,18 +10776,18 @@ /** Resolves external properties from an underlying {@code Properties} object. */ public final class PropertiesExpander implements PropertyResolver { -@@ -37,12 +38,8 @@ public final class PropertiesExpander implements PropertyResolver { +@@ -37,12 +39,10 @@ public final class PropertiesExpander implements PropertyResolver { * @throws IllegalArgumentException when properties argument is null */ public PropertiesExpander(Properties properties) { - if (properties == null) { - throw new IllegalArgumentException("cannot pass null"); - } -- values = -- properties.stringPropertyNames().stream() -- .collect(Collectors.toMap(Function.identity(), properties::getProperty)); + checkArgument(properties != null, "cannot pass null"); -+ values = Maps.toMap(properties.stringPropertyNames(), properties::getProperty); + values = + properties.stringPropertyNames().stream() +- .collect(Collectors.toUnmodifiableMap(Function.identity(), properties::getProperty)); ++ .collect(toUnmodifiableMap(identity(), properties::getProperty)); } @Override @@ -10279,7 +10802,7 @@ import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; -@@ -93,12 +95,8 @@ public final class PropertyCacheFile { +@@ -94,12 +96,8 @@ public final class PropertyCacheFile { * @throws IllegalArgumentException when either arguments are null */ public PropertyCacheFile(Configuration config, String fileName) { @@ -10401,9 +10924,9 @@ package com.puppycrawl.tools.checkstyle; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; +import static java.util.Comparator.naturalOrder; +import static java.util.Comparator.nullsLast; ++import static java.util.stream.Collectors.toUnmodifiableSet; + import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; @@ -10420,8 +10943,8 @@ resource -> { return ((ExternalResourceHolder) resource).getExternalResourceLocations().stream(); }) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } /** @@ -10518,7 +11041,7 @@ package com.puppycrawl.tools.checkstyle.ant; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; import com.puppycrawl.tools.checkstyle.Checker; @@ -10535,8 +11058,8 @@ return Arrays.stream(fileNames) .map(name -> scanner.getBasedir() + File.separator + name) .map(File::new) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } /** Poor man enumeration for the formatter types. */ @@ -10828,20 +11351,12 @@ package com.puppycrawl.tools.checkstyle.checks; -+import com.google.common.collect.ImmutableSet; -+import com.google.common.collect.Sets; ++import static java.util.stream.Collectors.toUnmodifiableSet; ++ import com.puppycrawl.tools.checkstyle.Definitions; import com.puppycrawl.tools.checkstyle.GlobalStatefulCheck; import com.puppycrawl.tools.checkstyle.LocalizedMessage; -@@ -32,7 +34,6 @@ import java.io.File; - import java.io.InputStream; - import java.nio.file.Files; - import java.nio.file.NoSuchFileException; --import java.util.Arrays; - import java.util.HashSet; - import java.util.Locale; - import java.util.Map; -@@ -46,7 +47,6 @@ import java.util.TreeSet; +@@ -46,7 +48,6 @@ import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -10849,23 +11364,21 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -@@ -226,7 +226,7 @@ public class TranslationCheck extends AbstractFileSetCheck { +@@ -228,7 +229,7 @@ public class TranslationCheck extends AbstractFileSetCheck { * @since 6.11 */ public void setRequiredTranslations(String... translationCodes) { -- requiredTranslations = Arrays.stream(translationCodes).collect(Collectors.toSet()); -+ requiredTranslations = ImmutableSet.copyOf(translationCodes); +- requiredTranslations = Arrays.stream(translationCodes).collect(Collectors.toUnmodifiableSet()); ++ requiredTranslations = Arrays.stream(translationCodes).collect(toUnmodifiableSet()); validateUserSpecifiedLanguageCodes(requiredTranslations); } -@@ -497,9 +497,7 @@ public class TranslationCheck extends AbstractFileSetCheck { - for (Entry> fileKey : fileKeys.entrySet()) { - final Set currentFileKeys = fileKey.getValue(); +@@ -501,7 +502,7 @@ public class TranslationCheck extends AbstractFileSetCheck { final Set missingKeys = -- keysThatMustExist.stream() -- .filter(key -> !currentFileKeys.contains(key)) -- .collect(Collectors.toSet()); -+ Sets.difference(keysThatMustExist, currentFileKeys).immutableCopy(); + keysThatMustExist.stream() + .filter(key -> !currentFileKeys.contains(key)) +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); if (!missingKeys.isEmpty()) { final MessageDispatcher dispatcher = getMessageDispatcher(); final String path = fileKey.getKey().getAbsolutePath(); @@ -10991,30 +11504,29 @@ * Setter to specify exception class names to reject. --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java -@@ -19,16 +19,15 @@ +@@ -19,6 +19,8 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -+import com.google.common.collect.ImmutableSet; ++import static java.util.stream.Collectors.toUnmodifiableSet; ++ import com.puppycrawl.tools.checkstyle.FileStatefulCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; 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.utils.CommonUtil; --import java.util.Arrays; +@@ -28,7 +30,6 @@ import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + import java.util.Arrays; import java.util.HashSet; import java.util.Set; -import java.util.stream.Collectors; /** * Checks for illegal instantiations where a factory method is preferred. -@@ -314,6 +313,6 @@ public class IllegalInstantiationCheck extends AbstractCheck { +@@ -314,6 +315,6 @@ public class IllegalInstantiationCheck extends AbstractCheck { * @since 3.0 */ public void setClasses(String... names) { -- classes = Arrays.stream(names).collect(Collectors.toSet()); -+ classes = ImmutableSet.copyOf(names); +- classes = Arrays.stream(names).collect(Collectors.toUnmodifiableSet()); ++ classes = Arrays.stream(names).collect(toUnmodifiableSet()); } } --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java @@ -11072,7 +11584,7 @@ import java.util.regex.Pattern; /** -@@ -124,7 +126,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { +@@ -125,7 +127,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { * @since 3.2 */ public void setMessage(String message) { @@ -11081,7 +11593,7 @@ } /** -@@ -156,7 +158,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { +@@ -157,7 +159,7 @@ public class IllegalTokenTextCheck extends AbstractCheck { private void updateRegexp() { final int compileFlags; if (ignoreCase) { @@ -11096,7 +11608,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; @@ -11113,22 +11625,23 @@ final List matchingItems = xpathExpression.evaluate(xpathDynamicContext); return matchingItems.stream() .map(item -> (DetailAST) ((AbstractNode) item).getUnderlyingNode()) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } catch (XPathException ex) { throw new IllegalStateException("Evaluation of Xpath query failed: " + query, ex); } --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java -@@ -19,6 +19,7 @@ +@@ -19,6 +19,8 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -+import com.google.common.collect.Sets; ++import static java.util.stream.Collectors.toUnmodifiableSet; ++ import com.puppycrawl.tools.checkstyle.FileStatefulCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -31,7 +32,6 @@ import java.util.HashSet; +@@ -31,7 +33,6 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -11136,14 +11649,12 @@ /** * Checks that for loop control variables are not modified inside the for block. An example is: -@@ -293,9 +293,7 @@ public final class ModifiedControlVariableCheck extends AbstractCheck { - private static Set getVariablesManagedByForLoop(DetailAST ast) { - final Set initializedVariables = getForInitVariables(ast); +@@ -295,7 +296,7 @@ public final class ModifiedControlVariableCheck extends AbstractCheck { final Set iteratingVariables = getForIteratorVariables(ast); -- return initializedVariables.stream() -- .filter(iteratingVariables::contains) -- .collect(Collectors.toSet()); -+ return Sets.intersection(initializedVariables, iteratingVariables).immutableCopy(); + return initializedVariables.stream() + .filter(iteratingVariables::contains) +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } /** @@ -11180,7 +11691,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.FileStatefulCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; @@ -11197,8 +11708,8 @@ typeDeclDesc -> { return hasSameNameAsSuperClass(superClassName, typeDeclDesc); }) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } /** @@ -11209,16 +11720,15 @@ package com.puppycrawl.tools.checkstyle.checks.design; +import static java.util.Objects.requireNonNullElse; ++import static java.util.stream.Collectors.toUnmodifiableSet; + -+import com.google.common.collect.ImmutableSet; import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -27,14 +30,11 @@ import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; +@@ -28,13 +31,11 @@ import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; import com.puppycrawl.tools.checkstyle.utils.ScopeUtil; import com.puppycrawl.tools.checkstyle.utils.TokenUtil; --import java.util.Arrays; + import java.util.Arrays; -import java.util.Objects; import java.util.Optional; import java.util.Set; @@ -11229,32 +11739,26 @@ /** * Checks that classes are designed for extension (subclass creation). -@@ -176,11 +176,10 @@ public class DesignForExtensionCheck extends AbstractCheck { - - /** Specify annotations which allow the check to skip the method from validation. */ - private Set ignoredAnnotations = -- Arrays.stream( -- new String[] { -- "Test", "Before", "After", "BeforeClass", "AfterClass", -- }) -- .collect(Collectors.toSet()); -+ ImmutableSet.copyOf( -+ new String[] { -+ "Test", "Before", "After", "BeforeClass", "AfterClass", -+ }); +@@ -180,7 +181,7 @@ public class DesignForExtensionCheck extends AbstractCheck { + new String[] { + "Test", "Before", "After", "BeforeClass", "AfterClass", + }) +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); /** * Specify the comment text pattern which qualifies a method as designed for extension. Supports -@@ -195,7 +194,7 @@ public class DesignForExtensionCheck extends AbstractCheck { +@@ -195,8 +196,7 @@ public class DesignForExtensionCheck extends AbstractCheck { * @since 7.2 */ public void setIgnoredAnnotations(String... ignoredAnnotations) { -- this.ignoredAnnotations = Arrays.stream(ignoredAnnotations).collect(Collectors.toSet()); -+ this.ignoredAnnotations = ImmutableSet.copyOf(ignoredAnnotations); +- this.ignoredAnnotations = +- Arrays.stream(ignoredAnnotations).collect(Collectors.toUnmodifiableSet()); ++ this.ignoredAnnotations = Arrays.stream(ignoredAnnotations).collect(toUnmodifiableSet()); } /** -@@ -396,7 +395,7 @@ public class DesignForExtensionCheck extends AbstractCheck { +@@ -397,7 +397,7 @@ public class DesignForExtensionCheck extends AbstractCheck { */ private static String getAnnotationName(DetailAST annotation) { final DetailAST dotAst = annotation.findFirstToken(TokenTypes.DOT); @@ -11425,7 +11929,7 @@ import com.puppycrawl.tools.checkstyle.FileStatefulCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; -@@ -648,10 +650,10 @@ public class CustomImportOrderCheck extends AbstractCheck { +@@ -649,10 +651,10 @@ public class CustomImportOrderCheck extends AbstractCheck { } else if (ruleStr.startsWith(SAME_PACKAGE_RULE_GROUP)) { final String rule = ruleStr.substring(ruleStr.indexOf('(') + 1, ruleStr.indexOf(')')); samePackageMatchingDepth = Integer.parseInt(rule); @@ -11437,7 +11941,7 @@ + samePackageMatchingDepth > 0, + "SAME_PACKAGE rule parameter should be positive integer: %s", + ruleStr); - customOrderRules.add(SAME_PACKAGE_RULE_GROUP); + customImportOrderRules.add(SAME_PACKAGE_RULE_GROUP); } else { throw new IllegalStateException("Unexpected rule: " + ruleStr); --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java @@ -11505,7 +12009,7 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser; import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser.ParseErrorMessage; @@ -11518,26 +12022,29 @@ /** * Base class for Checks that process Javadoc comments. -@@ -182,7 +183,7 @@ public abstract class AbstractJavadocCheck extends AbstractCheck { +@@ -182,9 +183,7 @@ public abstract class AbstractJavadocCheck extends AbstractCheck { validateDefaultJavadocTokens(); if (javadocTokens.isEmpty()) { javadocTokens.addAll( -- Arrays.stream(getDefaultJavadocTokens()).boxed().collect(Collectors.toList())); -+ Arrays.stream(getDefaultJavadocTokens()).boxed().collect(toImmutableList())); +- Arrays.stream(getDefaultJavadocTokens()) +- .boxed() +- .collect(Collectors.toUnmodifiableList())); ++ Arrays.stream(getDefaultJavadocTokens()).boxed().collect(toUnmodifiableList())); } else { final int[] acceptableJavadocTokens = getAcceptableJavadocTokens(); Arrays.sort(acceptableJavadocTokens); --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java -@@ -19,14 +19,13 @@ +@@ -19,6 +19,8 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; -+import com.google.common.collect.ImmutableSet; ++import static java.util.stream.Collectors.toUnmodifiableSet; ++ import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.DetailNode; import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; --import java.util.Arrays; +@@ -26,7 +28,6 @@ import java.util.Arrays; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -11545,12 +12052,12 @@ /** * Checks that a invalidIdentifiers = -- Arrays.stream(excludedPackages) + Arrays.stream(excludedPackages) - .filter(Predicate.not(CommonUtil::isName)) -- .collect(Collectors.toList()); +- .collect(Collectors.toUnmodifiableList()); - if (!invalidIdentifiers.isEmpty()) { - throw new IllegalArgumentException( - "the following values are not valid identifiers: " + invalidIdentifiers); - } -+ Arrays.stream(excludedPackages).filter(not(CommonUtil::isName)).collect(toImmutableList()); ++ .filter(not(CommonUtil::isName)) ++ .collect(toUnmodifiableList()); + checkArgument( + invalidIdentifiers.isEmpty(), + "the following values are not valid identifiers: %s", @@ -11889,19 +12396,16 @@ } --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java -@@ -19,18 +19,17 @@ +@@ -19,6 +19,8 @@ package com.puppycrawl.tools.checkstyle.checks.naming; -+import com.google.common.collect.ImmutableSet; ++import static java.util.stream.Collectors.toUnmodifiableSet; ++ import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; - import com.puppycrawl.tools.checkstyle.api.TokenTypes; - import com.puppycrawl.tools.checkstyle.utils.CheckUtil; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; --import java.util.Arrays; - import java.util.HashSet; +@@ -30,7 +32,6 @@ import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -11909,12 +12413,13 @@ /** * Validates abbreviations (consecutive capital letters) length in identifier name, it also allows -@@ -199,7 +198,7 @@ public class AbbreviationAsWordInNameCheck extends AbstractCheck { +@@ -199,8 +200,7 @@ public class AbbreviationAsWordInNameCheck extends AbstractCheck { */ public void setAllowedAbbreviations(String... allowedAbbreviations) { if (allowedAbbreviations != null) { -- this.allowedAbbreviations = Arrays.stream(allowedAbbreviations).collect(Collectors.toSet()); -+ this.allowedAbbreviations = ImmutableSet.copyOf(allowedAbbreviations); +- this.allowedAbbreviations = +- Arrays.stream(allowedAbbreviations).collect(Collectors.toUnmodifiableSet()); ++ this.allowedAbbreviations = Arrays.stream(allowedAbbreviations).collect(toUnmodifiableSet()); } } @@ -12134,7 +12639,7 @@ package com.puppycrawl.tools.checkstyle.filters; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; import com.puppycrawl.tools.checkstyle.TreeWalkerFilter; @@ -12147,12 +12652,14 @@ import net.sf.saxon.Configuration; import net.sf.saxon.om.Item; import net.sf.saxon.sxpath.XPathDynamicContext; -@@ -163,7 +164,7 @@ public class XpathFilterElement implements TreeWalkerFilter { +@@ -163,9 +164,7 @@ public class XpathFilterElement implements TreeWalkerFilter { } else { isMatching = false; final List nodes = -- getItems(event).stream().map(AbstractNode.class::cast).collect(Collectors.toList()); -+ getItems(event).stream().map(AbstractNode.class::cast).collect(toImmutableList()); +- getItems(event).stream() +- .map(AbstractNode.class::cast) +- .collect(Collectors.toUnmodifiableList()); ++ getItems(event).stream().map(AbstractNode.class::cast).collect(toUnmodifiableList()); for (AbstractNode abstractNode : nodes) { isMatching = abstractNode.getTokenType() == event.getTokenType() @@ -12266,7 +12773,7 @@ package com.puppycrawl.tools.checkstyle.meta; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; import com.puppycrawl.tools.checkstyle.Checker; @@ -12283,8 +12790,8 @@ || fileName.endsWith("Check.java") || fileName.endsWith("Filter.java"); }) -- .collect(Collectors.toList())); -+ .collect(toImmutableList())); +- .collect(Collectors.toUnmodifiableList())); ++ .collect(toUnmodifiableList())); } } @@ -12390,8 +12897,8 @@ package com.puppycrawl.tools.checkstyle.site; -+import static com.google.common.collect.ImmutableList.toImmutableList; +import static java.util.Collections.unmodifiableSet; ++import static java.util.stream.Collectors.toUnmodifiableList; + +import com.google.common.collect.ImmutableSet; import com.puppycrawl.tools.checkstyle.PropertyType; @@ -12438,39 +12945,39 @@ /** The precompiled pattern for a comma followed by a space. */ private static final Pattern COMMA_SPACE_PATTERN = Pattern.compile(", "); -@@ -331,7 +332,7 @@ public class PropertiesMacro extends AbstractMacro { +@@ -334,7 +335,7 @@ public class PropertiesMacro extends AbstractMacro { final List configurableTokens = SiteUtil.getDifference(check.getAcceptableTokens(), check.getRequiredTokens()).stream() .map(TokenUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); sink.text("subset of tokens"); writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_TOKEN_TYPES, true); -@@ -343,7 +344,7 @@ public class PropertiesMacro extends AbstractMacro { +@@ -346,7 +347,7 @@ public class PropertiesMacro extends AbstractMacro { check.getAcceptableJavadocTokens(), check.getRequiredJavadocTokens()) .stream() .map(JavadocUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); sink.text("subset of javadoc tokens"); writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_JAVADOC_TOKEN_TYPES, true); } else { -@@ -470,7 +471,7 @@ public class PropertiesMacro extends AbstractMacro { +@@ -473,7 +474,7 @@ public class PropertiesMacro extends AbstractMacro { final List configurableTokens = SiteUtil.getDifference(check.getDefaultTokens(), check.getRequiredTokens()).stream() .map(TokenUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_TOKEN_TYPES, true); } } else if (SiteUtil.JAVADOC_TOKENS.equals(propertyName)) { -@@ -479,7 +480,7 @@ public class PropertiesMacro extends AbstractMacro { +@@ -482,7 +483,7 @@ public class PropertiesMacro extends AbstractMacro { SiteUtil.getDifference(check.getDefaultJavadocTokens(), check.getRequiredJavadocTokens()) .stream() .map(JavadocUtil::getTokenName) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); writeTokensList(sink, configurableTokens, SiteUtil.PATH_TO_JAVADOC_TOKEN_TYPES, true); } else { final String defaultValue = getDefaultValue(propertyName, field, instance); @@ -12480,10 +12987,10 @@ package com.puppycrawl.tools.checkstyle.site; -+import static com.google.common.collect.ImmutableList.toImmutableList; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; +import static java.util.stream.Collectors.joining; -+import static java.util.stream.Collectors.toSet; ++import static java.util.stream.Collectors.toCollection; ++import static java.util.stream.Collectors.toUnmodifiableList; ++import static java.util.stream.Collectors.toUnmodifiableSet; + +import com.google.common.base.Strings; +import com.google.common.collect.ImmutableList; @@ -12508,16 +13015,16 @@ "SuppressWithNearbyCommentFilter.fileContents", "SuppressionCommentFilter.fileContents"); /** Properties that can not be gathered from class instance. */ -@@ -440,7 +447,7 @@ public final class SiteUtil { +@@ -480,7 +487,7 @@ public final class SiteUtil { (path, attr) -> { return attr.isRegularFile() && path.toString().endsWith(".xml.template"); })) { -- return stream.collect(Collectors.toSet()); -+ return stream.collect(toImmutableSet()); +- return stream.collect(Collectors.toUnmodifiableSet()); ++ return stream.collect(toUnmodifiableSet()); } catch (IOException ioException) { throw new MacroExecutionException("Failed to find xdocs templates", ioException); } -@@ -467,7 +474,7 @@ public final class SiteUtil { +@@ -507,7 +514,7 @@ public final class SiteUtil { } // If parent class is not found, check interfaces @@ -12526,7 +13033,7 @@ final Class[] interfaces = moduleClass.getInterfaces(); for (Class interfaceClass : interfaces) { parentModuleName = CLASS_TO_PARENT_MODULE.get(interfaceClass); -@@ -477,7 +484,7 @@ public final class SiteUtil { +@@ -517,7 +524,7 @@ public final class SiteUtil { } } @@ -12535,16 +13042,16 @@ final String message = String.format( Locale.ROOT, "Failed to find parent module for %s", moduleClass.getSimpleName()); -@@ -505,7 +512,7 @@ public final class SiteUtil { +@@ -545,7 +552,7 @@ public final class SiteUtil { prop -> { return !isGlobalProperty(clss, prop) && !isUndocumentedProperty(clss, prop); }) -- .collect(Collectors.toSet()); -+ .collect(toSet()); +- .collect(Collectors.toCollection(HashSet::new)); ++ .collect(toCollection(HashSet::new)); properties.addAll(getNonExplicitProperties(instance, clss)); return new TreeSet<>(properties); } -@@ -624,7 +631,7 @@ public final class SiteUtil { +@@ -664,7 +671,7 @@ public final class SiteUtil { treeWalkerConfig.addChild(scraperCheckConfig); try { checker.configure(defaultConfiguration); @@ -12553,7 +13060,7 @@ checker.process(filesToProcess); checker.destroy(); } catch (CheckstyleException checkstyleException) { -@@ -947,9 +954,7 @@ public final class SiteUtil { +@@ -987,9 +994,7 @@ public final class SiteUtil { if (value != null && Array.getLength(value) > 0) { result = removeSquareBrackets( @@ -12564,7 +13071,7 @@ } if (result.isEmpty()) { -@@ -981,8 +986,7 @@ public final class SiteUtil { +@@ -1021,8 +1026,7 @@ public final class SiteUtil { result = ""; } else { try (Stream valuesStream = getValuesStream(value)) { @@ -12574,7 +13081,7 @@ } } -@@ -1023,10 +1027,7 @@ public final class SiteUtil { +@@ -1063,10 +1067,7 @@ public final class SiteUtil { private static String getIntArrayPropertyValue(Object value) { try (IntStream stream = getIntStream(value)) { String result = @@ -12586,17 +13093,17 @@ if (result.isEmpty()) { result = CURLY_BRACKETS; } -@@ -1132,11 +1133,11 @@ public final class SiteUtil { +@@ -1172,11 +1173,11 @@ public final class SiteUtil { */ public static List getDifference(int[] tokens, int... subtractions) { final Set subtractionsSet = -- Arrays.stream(subtractions).boxed().collect(Collectors.toSet()); -+ Arrays.stream(subtractions).boxed().collect(toImmutableSet()); +- Arrays.stream(subtractions).boxed().collect(Collectors.toUnmodifiableSet()); ++ Arrays.stream(subtractions).boxed().collect(toUnmodifiableSet()); return Arrays.stream(tokens) .boxed() .filter(token -> !subtractionsSet.contains(token)) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } /** @@ -12805,7 +13312,7 @@ package com.puppycrawl.tools.checkstyle.utils; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; ++import static java.util.stream.Collectors.toUnmodifiableSet; + import com.google.common.reflect.ClassPath; import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean; @@ -12822,8 +13329,8 @@ .flatMap(pkg -> classPath.getTopLevelClasses(pkg).stream()) .map(ClassPath.ClassInfo::load) .filter(ModuleReflectionUtil::isCheckstyleModule) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } /** @@ -12850,19 +13357,18 @@ /** --- a/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java -@@ -19,6 +19,11 @@ +@@ -19,6 +19,10 @@ package com.puppycrawl.tools.checkstyle.utils; +import static com.google.common.base.Preconditions.checkArgument; -+import static com.google.common.collect.ImmutableMap.toImmutableMap; +import static java.util.function.Predicate.not; +import static java.util.stream.Collectors.toUnmodifiableMap; + import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.lang.reflect.Field; -@@ -31,7 +36,6 @@ import java.util.Optional; +@@ -31,7 +35,6 @@ import java.util.Optional; import java.util.ResourceBundle; import java.util.function.Consumer; import java.util.function.Predicate; @@ -12870,7 +13376,7 @@ import java.util.stream.IntStream; /** Contains utility methods for tokens. */ -@@ -91,7 +95,7 @@ public final class TokenUtil { +@@ -91,7 +94,7 @@ public final class TokenUtil { public static Map nameToValueMapFromPublicIntFields(Class cls) { return Arrays.stream(cls.getDeclaredFields()) .filter(fld -> Modifier.isPublic(fld.getModifiers()) && fld.getType() == Integer.TYPE) @@ -12879,13 +13385,12 @@ } /** -@@ -101,8 +105,7 @@ public final class TokenUtil { - * @return inverted map +@@ -102,7 +105,7 @@ public final class TokenUtil { */ public static Map invertMap(Map map) { -- return map.entrySet().stream() -- .collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); -+ return map.entrySet().stream().collect(toImmutableMap(Map.Entry::getValue, Map.Entry::getKey)); + return map.entrySet().stream() +- .collect(Collectors.toUnmodifiableMap(Map.Entry::getValue, Map.Entry::getKey)); ++ .collect(toUnmodifiableMap(Map.Entry::getValue, Map.Entry::getKey)); } /** @@ -13026,7 +13531,7 @@ package com.puppycrawl.tools.checkstyle.xpath; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -13043,8 +13548,8 @@ public List generate() { return getMatchingAstElements().stream() .map(XpathQueryGenerator::generateXpathQuery) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } /** @@ -13154,14 +13659,13 @@ config.addProperty("uri", "BAD"); --- a/src/test/java/com/puppycrawl/tools/checkstyle/AbstractModuleTestSupport.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/AbstractModuleTestSupport.java -@@ -19,8 +19,12 @@ - +@@ -20,7 +20,11 @@ package com.puppycrawl.tools.checkstyle; -+import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertWithMessage; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.stream.Collectors.toCollection; ++import static java.util.stream.Collectors.toUnmodifiableList; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -13175,30 +13679,31 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport { -@@ -422,7 +425,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -422,8 +425,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport */ protected final void execute(Configuration config, String... filenames) throws Exception { final Checker checker = createChecker(config); -- final List files = Arrays.stream(filenames).map(File::new).collect(Collectors.toList()); -+ final List files = Arrays.stream(filenames).map(File::new).collect(toImmutableList()); +- final List files = +- Arrays.stream(filenames).map(File::new).collect(Collectors.toUnmodifiableList()); ++ final List files = Arrays.stream(filenames).map(File::new).collect(toUnmodifiableList()); checker.process(files); checker.destroy(); } -@@ -443,11 +446,9 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -444,11 +446,11 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport actualViolations.stream() .map(violation -> violation.substring(0, violation.indexOf(':'))) .map(Integer::valueOf) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); final List expectedViolationLines = -- testInputViolations.stream() -- .map(TestInputViolation::getLineNo) -- .collect(Collectors.toList()); -+ testInputViolations.stream().map(TestInputViolation::getLineNo).collect(toImmutableList()); + testInputViolations.stream() + .map(TestInputViolation::getLineNo) +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); assertWithMessage("Violation lines for %s differ.", file) .that(actualViolationLines) .isEqualTo(expectedViolationLines); -@@ -470,7 +471,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -471,7 +473,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport throws Exception { stream.flush(); stream.reset(); @@ -13207,7 +13712,7 @@ final Checker checker = createChecker(config); final Map> actualViolations = getActualViolations(checker.process(files)); checker.destroy(); -@@ -489,8 +490,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -490,8 +492,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport private Map> getActualViolations(int errorCount) throws IOException { // process each of the lines try (ByteArrayInputStream inputStream = new ByteArrayInputStream(stream.toByteArray()); @@ -13217,7 +13722,7 @@ final Map> actualViolations = new HashMap<>(); for (String line = lnr.readLine(); line != null && lnr.getLineNumber() <= errorCount; -@@ -593,7 +593,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport +@@ -594,7 +595,7 @@ public abstract class AbstractModuleTestSupport extends AbstractPathTestSupport protected static String[] removeSuppressed( String[] actualViolations, String... suppressedViolations) { final List actualViolationsList = @@ -13453,19 +13958,13 @@ 1, 1, "messages.properties", "key", null, SeverityLevel.ERROR, null, getClass(), null); --- a/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/CheckerTest.java -@@ -19,13 +19,17 @@ - - package com.puppycrawl.tools.checkstyle; - -+import static com.google.common.collect.ImmutableList.toImmutableList; - import static com.google.common.truth.Truth.assertWithMessage; - import static com.puppycrawl.tools.checkstyle.Checker.EXCEPTION_MSG; - import static com.puppycrawl.tools.checkstyle.DefaultLogger.AUDIT_FINISHED_MESSAGE; +@@ -25,7 +25,11 @@ import static com.puppycrawl.tools.checkstyle.DefaultLogger.AUDIT_FINISHED_MESSA import static com.puppycrawl.tools.checkstyle.DefaultLogger.AUDIT_STARTED_MESSAGE; import static com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheck.MSG_KEY_NO_NEWLINE_EOF; import static com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck.MSG_KEY; +import static java.nio.charset.StandardCharsets.UTF_8; +import static java.util.Collections.unmodifiableList; ++import static java.util.stream.Collectors.toUnmodifiableList; +import com.google.common.collect.ImmutableList; import com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions; @@ -13985,8 +14484,8 @@ .filter(line -> !getCheckMessage(AUDIT_FINISHED_MESSAGE).equals(line)) .limit(expected.length) .sorted() -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); Arrays.sort(expected); for (int i = 0; i < expected.length; i++) { @@ -15054,7 +15553,15 @@ try { --- a/src/test/java/com/puppycrawl/tools/checkstyle/JavaAstVisitorTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/JavaAstVisitorTest.java -@@ -39,13 +39,12 @@ import java.util.ArrayList; +@@ -20,6 +20,7 @@ + package com.puppycrawl.tools.checkstyle; + + import static com.google.common.truth.Truth.assertWithMessage; ++import static java.util.stream.Collectors.toUnmodifiableSet; + + import com.puppycrawl.tools.checkstyle.api.DetailAST; + import com.puppycrawl.tools.checkstyle.api.FileContents; +@@ -37,13 +38,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Set; @@ -15069,7 +15576,7 @@ /** * If a visit method is not overridden, we should explain why we do not 'visit' the parse tree at -@@ -94,7 +93,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { +@@ -97,7 +97,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { } @Test @@ -15078,16 +15585,25 @@ final Method[] baseVisitMethods = JavaLanguageParserBaseVisitor.class.getDeclaredMethods(); final Method[] visitMethods = JavaAstVisitor.class.getDeclaredMethods(); -@@ -104,7 +103,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { +@@ -107,7 +107,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { .filter(method -> method.getName().contains("visit")) .filter(method -> method.getModifiers() == Modifier.PUBLIC) .map(Method::getName) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); - final ImmutableSet filteredVisitMethodNames = + final Set filteredVisitMethodNames = Arrays.stream(visitMethods) -@@ -128,7 +127,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { +@@ -117,7 +117,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { + .filter(method -> !"visit".equals(method.getName())) + .filter(method -> method.getModifiers() == Modifier.PUBLIC) + .map(Method::getName) +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); + + final String message = + "Visit methods in 'JavaLanguageParserBaseVisitor' generated from " +@@ -131,7 +131,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { } @Test @@ -15096,7 +15612,7 @@ // Order of BaseVisitor's generated 'visit' methods match the order of // production rules in 'JavaLanguageParser.g4'. final String baseVisitorFilename = -@@ -197,7 +196,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { +@@ -200,7 +200,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { } @Test @@ -15105,7 +15621,7 @@ final Method addLastSibling = JavaAstVisitor.class.getDeclaredMethod( "addLastSibling", DetailAstImpl.class, DetailAstImpl.class); -@@ -224,7 +223,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { +@@ -227,7 +227,7 @@ public class JavaAstVisitorTest extends AbstractModuleTestSupport { * @throws Exception if input file does not exist */ @Test @@ -16426,15 +16942,6 @@ final ByteArrayOutputStream out = new ByteArrayOutputStream(); final AuditListener listener = Main.OutputFormat.PLAIN.createListener(out, OutputStreamOptions.CLOSE); -@@ -2006,7 +1988,7 @@ public class MainTest { - * avoid VM termination. - */ - private static void assertMainReturnCode(int expectedExitCode, String... arguments) { -- final Runtime mock = mock(Runtime.class); -+ final Runtime mock = mock(); - try (MockedStatic runtime = mockStatic(Runtime.class)) { - runtime.when(Runtime::getRuntime).thenReturn(mock); - Main.main(arguments); @@ -2025,7 +2007,7 @@ public class MainTest { private boolean isClosed; @@ -16999,7 +17506,7 @@ final String propertiesUserHome = properties.getProperty("user.home"); --- a/src/test/java/com/puppycrawl/tools/checkstyle/PropertyCacheFileTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/PropertyCacheFileTest.java -@@ -52,7 +52,7 @@ import org.junit.jupiter.params.ParameterizedTest; +@@ -54,7 +54,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.mockito.MockedStatic; @@ -17008,7 +17515,7 @@ @TempDir public File temporaryFolder; -@@ -62,7 +62,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -64,7 +64,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17017,7 +17524,7 @@ try { final Object test = new PropertyCacheFile(null, ""); assertWithMessage("exception expected but got " + test).fail(); -@@ -83,7 +83,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -85,7 +85,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17026,7 +17533,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -100,7 +100,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -102,7 +102,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17035,7 +17542,7 @@ final Configuration config = new DefaultConfiguration("myName"); final PropertyCacheFile cache = new PropertyCacheFile(config, "fileDoesNotExist.txt"); -@@ -112,7 +112,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -114,7 +114,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17044,7 +17551,7 @@ final Configuration config = new DefaultConfiguration("myName"); final PropertyCacheFile cache = new PropertyCacheFile(config, getPath("InputPropertyCacheFile")); -@@ -134,7 +134,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -136,7 +136,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17053,7 +17560,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -152,7 +152,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -154,7 +154,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17062,7 +17569,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -178,7 +178,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -180,7 +180,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17071,7 +17578,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String externalResourcePath = File.createTempFile("junit", null, temporaryFolder).getPath(); -@@ -207,7 +207,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -209,7 +209,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17080,7 +17587,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -221,7 +221,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -223,7 +223,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { final MessageDigest digest = MessageDigest.getInstance("SHA-1"); final URI uri = CommonUtil.getUriByFilename(pathToResource); @@ -17089,7 +17596,7 @@ final ByteArrayOutputStream out = new ByteArrayOutputStream(); try (ObjectOutputStream oos = new ObjectOutputStream(out)) { oos.writeObject(input); -@@ -235,7 +235,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -237,7 +237,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17098,7 +17605,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = String.format(Locale.ENGLISH, "%s%2$stemp%2$scache.temp", temporaryFolder, File.separator); -@@ -248,7 +248,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -250,7 +250,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17107,7 +17614,55 @@ final Configuration config = new DefaultConfiguration("myName"); final String fileName = "temp.cache"; final Path filePath = Paths.get(fileName); -@@ -261,7 +261,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -263,9 +263,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + Files.delete(filePath); + } + +- @Test + @DisabledOnOs(OS.WINDOWS) +- public void testPersistWithSymbolicLinkToDirectory() throws IOException { ++ @Test ++ void persistWithSymbolicLinkToDirectory() throws IOException { + final Path tempDirectory = Files.createTempDirectory("tempDir"); + final Path symbolicLinkDirectory = + Files.createTempDirectory("symbolicLinkDir").resolve("symbolicLink"); +@@ -283,9 +283,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + .isTrue(); + } + +- @Test + @DisabledOnOs(OS.WINDOWS) +- public void testSymbolicLinkResolution() throws IOException { ++ @Test ++ void symbolicLinkResolution() throws IOException { + final Path tempDirectory = Files.createTempDirectory("tempDir"); + final Path symbolicLinkDirectory = + Files.createTempDirectory("symbolicLinkDir").resolve("symbolicLink"); +@@ -303,9 +303,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + .isTrue(); + } + +- @Test + @DisabledOnOs(OS.WINDOWS) +- public void testSymbolicLinkToNonDirectory() throws IOException { ++ @Test ++ void symbolicLinkToNonDirectory() throws IOException { + final Path tempFile = Files.createTempFile("tempFile", null); + final Path symbolicLinkDirectory = Files.createTempDirectory("symbolicLinkDir"); + final Path symbolicLink = symbolicLinkDirectory.resolve("symbolicLink"); +@@ -325,9 +325,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { + .contains(expectedMessage); + } + +- @Test + @DisabledOnOs(OS.WINDOWS) +- public void testMultipleSymbolicLinkResolution() throws IOException { ++ @Test ++ void multipleSymbolicLinkResolution() throws IOException { + final Path actualDirectory = Files.createTempDirectory("actualDir"); + final Path firstSymbolicLink = Files.createTempDirectory("firstLinkDir").resolve("firstLink"); + Files.createSymbolicLink(firstSymbolicLink, actualDirectory); +@@ -349,7 +349,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17116,7 +17671,7 @@ final DefaultConfiguration config = new DefaultConfiguration("myConfig"); config.addProperty("attr", "value"); -@@ -313,11 +313,11 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -401,11 +401,11 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { * @noinspectionreason ResultOfMethodCallIgnored - Setup for mockito to only mock toByteArray to * throw exception. */ @@ -17131,7 +17686,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -352,7 +352,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -440,7 +440,7 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { } @Test @@ -17140,7 +17695,7 @@ final Configuration config = new DefaultConfiguration("myName"); final String filePath = File.createTempFile("junit", null, temporaryFolder).getPath(); final PropertyCacheFile cache = new PropertyCacheFile(config, filePath); -@@ -391,8 +391,8 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -479,8 +479,8 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { * @param rawMessages exception messages separated by ';' */ @ParameterizedTest @@ -17490,13 +18045,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(JavadocParagraphCheck.class); final String[] expected = { "3: " -@@ -162,12 +165,12 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { - JavadocParagraphCheck.class, JavadocParagraphCheck.MSG_REDUNDANT_PARAGRAPH), - }; - final String path = getPath("InputTreeWalkerJavadoc.java"); -- final DetailAST mockAst = mock(DetailAST.class); -+ final DetailAST mockAst = mock(); - final DetailAST realAst = +@@ -167,7 +170,7 @@ public class TreeWalkerTest extends AbstractModuleTestSupport { JavaParser.parseFile(new File(path), JavaParser.Options.WITH_COMMENTS); // Ensure that there is no calls to walk(..., AstState.ORDINARY) doThrow(IllegalStateException.class).when(mockAst).getFirstChild(); @@ -17981,14 +18530,14 @@ --- a/src/test/java/com/puppycrawl/tools/checkstyle/XdocsPropertyTypeTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/XdocsPropertyTypeTest.java -@@ -19,6 +19,7 @@ - +@@ -20,6 +20,7 @@ package com.puppycrawl.tools.checkstyle; -+import static com.google.common.collect.Sets.toImmutableEnumSet; import static com.google.common.truth.Truth.assertWithMessage; ++import static java.util.stream.Collectors.toUnmodifiableSet; import com.puppycrawl.tools.checkstyle.checks.header.AbstractHeaderCheck; + import com.puppycrawl.tools.checkstyle.internal.utils.CheckUtil; @@ -28,14 +29,13 @@ import java.io.IOException; import java.util.Arrays; import java.util.Objects; @@ -18010,8 +18559,8 @@ .map(field -> field.getAnnotation(XdocsPropertyType.class)) .filter(Objects::nonNull) .map(XdocsPropertyType::value) -- .collect(Collectors.toSet()); -+ .collect(toImmutableEnumSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); assertWithMessage("All property types should be used") .that(propertyTypes) @@ -20154,13 +20703,11 @@ .isEqualTo(SeverityLevel.IGNORE); --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/TokenTypesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/TokenTypesTest.java -@@ -19,22 +19,22 @@ - - package com.puppycrawl.tools.checkstyle.api; +@@ -21,20 +21,20 @@ package com.puppycrawl.tools.checkstyle.api; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.truth.Truth.assertWithMessage; import static com.puppycrawl.tools.checkstyle.internal.utils.TestUtil.isUtilsClassHasPrivateConstructor; ++import static java.util.stream.Collectors.toUnmodifiableSet; +import com.google.common.collect.ImmutableSet; import com.puppycrawl.tools.checkstyle.utils.TokenUtil; @@ -20185,8 +20732,8 @@ Arrays.stream(TokenUtil.getAllTokenIds()) .mapToObj(TokenUtil::getTokenName) .filter(name -> name.charAt(0) != '$') -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); final Set actual = bundle.keySet(); assertWithMessage("TokenTypes without description").that(actual).isEqualTo(expected); } @@ -20200,8 +20747,8 @@ .filter(name -> name.charAt(0) != '$') .map(TokenUtil::getShortDescription) .filter(desc -> desc.charAt(desc.length() - 1) != '.') -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); assertWithMessage("Malformed TokenType descriptions") .that(badDescriptions) - .isEqualTo(Collections.emptySet()); @@ -20341,7 +20888,7 @@ package com.puppycrawl.tools.checkstyle.bdd; -+import static com.google.common.collect.ImmutableList.toImmutableList; ++import static java.util.stream.Collectors.toUnmodifiableList; + import com.puppycrawl.tools.checkstyle.ConfigurationLoader; import com.puppycrawl.tools.checkstyle.PropertiesExpander; @@ -20358,8 +20905,8 @@ return lines.stream() .skip(1) .takeWhile(line -> !line.startsWith("*/")) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } private static void handleXmlConfig( @@ -22407,21 +22954,39 @@ } @Test -- public void testIncorrect() throws Exception { -+ void incorrect() throws Exception { +- public void testIncorrectOne() throws Exception { ++ void incorrectOne() throws Exception { final String[] expected = { "15:11: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "MyAnn"), "20:15: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "MyAnnotation1"), -@@ -83,7 +83,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -82,7 +82,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test -- public void testIncorrectAllTokens() throws Exception { -+ void incorrectAllTokens() throws Exception { +- public void testIncorrectTwo() throws Exception { ++ void incorrectTwo() throws Exception { + final String[] expected = { + "17:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "MyAnn_21", 0, 3), + }; +@@ -90,7 +90,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testIncorrectAllTokensOne() throws Exception { ++ void incorrectAllTokensOne() throws Exception { final String[] expected = { "15:11: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "MyAnn3"), "20:15: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "MyAnnotation_13"), -@@ -114,7 +114,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -120,7 +120,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testIncorrectAllTokensTwo() throws Exception { ++ void incorrectAllTokensTwo() throws Exception { + final String[] expected = { + "17:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "MyAnn_23", 0, 3), + }; +@@ -128,7 +128,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22430,7 +22995,7 @@ final AnnotationLocationCheck constantNameCheckObj = new AnnotationLocationCheck(); final int[] actual = constantNameCheckObj.getAcceptableTokens(); final int[] expected = { -@@ -135,13 +135,13 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -149,13 +149,13 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22441,12 +23006,21 @@ } @Test -- public void testWithParameters() throws Exception { -+ void withParameters() throws Exception { +- public void testWithParametersOne() throws Exception { ++ void withParametersOne() throws Exception { final String[] expected = { "25:9: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "MyAnnotation_12", 8, 4), "33:9: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "MyAnnotation_12", 8, 4), -@@ -161,7 +161,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -174,7 +174,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testWithParametersTwo() throws Exception { ++ void withParametersTwo() throws Exception { + final String[] expected = { + "17:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "MyAnn_22", 0, 3), + }; +@@ -182,7 +182,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22455,7 +23029,7 @@ final String[] expected = { "14:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "MyAnnotation11"), "14:17: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "MyAnnotation12"), -@@ -172,14 +172,14 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -193,14 +193,14 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22472,7 +23046,7 @@ final String[] expected = { "18:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "AnnotationAnnotation", 2, 0), "20:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "AnnotationAnnotation"), -@@ -190,7 +190,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -211,7 +211,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22481,7 +23055,7 @@ final String[] expected = { "18:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "ClassAnnotation", 2, 0), "20:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "ClassAnnotation"), -@@ -203,7 +203,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -224,7 +224,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22490,7 +23064,7 @@ final String[] expected = { "18:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "EnumAnnotation", 2, 0), "19:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "EnumAnnotation"), -@@ -214,7 +214,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -235,7 +235,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22499,7 +23073,7 @@ final String[] expected = { "18:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "InterfaceAnnotation", 2, 0), "20:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "InterfaceAnnotation"), -@@ -225,7 +225,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -246,7 +246,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22508,7 +23082,7 @@ final String[] expected = { "12:3: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION, "PackageAnnotation", 2, 0), "14:1: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "PackageAnnotation"), -@@ -234,20 +234,20 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -255,20 +255,20 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22532,7 +23106,7 @@ final String[] expected = { "18:5: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "Annotation"), "20:5: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "Annotation"), -@@ -261,7 +261,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -282,7 +282,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -22541,7 +23115,7 @@ final String[] expected = { "23:17: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "Annotation"), "25:5: " + getCheckMessage(MSG_KEY_ANNOTATION_LOCATION_ALONE, "Annotation"), -@@ -276,7 +276,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { +@@ -297,7 +297,7 @@ public class AnnotationLocationCheckTest extends AbstractModuleTestSupport { } @Test @@ -26351,7 +26925,7 @@ import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.api.TokenTypes; -@@ -32,7 +33,7 @@ import java.util.List; +@@ -31,7 +32,7 @@ import java.util.List; import java.util.regex.Pattern; import org.junit.jupiter.api.Test; @@ -26360,7 +26934,7 @@ @Override protected String getPackageLocation() { -@@ -40,7 +41,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -39,7 +40,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26369,7 +26943,7 @@ final String[] expected = { "34:28: " + getCheckMessage(MSG_KEY, "a href"), }; -@@ -48,7 +49,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -47,7 +48,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26378,7 +26952,7 @@ final String[] expected = { "34:28: " + getCheckMessage(MSG_KEY, "a href"), "35:32: " + getCheckMessage(MSG_KEY, "a href"), -@@ -57,7 +58,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -56,7 +57,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26387,7 +26961,7 @@ final String[] expected = { "34:28: " + "My custom message", -@@ -66,7 +67,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -65,7 +66,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26396,7 +26970,7 @@ final String[] expected = { "34:28: " + getCheckMessage(MSG_KEY, "a href"), -@@ -75,7 +76,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -74,7 +75,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26405,7 +26979,7 @@ final String[] expected = { "16:28: " + getCheckMessage(MSG_KEY, "a href"), -@@ -89,7 +90,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -88,7 +89,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26414,7 +26988,7 @@ final String[] expected = { "16:28: " + getCheckMessage(MSG_KEY, "\""), -@@ -105,7 +106,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -104,7 +105,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26423,7 +26997,7 @@ final IllegalTokenTextCheck check = new IllegalTokenTextCheck(); assertWithMessage("Acceptable tokens should not be null") .that(check.getAcceptableTokens()) -@@ -122,7 +123,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -121,7 +122,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26432,7 +27006,16 @@ final String[] expected = { "1:3: " + getCheckMessage(MSG_KEY, "a href"), "45:28: " + getCheckMessage(MSG_KEY, "a href"), -@@ -131,19 +132,19 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -130,7 +131,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testStringTemplate() throws Exception { ++ void stringTemplate() throws Exception { + + final String[] expected = { + "29:28: " + getCheckMessage(MSG_KEY, "x"), +@@ -146,19 +147,19 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26452,10 +27035,10 @@ @Test - public void testAcceptableTokensMakeSense() { + void acceptableTokensMakeSense() { - final int expectedTokenTypesTotalNumber = 188; + final int expectedTokenTypesTotalNumber = 194; assertWithMessage( "Total number of TokenTypes has changed, acceptable tokens in" -@@ -176,7 +177,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { +@@ -192,7 +193,7 @@ public class IllegalTokenTextCheckTest extends AbstractModuleTestSupport { } @Test @@ -26763,7 +27346,25 @@ final String[] expected = { "22:15: " + getCheckMessage(MSG_KEY), "22:19: " + getCheckMessage(MSG_KEY), -@@ -59,13 +59,13 @@ public class InnerAssignmentCheckTest extends AbstractModuleTestSupport { +@@ -46,7 +46,7 @@ public class InnerAssignmentCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testMethod() throws Exception { ++ void method() throws Exception { + final String[] expected = { + "73:22: " + getCheckMessage(MSG_KEY), + }; +@@ -54,7 +54,7 @@ public class InnerAssignmentCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testDemoBug1195047Comment3() throws Exception { ++ void demoBug1195047Comment3() throws Exception { + final String[] expected = { + "18:16: " + getCheckMessage(MSG_KEY), + "19:24: " + getCheckMessage(MSG_KEY), +@@ -74,13 +74,13 @@ public class InnerAssignmentCheckTest extends AbstractModuleTestSupport { } @Test @@ -26779,7 +27380,7 @@ final String[] expected = { "12:28: " + getCheckMessage(MSG_KEY), }; -@@ -73,7 +73,7 @@ public class InnerAssignmentCheckTest extends AbstractModuleTestSupport { +@@ -88,7 +88,7 @@ public class InnerAssignmentCheckTest extends AbstractModuleTestSupport { } @Test @@ -27989,8 +28590,8 @@ } --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheckTest.java -@@ -25,7 +25,7 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDecla - import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; +@@ -26,7 +26,7 @@ import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; import org.junit.jupiter.api.Test; -public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTestSupport { @@ -27998,7 +28599,7 @@ @Override protected String getPackageLocation() { -@@ -33,7 +33,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest +@@ -34,7 +34,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest } @Test @@ -28007,7 +28608,7 @@ final String[] expected = { "32:5: " + getCheckMessage(MSG_KEY, 21), -@@ -45,7 +45,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest +@@ -46,7 +46,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest } @Test @@ -28016,7 +28617,16 @@ final String[] expected = { "21:9: " + getCheckMessage(MSG_KEY, 15), -@@ -57,7 +57,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest +@@ -58,7 +58,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest + } + + @Test +- public void testOverloadMethodsDeclarationOrderPrivateAndStaticMethods() throws Exception { ++ void overloadMethodsDeclarationOrderPrivateAndStaticMethods() throws Exception { + + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + +@@ -67,7 +67,7 @@ public class OverloadMethodsDeclarationOrderCheckTest extends AbstractModuleTest } @Test @@ -31447,7 +32057,34 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), "17:1: " + getCheckMessage(MSG_LEX, "java.awt.print.Paper.*", "java.io.File.createTempFile"), -@@ -110,7 +110,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -109,7 +109,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testStaticStandardThirdListCustomRules() throws Exception { ++ void staticStandardThirdListCustomRules() throws Exception { + final String[] expected = { + "16:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), + "17:1: " + getCheckMessage(MSG_LEX, "java.awt.print.Paper.*", "java.io.File.createTempFile"), +@@ -128,7 +128,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testStaticStandardThirdListCustomRulesWhitespace() throws Exception { ++ void staticStandardThirdListCustomRulesWhitespace() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWithInlineConfigParser( +@@ -136,7 +136,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testInputCustomImportOrderSingleLineList() throws Exception { ++ void inputCustomImportOrderSingleLineList() throws Exception { + final String[] expected = { + "14:112: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), + "15:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.google.common.annotations.Beta"), +@@ -148,7 +148,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { /** Checks different combinations for same_package group. */ @Test @@ -31456,7 +32093,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), "17:1: " + getCheckMessage(MSG_LEX, "java.awt.print.Paper.*", "java.io.File.createTempFile"), -@@ -128,7 +128,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -166,7 +166,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31465,7 +32102,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.List"), }; -@@ -137,7 +137,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -175,7 +175,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31474,7 +32111,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), "19:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.List"), -@@ -169,7 +169,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -207,7 +207,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31483,7 +32120,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LEX, "java.util.*", "java.util.StringTokenizer"), "18:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.*"), -@@ -188,7 +188,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -226,7 +226,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31492,7 +32129,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LEX, "java.util.*", "java.util.StringTokenizer"), "18:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.*"), -@@ -207,7 +207,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -245,7 +245,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31501,7 +32138,7 @@ final String[] expected = { "16:1: " + getCheckMessage( -@@ -223,14 +223,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -261,14 +261,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31518,7 +32155,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, THIRD, "org.w3c.dom.Node"), }; -@@ -240,7 +240,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -278,7 +278,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31527,7 +32164,7 @@ final String[] expected = { "19:1: " + getCheckMessage(MSG_LEX, "java.awt.Button.ABORT", "java.io.File.createTempFile"), -@@ -263,7 +263,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -301,7 +301,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31536,7 +32173,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -271,7 +271,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -309,7 +309,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31545,7 +32182,7 @@ final String[] expected = { "23:1: " + getCheckMessage(MSG_ORDER, THIRD, SPECIAL, "com.google.common.collect.HashMultimap"), -@@ -282,7 +282,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -320,7 +320,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31554,7 +32191,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_LEX, "java.util.Map", "java.util.Map.Entry"), }; -@@ -291,7 +291,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -329,7 +329,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31563,7 +32200,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MSG_ORDER, THIRD, SPECIAL, "com.google.common.annotations.Beta"), }; -@@ -301,7 +301,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -339,7 +339,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31572,7 +32209,7 @@ final DefaultConfiguration checkConfig = createModuleConfig(CustomImportOrderCheck.class); checkConfig.addProperty("specialImportsRegExp", "com"); checkConfig.addProperty("separateLineBetweenGroups", "false"); -@@ -317,7 +317,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -355,7 +355,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31581,7 +32218,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.google.errorprone.annotations.*"), }; -@@ -327,7 +327,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -365,7 +365,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31590,7 +32227,7 @@ final CustomImportOrderCheck testCheckObject = new CustomImportOrderCheck(); final int[] actual = testCheckObject.getAcceptableTokens(); final int[] expected = { -@@ -340,7 +340,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -378,7 +378,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { @Test // UT uses Reflection to avoid removing null-validation from static method, // which is a candidate for utility method in the future @@ -31599,7 +32236,7 @@ final Class clazz = CustomImportOrderCheck.class; final Object t = clazz.getConstructor().newInstance(); final Method method = clazz.getDeclaredMethod("getFullImportIdent", DetailAST.class); -@@ -352,7 +352,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -390,7 +390,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31608,7 +32245,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.*"), "21:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.List"), -@@ -372,7 +372,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -410,7 +410,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31617,7 +32254,7 @@ final String[] expected = { "23:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.*"), "24:1: " -@@ -387,7 +387,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -425,7 +425,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31626,7 +32263,7 @@ final String[] expected = { "25:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, SAME, "java.util.concurrent.locks.LockSupport"), -@@ -398,7 +398,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -436,7 +436,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31635,7 +32272,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -406,7 +406,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -444,7 +444,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31644,7 +32281,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -431,7 +431,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -469,7 +469,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31653,7 +32290,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -454,7 +454,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -492,7 +492,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31662,7 +32299,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -476,7 +476,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -514,7 +514,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31671,7 +32308,7 @@ try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -498,14 +498,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -536,14 +536,14 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31688,7 +32325,7 @@ final String[] expected = { "20:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.awt.Button"), "32:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.io.*"), -@@ -515,7 +515,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -553,7 +553,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31697,7 +32334,7 @@ final String[] expected = { "23:1: " + getCheckMessage( -@@ -558,28 +558,28 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -596,28 +596,28 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31730,7 +32367,7 @@ final String[] expected = { "16:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "org.junit.Test"), }; -@@ -588,7 +588,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -626,7 +626,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31739,7 +32376,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.*"), "19:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.HashMap"), -@@ -600,7 +600,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -638,7 +638,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31748,7 +32385,7 @@ final String[] expected = { "18:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.sun.accessibility.internal.resources.*"), "22:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.Arrays"), -@@ -613,7 +613,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -651,7 +651,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31757,7 +32394,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), "25:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "org.apache.*"), -@@ -624,7 +624,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -662,7 +662,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31766,7 +32403,7 @@ final String[] expected = { "14:112: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), "15:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "com.google.common.annotations.Beta"), -@@ -635,7 +635,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -673,7 +673,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31775,7 +32412,7 @@ final String[] expected = { "14:118: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.util.Map"), }; -@@ -644,7 +644,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -682,7 +682,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31784,7 +32421,7 @@ final String[] expected = { "21:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "javax.swing.WindowConstants.*"), "24:1: " + getCheckMessage(MSG_LINE_SEPARATOR, "java.awt.Button"), -@@ -663,7 +663,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -701,7 +701,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31793,7 +32430,7 @@ final String[] expected = { "17:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STATIC, "java.util.Collections.*"), "18:1: " -@@ -677,7 +677,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -715,7 +715,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31802,7 +32439,7 @@ final String[] expected = { "30:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.BitSet"), "45:1: " + getCheckMessage(MSG_SEPARATED_IN_GROUP, "java.util.HashSet"), -@@ -690,7 +690,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -728,7 +728,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -31811,7 +32448,7 @@ final String[] expected = { "22:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "java.awt.Button"), "23:1: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "java.awt.Dialog"), -@@ -706,7 +706,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { +@@ -744,7 +744,7 @@ public class CustomImportOrderCheckTest extends AbstractModuleTestSupport { } @Test @@ -32344,23 +32981,15 @@ final InputSource source = new InputSource(); try { final Class clazz = ImportControlLoader.class; -@@ -135,12 +135,12 @@ public class ImportControlLoaderTest { +@@ -135,7 +135,7 @@ public class ImportControlLoaderTest { } @Test - public void testInputStreamFailsOnRead() throws Exception { -- try (InputStream inputStream = mock(InputStream.class)) { + void inputStreamFailsOnRead() throws Exception { -+ try (InputStream inputStream = mock()) { + try (InputStream inputStream = mock()) { final int available = doThrow(IOException.class).when(inputStream).available(); -- final URL url = mock(URL.class); -+ final URL url = mock(); - when(url.openStream()).thenReturn(inputStream); -- final URI uri = mock(URI.class); -+ final URI uri = mock(); - when(uri.toURL()).thenReturn(url); - - final CheckstyleException ex = + final URL url = mock(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java @@ -38,7 +38,7 @@ import java.util.Optional; @@ -33448,21 +34077,93 @@ } @Test -- public void testCommentIsAtTheEndOfBlock() throws Exception { -+ void commentIsAtTheEndOfBlock() throws Exception { +- public void testCommentIsAtTheEndOfBlockOne() throws Exception { ++ void commentIsAtTheEndOfBlockOne() throws Exception { final String[] expected = { "25:26: " + getCheckMessage(MSG_KEY_SINGLE, 24, 25, 8), "40:6: " + getCheckMessage(MSG_KEY_SINGLE, 42, 5, 4), -@@ -92,7 +92,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -54,7 +54,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test -- public void testCommentIsInsideSwitchBlock() throws Exception { -+ void commentIsInsideSwitchBlock() throws Exception { +- public void testCommentIsAtTheEndOfBlockTwo() throws Exception { ++ void commentIsAtTheEndOfBlockTwo() throws Exception { + final String[] expected = { + "22:30: " + getCheckMessage(MSG_KEY_SINGLE, 23, 29, 12), + "45:27: " + getCheckMessage(MSG_KEY_SINGLE, 38, 26, 8), +@@ -68,7 +68,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsAtTheEndOfBlockThree() throws Exception { ++ void commentIsAtTheEndOfBlockThree() throws Exception { + final String[] expected = { + "21:1: " + getCheckMessage(MSG_KEY_SINGLE, 20, 0, 8), + "35:13: " + getCheckMessage(MSG_KEY_SINGLE, 32, 12, 8), +@@ -84,7 +84,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsAtTheEndOfBlockFour() throws Exception { ++ void commentIsAtTheEndOfBlockFour() throws Exception { + final String[] expected = { + "22:10: " + getCheckMessage(MSG_KEY_SINGLE, 21, 9, 8), + "28:1: " + getCheckMessage(MSG_KEY_SINGLE, 29, 0, 4), +@@ -100,7 +100,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsAtTheEndOfBlockFive() throws Exception { ++ void commentIsAtTheEndOfBlockFive() throws Exception { + final String[] expected = { + "61:1: " + getCheckMessage(MSG_KEY_SINGLE, 59, 0, 8), + "77:11: " + getCheckMessage(MSG_KEY_BLOCK, 73, 10, 8), +@@ -114,7 +114,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsAtTheEndOfBlockSix() throws Exception { ++ void commentIsAtTheEndOfBlockSix() throws Exception { + final String[] expected = { + "26:11: " + getCheckMessage(MSG_KEY_SINGLE, 19, 10, 8), + "33:1: " + getCheckMessage(MSG_KEY_SINGLE, 30, 0, 8), +@@ -132,7 +132,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsInsideSwitchBlockOne() throws Exception { ++ void commentIsInsideSwitchBlockOne() throws Exception { final String[] expected = { "27:13: " + getCheckMessage(MSG_KEY_BLOCK, 28, 12, 16), "33:20: " + getCheckMessage(MSG_KEY_SINGLE, "32, 34", 19, "16, 12"), -@@ -120,7 +120,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -148,7 +148,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsInsideSwitchBlockTwo() throws Exception { ++ void commentIsInsideSwitchBlockTwo() throws Exception { + final String[] expected = { + "18:25: " + getCheckMessage(MSG_KEY_SINGLE, 19, 24, 20), + "43:16: " + getCheckMessage(MSG_KEY_SINGLE, "42, 44", 15, "17, 12"), +@@ -161,7 +161,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsInsideSwitchBlockThree() throws Exception { ++ void commentIsInsideSwitchBlockThree() throws Exception { + final String[] expected = { + "18:25: " + getCheckMessage(MSG_KEY_SINGLE, 19, 24, 20), + "45:5: " + getCheckMessage(MSG_KEY_SINGLE, "44, 46", 4, "12, 12"), +@@ -175,7 +175,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCommentIsInsideSwitchBlockFour() throws Exception { ++ void commentIsInsideSwitchBlockFour() throws Exception { + final String[] expected = { + "18:25: " + getCheckMessage(MSG_KEY_SINGLE, 19, 24, 20), + "34:12: " + getCheckMessage(MSG_KEY_BLOCK, "33, 37", 11, "16, 12"), +@@ -187,7 +187,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33471,16 +34172,25 @@ final String[] expected = { "16:20: " + getCheckMessage(MSG_KEY_SINGLE, 19, 19, 31), "17:24: " + getCheckMessage(MSG_KEY_BLOCK, 19, 23, 31), -@@ -135,7 +135,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -202,7 +202,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test -- public void testSurroundingCode() throws Exception { -+ void surroundingCode() throws Exception { +- public void testSurroundingCodeOne() throws Exception { ++ void surroundingCodeOne() throws Exception { final String[] expected = { "20:15: " + getCheckMessage(MSG_KEY_SINGLE, 21, 14, 12), "31:17: " + getCheckMessage(MSG_KEY_BLOCK, 32, 16, 12), -@@ -155,14 +155,14 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -218,7 +218,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testSurroundingCodeTwo() throws Exception { ++ void surroundingCodeTwo() throws Exception { + final String[] expected = { + "20:34: " + getCheckMessage(MSG_KEY_SINGLE, 21, 33, 8), + "42:13: " + getCheckMessage(MSG_KEY_BLOCK, 43, 12, 8), +@@ -230,14 +230,14 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33497,16 +34207,25 @@ final String[] expected = { "20:15: " + getCheckMessage(MSG_KEY_SINGLE, 21, 14, 12), "57:28: " + getCheckMessage(MSG_KEY_SINGLE, 60, 27, 36), -@@ -175,7 +175,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -250,7 +250,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test -- public void testCheckOnlyBlockComments() throws Exception { -+ void checkOnlyBlockComments() throws Exception { +- public void testCheckOnlyBlockCommentsOne() throws Exception { ++ void checkOnlyBlockCommentsOne() throws Exception { final String[] expected = { "30:17: " + getCheckMessage(MSG_KEY_BLOCK, 31, 16, 12), "32:17: " + getCheckMessage(MSG_KEY_BLOCK, 34, 16, 12), -@@ -190,7 +190,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -262,7 +262,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testCheckOnlyBlockCommentsTwo() throws Exception { ++ void checkOnlyBlockCommentsTwo() throws Exception { + final String[] expected = { + "40:13: " + getCheckMessage(MSG_KEY_BLOCK, 41, 12, 8), + "46:5: " + getCheckMessage(MSG_KEY_BLOCK, 47, 4, 8), +@@ -273,7 +273,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33515,7 +34234,7 @@ final CommentsIndentationCheck check = new CommentsIndentationCheck(); final DetailAstImpl methodDef = new DetailAstImpl(); methodDef.setType(TokenTypes.METHOD_DEF); -@@ -207,7 +207,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -290,7 +290,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33524,16 +34243,25 @@ final String[] expected = { "10:3: " + getCheckMessage(MSG_KEY_BLOCK, 13, 2, 0), "16:1: " + getCheckMessage(MSG_KEY_BLOCK, 17, 0, 4), -@@ -219,7 +219,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -302,7 +302,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test -- public void testMultiblockStructures() throws Exception { -+ void multiblockStructures() throws Exception { +- public void testMultiblockStructuresOne() throws Exception { ++ void multiblockStructuresOne() throws Exception { final String[] expected = { "19:9: " + getCheckMessage(MSG_KEY_SINGLE, 18, 8, 12), "25:17: " + getCheckMessage(MSG_KEY_SINGLE, "24, 26", 16, "12, 8"), -@@ -245,7 +245,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -325,7 +325,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testMultiblockStructuresTwo() throws Exception { ++ void multiblockStructuresTwo() throws Exception { + final String[] expected = { + "20:9: " + getCheckMessage(MSG_KEY_SINGLE, 19, 8, 12), + "26:17: " + getCheckMessage(MSG_KEY_SINGLE, "25, 27", 16, "12, 8"), +@@ -336,7 +336,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33542,7 +34270,7 @@ final String[] expected = { "21:5: " + getCheckMessage(MSG_KEY_SINGLE, 22, 4, 0), "25:9: " + getCheckMessage(MSG_KEY_SINGLE, 26, 8, 4), -@@ -258,7 +258,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -349,7 +349,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33551,7 +34279,7 @@ final String[] expected = { "23:7: " + getCheckMessage(MSG_KEY_SINGLE, 24, 6, 4), "30:11: " + getCheckMessage(MSG_KEY_SINGLE, 31, 10, 4), -@@ -268,7 +268,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -359,7 +359,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33560,7 +34288,7 @@ final String[] expected = { "14:9: " + getCheckMessage(MSG_KEY_SINGLE, 15, 8, 16), "25:13: " + getCheckMessage(MSG_KEY_SINGLE, 24, 12, 8), -@@ -285,7 +285,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -376,7 +376,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33569,7 +34297,7 @@ final String[] expected = { "8:1: " + getCheckMessage(MSG_KEY_BLOCK, 11, 0, 1), }; -@@ -294,7 +294,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -385,7 +385,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -33578,7 +34306,7 @@ final String[] expected = { "15:17: " + getCheckMessage(MSG_KEY_SINGLE, 16, 16, 20), "28:1: " + getCheckMessage(MSG_KEY_SINGLE, 29, 0, 4), -@@ -307,7 +307,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { +@@ -398,7 +398,7 @@ public class CommentsIndentationCheckTest extends AbstractModuleTestSupport { } @Test @@ -34904,14 +35632,21 @@ final String[] expected = { "9: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), "16: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 35, "img"), -@@ -139,13 +139,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -139,19 +139,19 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testWithMultipleChecksOne() throws Exception { ++ void withMultipleChecksOne() throws Exception { + verifyWithInlineConfigParser( + getPath("InputAbstractJavadocCorrectParagraphOne.java"), CommonUtil.EMPTY_STRING_ARRAY); } @Test -- public void testWithMultipleChecks() throws Exception { -+ void withMultipleChecks() throws Exception { +- public void testWithMultipleChecksTwo() throws Exception { ++ void withMultipleChecksTwo() throws Exception { verifyWithInlineConfigParser( - getPath("InputAbstractJavadocCorrectParagraph.java"), CommonUtil.EMPTY_STRING_ARRAY); + getPath("InputAbstractJavadocCorrectParagraphTwo.java"), CommonUtil.EMPTY_STRING_ARRAY); } @Test @@ -34920,7 +35655,7 @@ final String[] expected = { "9: " + getCheckMessage( -@@ -157,8 +157,8 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -163,8 +163,8 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34931,7 +35666,7 @@ final String[] expectedMessagesForFile1 = { "9: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), "16: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 35, "img"), -@@ -178,7 +178,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -184,7 +184,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34940,7 +35675,7 @@ final String[] expected = { "9: " + getCheckMessage(MSG_JAVADOC_MISSED_HTML_CLOSE, 4, "unclosedTag"), "16: " -@@ -190,7 +190,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -196,7 +196,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34949,25 +35684,61 @@ final String[] expected = { "12: " + getCheckMessage(SummaryJavadocCheck.class, MSG_SUMMARY_FIRST_SENTENCE), }; -@@ -201,7 +201,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -207,7 +207,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testPositionOne() throws Exception { ++ void positionOne() throws Exception { + JavadocCatchCheck.clearCounter(); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputAbstractJavadocPositionOne.java"), expected); +@@ -219,7 +219,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test -- public void testPosition() throws Exception { -+ void position() throws Exception { +- public void testPositionTwo() throws Exception { ++ void positionTwo() throws Exception { JavadocCatchCheck.clearCounter(); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verifyWithInlineConfigParser(getPath("InputAbstractJavadocPosition.java"), expected); -@@ -213,7 +213,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser(getPath("InputAbstractJavadocPositionTwo.java"), expected); +@@ -231,7 +231,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test -- public void testPositionWithSinglelineComments() throws Exception { -+ void positionWithSinglelineComments() throws Exception { +- public void testPositionThree() throws Exception { ++ void positionThree() throws Exception { + JavadocCatchCheck.clearCounter(); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputAbstractJavadocPositionThree.java"), expected); +@@ -243,7 +243,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testPositionWithSinglelineCommentsOne() throws Exception { ++ void positionWithSinglelineCommentsOne() throws Exception { JavadocCatchCheck.clearCounter(); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -226,7 +226,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -256,7 +256,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testPositionWithSinglelineCommentsTwo() throws Exception { ++ void positionWithSinglelineCommentsTwo() throws Exception { + JavadocCatchCheck.clearCounter(); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser( +@@ -269,7 +269,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testPositionWithSinglelineCommentsThree() throws Exception { ++ void positionWithSinglelineCommentsThree() throws Exception { + JavadocCatchCheck.clearCounter(); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser( +@@ -282,7 +282,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34976,7 +35747,7 @@ JavadocCatchCheck.clearCounter(); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( -@@ -237,7 +237,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -293,7 +293,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34985,7 +35756,7 @@ final int[] defaultJavadocTokens = {JavadocTokenTypes.JAVADOC}; final AbstractJavadocCheck check = new AbstractJavadocCheck() { -@@ -273,7 +273,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -329,7 +329,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -34994,7 +35765,7 @@ final int[] defaultJavadocTokens = { JavadocTokenTypes.JAVADOC, JavadocTokenTypes.AREA_HTML_TAG_NAME, -@@ -295,11 +295,11 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -351,11 +351,11 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } }; check.setJavadocTokens("RETURN_LITERAL"); @@ -35008,7 +35779,7 @@ final String path = getPath("InputAbstractJavadocTokensFail.java"); try { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -318,13 +318,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -374,13 +374,13 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -35024,16 +35795,34 @@ final DefaultConfiguration checkConfig = createModuleConfig(RequiredTokenIsNotInDefaultsJavadocCheck.class); final String pathToEmptyFile = File.createTempFile("empty", ".java", temporaryFolder).getPath(); -@@ -346,7 +346,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -402,7 +402,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testVisitLeaveTokenOne() throws Exception { ++ void visitLeaveTokenOne() throws Exception { + JavadocVisitLeaveCheck.clearCounter(); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputAbstractJavadocLeaveTokenOne.java"), expected); +@@ -415,7 +415,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test -- public void testVisitLeaveToken() throws Exception { -+ void visitLeaveToken() throws Exception { +- public void testVisitLeaveTokenTwo() throws Exception { ++ void visitLeaveTokenTwo() throws Exception { JavadocVisitLeaveCheck.clearCounter(); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verifyWithInlineConfigParser(getPath("InputAbstractJavadocLeaveToken.java"), expected); -@@ -359,7 +359,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + verifyWithInlineConfigParser(getPath("InputAbstractJavadocLeaveTokenTwo.java"), expected); +@@ -428,7 +428,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testVisitLeaveTokenThree() throws Exception { ++ void visitLeaveTokenThree() throws Exception { + JavadocVisitLeaveCheck.clearCounter(); + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputAbstractJavadocLeaveTokenThree.java"), expected); +@@ -441,7 +441,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -35042,7 +35831,7 @@ final String[] expected = { "18: " + getCheckMessage( -@@ -409,7 +409,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -491,7 +491,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -35051,33 +35840,59 @@ final String[] expected = { "10: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 9, "embed"), "17: " + getCheckMessage(MSG_JAVADOC_WRONG_SINGLETON_TAG, 9, "keygen"), -@@ -422,7 +422,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -504,7 +504,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test -- public void testNonTightHtmlTagIntolerantCheck() throws Exception { -+ void nonTightHtmlTagIntolerantCheck() throws Exception { +- public void testNonTightHtmlTagIntolerantCheckOne() throws Exception { ++ void nonTightHtmlTagIntolerantCheckOne() throws Exception { final String[] expected = { "12: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), "19: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), -@@ -439,14 +439,14 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -518,7 +518,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test -- public void testNonTightHtmlTagIntolerantCheckReportingNoViolation() throws Exception { -+ void nonTightHtmlTagIntolerantCheckReportingNoViolation() throws Exception { +- public void testNonTightHtmlTagIntolerantCheckTwo() throws Exception { ++ void nonTightHtmlTagIntolerantCheckTwo() throws Exception { + final String[] expected = { + "12: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), + "19: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), +@@ -530,21 +530,21 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testNonTightHtmlTagIntolerantCheckReportingNoViolationOne() throws Exception { ++ void nonTightHtmlTagIntolerantCheckReportingNoViolationOne() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser( + getPath("InputAbstractJavadocNonTightHtmlTagsNoViolationOne.java"), expected); + } + + @Test +- public void testNonTightHtmlTagIntolerantCheckReportingNoViolationTwo() throws Exception { ++ void nonTightHtmlTagIntolerantCheckReportingNoViolationTwo() throws Exception { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verifyWithInlineConfigParser( - getPath("InputAbstractJavadocNonTightHtmlTagsNoViolation.java"), expected); + getPath("InputAbstractJavadocNonTightHtmlTagsNoViolationTwo.java"), expected); } @Test -- public void testNonTightHtmlTagIntolerantCheckVisitCount() throws Exception { -+ void nonTightHtmlTagIntolerantCheckVisitCount() throws Exception { +- public void testNonTightHtmlTagIntolerantCheckVisitCountOne() throws Exception { ++ void nonTightHtmlTagIntolerantCheckVisitCountOne() throws Exception { final String[] expected = { "13: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), "20: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), -@@ -469,7 +469,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -560,7 +560,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testNonTightHtmlTagIntolerantCheckVisitCountTwo() throws Exception { ++ void nonTightHtmlTagIntolerantCheckVisitCountTwo() throws Exception { + final String[] expected = { + "13: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), + "20: " + getCheckMessage(MSG_UNCLOSED_HTML_TAG, "p"), +@@ -577,7 +577,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -35086,7 +35901,7 @@ final String[] expected = { "11:4: " + getCheckMessage(NonTightHtmlTagCheck.MSG_KEY, "BODY_TAG_START"), "12:4: " + getCheckMessage(NonTightHtmlTagCheck.MSG_KEY, "P_TAG_START"), -@@ -511,7 +511,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { +@@ -619,7 +619,7 @@ public class AbstractJavadocCheckTest extends AbstractModuleTestSupport { } @Test @@ -37976,21 +38791,48 @@ } @Test -- public void testTags() throws Exception { -+ void tags() throws Exception { +- public void testTagsOne() throws Exception { ++ void tagsOne() throws Exception { final String[] expected = { "14:1: " + getCheckMessage(MSG_JAVADOC_MISSING), - "308:1: " + getCheckMessage(MSG_JAVADOC_MISSING), + "44:1: " + getCheckMessage(MSG_JAVADOC_MISSING), @@ -70,7 +70,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } + @Test +- public void testTagsTwo() throws Exception { ++ void tagsTwo() throws Exception { + final String[] expected = { + "20:1: " + getCheckMessage(MSG_JAVADOC_MISSING), + }; +@@ -78,7 +78,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testTagsThree() throws Exception { ++ void tagsThree() throws Exception { + final String[] expected = { + "20:1: " + getCheckMessage(MSG_JAVADOC_MISSING), + }; +@@ -86,7 +86,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testTagsFour() throws Exception { ++ void tagsFour() throws Exception { + final String[] expected = { + "20:1: " + getCheckMessage(MSG_JAVADOC_MISSING), + }; +@@ -94,7 +94,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { + } + @Test - public void testInner() throws Exception { + void inner() throws Exception { final String[] expected = { "19:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "26:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -80,7 +80,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -104,7 +104,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -37999,7 +38841,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), "15:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -91,7 +91,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -115,7 +115,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38008,7 +38850,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), }; -@@ -99,7 +99,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -123,7 +123,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38017,7 +38859,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), "44:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -109,7 +109,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -133,7 +133,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38026,7 +38868,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), "35:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -121,7 +121,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -145,7 +145,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38035,7 +38877,7 @@ final String[] expected = { "22:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "24:9: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -132,7 +132,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -156,7 +156,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38044,16 +38886,25 @@ final String[] expected = { "22:5: " + getCheckMessage(MSG_JAVADOC_MISSING), }; -@@ -141,7 +141,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -165,7 +165,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test -- public void testScopes() throws Exception { -+ void scopes() throws Exception { +- public void testScopesOne() throws Exception { ++ void scopesOne() throws Exception { final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), "25:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -158,7 +158,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -176,7 +176,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testScopesTwo() throws Exception { ++ void scopesTwo() throws Exception { + final String[] expected = { + "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), + "15:1: " + getCheckMessage(MSG_JAVADOC_MISSING), +@@ -190,7 +190,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38062,7 +38913,7 @@ final String[] expected = { "15:5: " + getCheckMessage(MSG_JAVADOC_MISSING), }; -@@ -167,7 +167,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -199,7 +199,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38071,7 +38922,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), "25:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -176,7 +176,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -208,7 +208,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38080,7 +38931,7 @@ final String[] expected = { "37:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "49:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -191,14 +191,14 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -223,14 +223,14 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38097,7 +38948,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -209,7 +209,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -241,7 +241,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38106,7 +38957,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), "17:1: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -219,14 +219,14 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -251,14 +251,14 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38123,7 +38974,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -237,7 +237,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -269,7 +269,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38132,7 +38983,7 @@ final String[] expected = { "14:1: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -253,7 +253,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -285,7 +285,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38141,7 +38992,7 @@ final String[] expected = { "13:1: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -265,7 +265,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -297,7 +297,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38150,7 +39001,7 @@ final String[] expected = { "16:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "20:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -276,7 +276,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -308,7 +308,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38159,7 +39010,7 @@ final String[] expected = { "20:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "23:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -286,7 +286,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -318,7 +318,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38168,7 +39019,7 @@ final String[] expected = { "16:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "22:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -296,7 +296,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -328,7 +328,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38177,7 +39028,7 @@ final String[] expected = { "17:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "21:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -306,14 +306,14 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -338,14 +338,14 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -38194,7 +39045,7 @@ final String[] expected = { "29:5: " + getCheckMessage(MSG_JAVADOC_MISSING), "38:5: " + getCheckMessage(MSG_JAVADOC_MISSING), -@@ -323,7 +323,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { +@@ -355,7 +355,7 @@ public class MissingJavadocTypeCheckTest extends AbstractModuleTestSupport { } @Test @@ -43191,12 +44042,21 @@ } @Test -- public void testThrees() throws Exception { -+ void threes() throws Exception { +- public void testThreesOne() throws Exception { ++ void threesOne() throws Exception { final String[] expected = { - "15:1: " + getCheckMessage(MSG_PACKAGE_METHODS, 5, 3), -@@ -91,7 +91,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { + "15:1: " + getCheckMessage(MSG_PACKAGE_METHODS, 4, 3), +@@ -87,7 +87,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testThreesTwo() throws Exception { ++ void threesTwo() throws Exception { + + final String[] expected = { + "14:1: " + getCheckMessage(MSG_PACKAGE_METHODS, 4, 3), +@@ -103,7 +103,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43205,7 +44065,7 @@ final String[] expected = { "21:5: " + getCheckMessage(MSG_PRIVATE_METHODS, 1, 0), -@@ -102,7 +102,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -114,7 +114,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43214,7 +44074,7 @@ final String[] expected = { "15:1: " + getCheckMessage(MSG_MANY_METHODS, 5, 2), -@@ -112,7 +112,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -124,7 +124,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43223,7 +44083,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -120,7 +120,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -132,7 +132,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43232,7 +44092,7 @@ final String[] expected = { "15:1: " + getCheckMessage(MSG_MANY_METHODS, 2, 1), -@@ -130,7 +130,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -142,7 +142,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43241,7 +44101,7 @@ final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -138,7 +138,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -150,7 +150,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43250,7 +44110,7 @@ final String[] expected = { "22:5: " + getCheckMessage(MSG_MANY_METHODS, 2, 1), -@@ -148,7 +148,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -160,7 +160,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43259,7 +44119,7 @@ final String[] expected = { "17:5: " + getCheckMessage(MSG_PUBLIC_METHODS, 2, 1), -@@ -160,7 +160,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { +@@ -172,7 +172,7 @@ public class MethodCountCheckTest extends AbstractModuleTestSupport { } @Test @@ -43297,16 +44157,23 @@ final MethodLengthCheck methodLengthCheckObj = new MethodLengthCheck(); final int[] actual = methodLengthCheckObj.getAcceptableTokens(); final int[] expected = { -@@ -55,7 +55,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { +@@ -55,13 +55,13 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { } @Test -- public void testIt() throws Exception { -+ void it() throws Exception { +- public void testItOne() throws Exception { ++ void itOne() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputMethodLengthSimpleOne.java"), expected); + } + + @Test +- public void testItTwo() throws Exception { ++ void itTwo() throws Exception { final String[] expected = { - "76:5: " + getCheckMessage(MSG_KEY, 20, 19, "longMethod"), + "16:5: " + getCheckMessage(MSG_KEY, 20, 19, "longMethod"), }; -@@ -63,13 +63,13 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { +@@ -69,13 +69,13 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { } @Test @@ -43322,7 +44189,7 @@ final String[] expected = { "34:5: " + getCheckMessage(MSG_KEY, 8, 7, "visit"), }; -@@ -77,7 +77,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { +@@ -83,7 +83,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { } @Test @@ -43331,14 +44198,21 @@ final int max = 2; final String[] expected = { "24:5: " + getCheckMessage(MSG_KEY, 3, max, "AA"), -@@ -90,13 +90,13 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { +@@ -96,19 +96,19 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { + } + + @Test +- public void testAbstractOne() throws Exception { ++ void abstractOne() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + verifyWithInlineConfigParser(getPath("InputMethodLengthModifierOne.java"), expected); } @Test -- public void testAbstract() throws Exception { -+ void testAbstract() throws Exception { +- public void testAbstractTwo() throws Exception { ++ void abstractTwo() throws Exception { final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verifyWithInlineConfigParser(getPath("InputMethodLengthModifier.java"), expected); + verifyWithInlineConfigParser(getPath("InputMethodLengthModifierTwo.java"), expected); } @Test @@ -43347,7 +44221,7 @@ final int max = 2; final String[] expected = { -@@ -111,7 +111,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { +@@ -123,7 +123,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { } @Test @@ -43356,7 +44230,7 @@ final int max = 2; -@@ -128,7 +128,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { +@@ -140,7 +140,7 @@ public class MethodLengthCheckTest extends AbstractModuleTestSupport { } @Test @@ -47314,15 +48188,6 @@ final File file = new File(getPath("InputSuppressionCommentFilterSuppressById6.java")); final DetailAST rootAst = JavaParser.parseFile(file, JavaParser.Options.WITH_COMMENTS); -@@ -628,7 +628,7 @@ public class SuppressionCommentFilterTest extends AbstractModuleTestSupport { - } - } - -- final FileContents mockedContents = mock(FileContents.class); -+ final FileContents mockedContents = mock(); - final Map returnValue = fileContents.getSingleLineComments(); - when(mockedContents.getSingleLineComments()) - .thenReturn(returnValue) --- a/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionFilterTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionFilterTest.java @@ -39,7 +39,7 @@ import java.net.URL; @@ -48730,13 +49595,12 @@ getNonCompilablePath("InputSemicolonBetweenImports.java"), expected); --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammar/GeneratedJavaTokenTypesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammar/GeneratedJavaTokenTypesTest.java -@@ -19,16 +19,16 @@ - +@@ -20,15 +20,15 @@ package com.puppycrawl.tools.checkstyle.grammar; -+import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertWithMessage; +import static java.util.Collections.lastIndexOfSubList; ++import static java.util.stream.Collectors.toUnmodifiableList; import com.puppycrawl.tools.checkstyle.grammar.java.JavaLanguageLexer; import java.lang.reflect.Field; @@ -48767,7 +49631,7 @@ final String message = "A token's number has changed. Please open" + " 'GeneratedJavaTokenTypesTest' and confirm which token is at fault.\n" -@@ -298,11 +298,11 @@ public class GeneratedJavaTokenTypesTest { +@@ -305,13 +305,11 @@ public class GeneratedJavaTokenTypesTest { * unused tokens and cause Collections#lastIndexOfSubList to return a -1 and fail the test. */ @Test @@ -48776,12 +49640,14 @@ final VocabularyImpl vocabulary = (VocabularyImpl) JavaLanguageLexer.VOCABULARY; final String[] nullableSymbolicNames = vocabulary.getSymbolicNames(); final List allTokenNames = -- Arrays.stream(nullableSymbolicNames).filter(Objects::nonNull).collect(Collectors.toList()); -+ Arrays.stream(nullableSymbolicNames).filter(Objects::nonNull).collect(toImmutableList()); +- Arrays.stream(nullableSymbolicNames) +- .filter(Objects::nonNull) +- .collect(Collectors.toUnmodifiableList()); ++ Arrays.stream(nullableSymbolicNames).filter(Objects::nonNull).collect(toUnmodifiableList()); // Since the following tokens are not declared in the 'tokens' block, // they will always appear last in the list of symbolic names provided -@@ -326,7 +326,7 @@ public class GeneratedJavaTokenTypesTest { +@@ -335,7 +333,7 @@ public class GeneratedJavaTokenTypesTest { // Get the starting index of the sublist of tokens, or -1 if sublist // is not present. @@ -49504,10 +50370,10 @@ import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.DefaultConfiguration; -@@ -28,13 +29,12 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; +@@ -27,13 +28,12 @@ import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.internal.utils.CheckUtil; - import com.puppycrawl.tools.checkstyle.utils.CommonUtil; -import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.LinkedHashSet; @@ -49519,7 +50385,7 @@ private static final Set ALL_COMMENTS = new LinkedHashSet<>(); -@@ -46,10 +46,10 @@ public class AllBlockCommentsTest extends AbstractModuleTestSupport { +@@ -45,10 +45,10 @@ public class AllBlockCommentsTest extends AbstractModuleTestSupport { } @Test @@ -49529,9 +50395,9 @@ final String path = getPath("InputFullOfBlockComments.java"); - lineSeparator = CheckUtil.getLineSeparatorForFile(path, StandardCharsets.UTF_8); + lineSeparator = CheckUtil.getLineSeparatorForFile(path, UTF_8); - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verify(checkConfig, path, expected); + execute(checkConfig, path); assertWithMessage("All comments should be empty").that(ALL_COMMENTS).isEmpty(); + } --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/AllSinglelineCommentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammar/comments/AllSinglelineCommentsTest.java @@ -20,6 +20,7 @@ @@ -49762,6 +50628,35 @@ verifyAst( getNonCompilablePath("ExpectedJava20RecordDecompositionEnhancedForLoopTricky.txt"), getNonCompilablePath("InputJava20RecordDecompositionEnhancedForLoopTricky.java")); +--- a/src/test/java/com/puppycrawl/tools/checkstyle/grammar/java21/Java21AstRegressionTest.java ++++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammar/java21/Java21AstRegressionTest.java +@@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.grammar.java21; + import com.puppycrawl.tools.checkstyle.AbstractTreeTestSupport; + import org.junit.jupiter.api.Test; + +-public class Java21AstRegressionTest extends AbstractTreeTestSupport { ++final class Java21AstRegressionTest extends AbstractTreeTestSupport { + + @Override + protected String getPackageLocation() { +@@ -30,7 +30,7 @@ public class Java21AstRegressionTest extends AbstractTreeTestSupport { + } + + @Test +- public void testBasicStringTemplate() throws Exception { ++ void basicStringTemplate() throws Exception { + verifyAst( + getNonCompilablePath("ExpectedStringTemplateBasic.txt"), + getNonCompilablePath("InputStringTemplateBasic.java")); +@@ -42,7 +42,7 @@ public class Java21AstRegressionTest extends AbstractTreeTestSupport { + * vs. four spaces. + */ + @Test +- public void testBasicStringTemplateWithTabs() throws Exception { ++ void basicStringTemplateWithTabs() throws Exception { + verifyAst( + getNonCompilablePath("ExpectedStringTemplateBasicWithTabs.txt"), + getNonCompilablePath("InputStringTemplateBasicWithTabs.java")); --- a/src/test/java/com/puppycrawl/tools/checkstyle/grammar/java8/AnnotationTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/grammar/java8/AnnotationTest.java @@ -23,7 +23,7 @@ import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; @@ -50839,17 +51734,15 @@ final File nonCompilableFile = new File(getNonCompilablePath(FILE_NAME_NON_COMPILABLE)); try { -@@ -196,8 +196,8 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { +@@ -196,7 +196,7 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { } @Test - public void testShouldAcceptDirectory() { -- final File directory = mock(File.class); + void shouldAcceptDirectory() { -+ final File directory = mock(); + final File directory = mock(); when(directory.isDirectory()).thenReturn(true); assertWithMessage("MainFrame should accept directory") - .that(MainFrameModel.shouldAcceptFile(directory)) @@ -205,7 +205,7 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { } @@ -50859,17 +51752,15 @@ final File javaFile = new File(getPath(FILE_NAME_TEST_DATA)); assertWithMessage("MainFrame should accept java file") .that(MainFrameModel.shouldAcceptFile(javaFile)) -@@ -213,8 +213,8 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { +@@ -213,7 +213,7 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { } @Test - public void testShouldNotAcceptNonJavaFile() { -- final File nonJavaFile = mock(File.class); + void shouldNotAcceptNonJavaFile() { -+ final File nonJavaFile = mock(); + final File nonJavaFile = mock(); when(nonJavaFile.isDirectory()).thenReturn(false); when(nonJavaFile.getName()).thenReturn(FILE_NAME_NON_JAVA); - assertWithMessage("MainFrame should not accept non-Java file") @@ -223,7 +223,7 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { } @@ -50879,18 +51770,15 @@ final File nonExistentFile = new File(getPath(FILE_NAME_NON_EXISTENT)); assertWithMessage("MainFrame should not accept non-existent file") .that(MainFrameModel.shouldAcceptFile(nonExistentFile)) -@@ -231,9 +231,9 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { +@@ -231,7 +231,7 @@ public class MainFrameModelTest extends AbstractModuleTestSupport { } @Test - public void testOpenFileForUnknownParseMode() throws IOException { + void openFileForUnknownParseMode() throws IOException { final File javaFile = new File(getPath(FILE_NAME_TEST_DATA)); -- final ParseMode mock = mock(ParseMode.class); -+ final ParseMode mock = mock(); + final ParseMode mock = mock(); model.setParseMode(mock); - final IllegalArgumentException ex = - assertThrows( --- a/src/test/java/com/puppycrawl/tools/checkstyle/gui/MainFrameTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/gui/MainFrameTest.java @@ -46,7 +46,7 @@ import org.junit.jupiter.api.Test; @@ -51433,14 +52321,14 @@ --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/AllChecksTest.java -@@ -19,6 +19,7 @@ - +@@ -20,6 +20,7 @@ package com.puppycrawl.tools.checkstyle.internal; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.truth.Truth.assertWithMessage; ++import static java.util.stream.Collectors.toUnmodifiableSet; import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; + import com.puppycrawl.tools.checkstyle.DefaultConfiguration; @@ -53,11 +54,10 @@ import java.util.Map.Entry; import java.util.Properties; import java.util.Set; @@ -51458,23 +52346,23 @@ Stream.of( // we use GenericWhitespace for this behavior "GENERIC_START", "GENERIC_END") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "AbbreviationAsWordInName", Stream.of( // enum values should be uppercase, we use EnumValueNameCheck instead "ENUM_CONSTANT_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "FinalLocalVariable", Stream.of( // we prefer all parameters be effectively final as to not damage readability // we use ParameterAssignmentCheck to enforce this "PARAMETER_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); // we have no need to block these specific tokens CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "IllegalToken", @@ -51482,182 +52370,182 @@ "TEXT_BLOCK_LITERAL_END", "LITERAL_YIELD", "SWITCH_RULE") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); // we have no need to block specific token text CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "IllegalTokenText", -@@ -294,7 +294,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { - "STRING_LITERAL", +@@ -295,7 +295,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "CHAR_LITERAL", - "TEXT_BLOCK_CONTENT") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); + "TEXT_BLOCK_CONTENT", + "STRING_TEMPLATE_CONTENT") +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); // we do not use this check as it is deprecated CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "WriteTag", -@@ -305,7 +305,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -306,7 +306,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "ANNOTATION_FIELD_DEF", "RECORD_DEF", "COMPACT_CTOR_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); // state of the configuration when test was made until reason found in // https://github.com/checkstyle/checkstyle/issues/3730 CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( -@@ -319,7 +319,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -320,7 +320,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "VARIABLE_DEF", "RECORD_DEF", "COMPACT_CTOR_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "NoLineWrap", Stream.of( -@@ -334,33 +334,33 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -335,33 +335,33 @@ public class AllChecksTest extends AbstractModuleTestSupport { "ENUM_DEF", "INTERFACE_DEF", "RECORD_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "NoWhitespaceAfter", Stream.of( // whitespace after is preferred "TYPECAST", "LITERAL_SYNCHRONIZED") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "SeparatorWrap", Stream.of( // needs context to decide what type of parentheses should be separated or not // which this check does not provide "LPAREN", "RPAREN") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "NeedBraces", Stream.of( // we prefer no braces here as it looks unusual even though they help avoid sharing // scope of variables "LITERAL_DEFAULT", "LITERAL_CASE") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "FinalParameters", Stream.of( // we prefer these to be effectively final as to not damage readability "FOR_EACH_CLAUSE", "LITERAL_CATCH") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); CHECKSTYLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "WhitespaceAround", Stream.of( -@@ -371,7 +371,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -372,7 +372,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "WILDCARD_TYPE", "GENERIC_END", "GENERIC_START") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); // google GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( -@@ -380,13 +380,13 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -381,13 +381,13 @@ public class AllChecksTest extends AbstractModuleTestSupport { // state of the configuration when test was made until reason found in // https://github.com/checkstyle/checkstyle/issues/3730 "ANNOTATION_DEF", "ANNOTATION_FIELD_DEF", "ENUM_CONSTANT_DEF", "PACKAGE_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "AbbreviationAsWordInName", Stream.of( // enum values should be uppercase "ENUM_CONSTANT_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "NoLineWrap", Stream.of( -@@ -399,7 +399,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -400,7 +400,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "INTERFACE_DEF", "RECORD_DEF", "COMPACT_CTOR_DEF") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "SeparatorWrap", Stream.of( -@@ -416,13 +416,13 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -417,13 +417,13 @@ public class AllChecksTest extends AbstractModuleTestSupport { // which this check does not provide "LPAREN", "RPAREN") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "NeedBraces", Stream.of( // google doesn't require or prevent braces on these "LAMBDA", "LITERAL_DEFAULT", "LITERAL_CASE") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "EmptyBlock", Stream.of( -@@ -441,7 +441,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -442,7 +442,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "LITERAL_SYNCHRONIZED", "LITERAL_WHILE", "STATIC_INIT") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "WhitespaceAround", Stream.of( -@@ -453,7 +453,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -454,7 +454,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "GENERIC_START", "GENERIC_END", "WILDCARD_TYPE") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "IllegalTokenText", Stream.of( -@@ -467,7 +467,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { - "STRING_LITERAL", +@@ -469,7 +469,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { "CHAR_LITERAL", - "TEXT_BLOCK_CONTENT") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); + "TEXT_BLOCK_CONTENT", + "STRING_TEMPLATE_CONTENT") +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "OperatorWrap", Stream.of( -@@ -488,7 +488,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -490,7 +490,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { // COLON token ignored in check config, explained in // https://github.com/checkstyle/checkstyle/issues/4122 "COLON") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); GOOGLE_TOKENS_IN_CONFIG_TO_IGNORE.put( "NoWhitespaceBefore", Stream.of( -@@ -498,7 +498,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -500,7 +500,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { // whitespace is necessary between a type annotation and ellipsis // according '4.6.2 Horizontal whitespace point 9' "ELLIPSIS") -- .collect(Collectors.toSet())); -+ .collect(toImmutableSet())); +- .collect(Collectors.toUnmodifiableSet())); ++ .collect(toUnmodifiableSet())); INTERNAL_MODULES = Definitions.INTERNAL_MODULES.stream() .map( -@@ -506,7 +506,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -508,7 +508,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { final String[] packageTokens = moduleName.split("\\."); return packageTokens[packageTokens.length - 1]; }) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } @Override -@@ -515,7 +515,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -517,7 +517,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51666,7 +52554,7 @@ final String inputFilePath = getPath("InputAllChecksDefaultConfig.java"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; -@@ -535,7 +535,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -537,7 +537,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51675,7 +52563,7 @@ for (Class check : CheckUtil.getCheckstyleChecks()) { if (AbstractCheck.class.isAssignableFrom(check)) { final AbstractCheck testedCheck = -@@ -552,7 +552,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -554,7 +554,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51684,7 +52572,7 @@ for (Class check : CheckUtil.getCheckstyleChecks()) { if (AbstractCheck.class.isAssignableFrom(check)) { final AbstractCheck testedCheck = -@@ -569,7 +569,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -571,7 +571,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51693,7 +52581,7 @@ for (Class check : CheckUtil.getCheckstyleChecks()) { if (AbstractCheck.class.isAssignableFrom(check)) { final AbstractCheck testedCheck = -@@ -586,7 +586,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -588,7 +588,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51702,7 +52590,7 @@ for (Class module : CheckUtil.getCheckstyleModules()) { if (ModuleReflectionUtil.isRootModule(module) || ModuleReflectionUtil.isFilterModule(module) -@@ -606,7 +606,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -608,7 +608,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51711,7 +52599,7 @@ final Set modulesReferencedInConfig = CheckUtil.getConfigCheckStyleModules(); final Set moduleNames = CheckUtil.getSimpleNames(CheckUtil.getCheckstyleModules()); -@@ -623,7 +623,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -625,7 +625,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51720,7 +52608,7 @@ final Configuration configuration = ConfigurationUtil.loadConfiguration("config/checkstyle-checks.xml"); -@@ -632,7 +632,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -634,7 +634,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51729,7 +52617,7 @@ final Configuration configuration = ConfigurationUtil.loadConfiguration("src/main/resources/google_checks.xml"); -@@ -730,7 +730,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -732,7 +732,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51738,7 +52626,7 @@ final Set checkstyleModulesNames = CheckUtil.getSimpleNames(CheckUtil.getCheckstyleModules()); final Set modulesNamesWhichHaveXdocs = XdocUtil.getModulesNamesWhichHaveXdoc(); -@@ -752,7 +752,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -754,7 +754,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51747,7 +52635,7 @@ final Set configChecks = CheckUtil.getConfigCheckStyleModules(); final Set moduleNames = CheckUtil.getSimpleNames(CheckUtil.getCheckstyleModules()); moduleNames.removeAll(INTERNAL_MODULES); -@@ -764,7 +764,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -766,7 +766,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51756,7 +52644,7 @@ for (Class module : CheckUtil.getCheckstyleChecks()) { final String name = module.getSimpleName(); final Set messages = CheckUtil.getCheckMessages(module, false); -@@ -783,7 +783,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { +@@ -785,7 +785,7 @@ public class AllChecksTest extends AbstractModuleTestSupport { } @Test @@ -51849,14 +52737,14 @@ .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/CliOptionsXdocsSyncTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/CliOptionsXdocsSyncTest.java -@@ -19,6 +19,7 @@ - +@@ -20,6 +20,7 @@ package com.puppycrawl.tools.checkstyle.internal; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.truth.Truth.assertWithMessage; ++import static java.util.stream.Collectors.toUnmodifiableSet; import com.puppycrawl.tools.checkstyle.internal.utils.XmlUtil; + import java.nio.file.Files; @@ -32,7 +33,6 @@ import java.util.Map; import java.util.Set; import java.util.regex.Matcher; @@ -51891,14 +52779,14 @@ final Set shortParamsMain = commandLine.getCommandSpec().options().stream() .map(OptionSpec::shortestName) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); final Set longParamsMain = commandLine.getCommandSpec().options().stream() .map(OptionSpec::longestName) .filter(names -> names.length() != 2) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); assertWithMessage("Short parameters in Main.java and cmdline" + ".xml.vm should match") .that(shortParamsMain) @@ -51906,20 +52794,19 @@ result = XmlUtil.getChildrenElements(node).stream() .map(Node::getTextContent) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } return result; } --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/CommitValidationTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/CommitValidationTest.java -@@ -19,17 +19,18 @@ - +@@ -20,16 +20,17 @@ package com.puppycrawl.tools.checkstyle.internal; -+import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertWithMessage; +import static java.util.Collections.emptyIterator; ++import static java.util.stream.Collectors.toUnmodifiableList; +import com.google.common.collect.ImmutableList; import java.io.IOException; @@ -52013,8 +52900,8 @@ Spliterators.spliteratorUnknownSize(previousCommitsIterator, Spliterator.ORDERED); return StreamSupport.stream(spliterator, false) .limit(PREVIOUS_COMMITS_TO_CHECK_COUNT) -- .collect(Collectors.toList()); -+ .collect(toImmutableList()); +- .collect(Collectors.toUnmodifiableList()); ++ .collect(toUnmodifiableList()); } private static List getCommitsByLastCommitAuthor( @@ -52031,16 +52918,18 @@ private RevCommitsPair(Iterator first, Iterator second) { --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/ImmutabilityTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/ImmutabilityTest.java -@@ -26,6 +26,8 @@ import static com.tngtech.archunit.lang.conditions.ArchPredicates.have; +@@ -25,7 +25,10 @@ import static com.tngtech.archunit.lang.conditions.ArchPredicates.are; + import static com.tngtech.archunit.lang.conditions.ArchPredicates.have; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.fields; ++import static java.util.function.Function.identity; ++import static java.util.stream.Collectors.toUnmodifiableMap; +import com.google.common.collect.ImmutableSet; -+import com.google.common.collect.Maps; import com.puppycrawl.tools.checkstyle.FileStatefulCheck; import com.puppycrawl.tools.checkstyle.GlobalStatefulCheck; import com.puppycrawl.tools.checkstyle.StatelessCheck; -@@ -51,11 +53,9 @@ import java.util.List; +@@ -51,11 +54,9 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -52053,7 +52942,7 @@ /** Immutable types canonical names. */ private static final Set IMMUTABLE_TYPES = -@@ -99,7 +99,7 @@ public class ImmutabilityTest { +@@ -99,7 +100,7 @@ public class ImmutabilityTest { /** List of fields not following {@link #testUtilClassesImmutability()} rule. */ private static final Set SUPPRESSED_FIELDS_IN_UTIL_CLASSES = @@ -52062,7 +52951,7 @@ "com.puppycrawl.tools.checkstyle.utils.TokenUtil.TOKEN_IDS", "com.puppycrawl.tools.checkstyle.utils.XpathUtil.TOKEN_TYPES_WITH_TEXT_ATTRIBUTE"); -@@ -164,7 +164,7 @@ public class ImmutabilityTest { +@@ -164,7 +165,7 @@ public class ImmutabilityTest { /** List of classes not following {@link #testClassesWithMutableFieldsShouldBeStateful()} rule. */ private static final Set SUPPRESSED_CLASSES_FOR_STATEFUL_CHECK_RULE = @@ -52071,15 +52960,14 @@ private static final JavaClasses CHECKSTYLE_CHECKS = new ClassFileImporter() -@@ -190,12 +190,13 @@ public class ImmutabilityTest { - +@@ -191,13 +192,11 @@ public class ImmutabilityTest { /** Map of module full name to module details. */ private static final Map MODULE_DETAILS_MAP = -- XmlMetaReader.readAllModulesIncludingThirdPartyIfAny().stream() -- .collect(Collectors.toMap(ModuleDetails::getFullQualifiedName, Function.identity())); -+ Maps.uniqueIndex( -+ XmlMetaReader.readAllModulesIncludingThirdPartyIfAny(), -+ ModuleDetails::getFullQualifiedName); + XmlMetaReader.readAllModulesIncludingThirdPartyIfAny().stream() +- .collect( +- Collectors.toUnmodifiableMap( +- ModuleDetails::getFullQualifiedName, Function.identity())); ++ .collect(toUnmodifiableMap(ModuleDetails::getFullQualifiedName, identity())); /** Test to ensure that fields in util classes are immutable. */ @Test @@ -52088,7 +52976,7 @@ final JavaClasses utilClasses = new ClassFileImporter() .withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS) -@@ -223,7 +224,7 @@ public class ImmutabilityTest { +@@ -225,7 +224,7 @@ public class ImmutabilityTest { /** Test to ensure modules annotated with {@link StatelessCheck} contain immutable fields. */ @Test @@ -52097,7 +52985,7 @@ final DescribedPredicate moduleProperties = new ModulePropertyPredicate(); final ArchCondition beSuppressedField = -@@ -245,7 +246,7 @@ public class ImmutabilityTest { +@@ -247,7 +246,7 @@ public class ImmutabilityTest { /** Test to ensure classes with immutable fields are annotated with {@link StatelessCheck}. */ @Test @@ -52106,7 +52994,7 @@ final ArchCondition beSuppressedClass = new SuppressionArchCondition<>( SUPPRESSED_CLASSES_FOR_STATELESS_CHECK_RULE, "be suppressed"); -@@ -267,7 +268,7 @@ public class ImmutabilityTest { +@@ -269,7 +268,7 @@ public class ImmutabilityTest { * {@link GlobalStatefulCheck}. */ @Test @@ -52115,7 +53003,7 @@ final ArchCondition beSuppressedClass = new SuppressionArchCondition<>(SUPPRESSED_CLASSES_FOR_STATEFUL_CHECK_RULE, "be suppressed"); -@@ -350,7 +351,7 @@ public class ImmutabilityTest { +@@ -352,7 +351,7 @@ public class ImmutabilityTest { "Field <%s> should %s in %s", item.getFullName(), getDescription(), @@ -52181,16 +53069,14 @@ final String fileName = file.getName(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java -@@ -19,8 +19,12 @@ - - package com.puppycrawl.tools.checkstyle.internal; +@@ -21,6 +21,10 @@ package com.puppycrawl.tools.checkstyle.internal; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.truth.Truth.assertWithMessage; import static java.lang.Integer.parseInt; +import static java.util.Collections.unmodifiableSet; +import static java.util.regex.Pattern.DOTALL; +import static java.util.stream.Collectors.joining; ++import static java.util.stream.Collectors.toUnmodifiableSet; import com.puppycrawl.tools.checkstyle.Checker; import com.puppycrawl.tools.checkstyle.ConfigurationLoader; @@ -52340,8 +53226,8 @@ result = XmlUtil.getChildrenElements(node).stream() .map(Node::getTextContent) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } return result; } @@ -52365,14 +53251,14 @@ final String input = Files.readString(path); --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsUrlTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsUrlTest.java -@@ -19,6 +19,7 @@ - +@@ -20,6 +20,7 @@ package com.puppycrawl.tools.checkstyle.internal; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.truth.Truth.assertWithMessage; ++import static java.util.stream.Collectors.toUnmodifiableSet; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; + import com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck; @@ -35,14 +36,13 @@ import java.util.List; import java.util.Locale; import java.util.Map; @@ -52393,8 +53279,8 @@ return AbstractCheck.class.isAssignableFrom(clazz) || AbstractFileSetCheck.class.isAssignableFrom(clazz); }) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); for (Class check : treeWalkerOrFileSetCheckSet) { final String checkName = check.getSimpleName(); if (!TREE_WORKER.equals(checkName)) { @@ -52409,20 +53295,20 @@ final DummyHandler checkHandler = new DummyHandler(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XpathRegressionTest.java -@@ -19,8 +19,12 @@ - +@@ -20,7 +20,12 @@ package com.puppycrawl.tools.checkstyle.internal; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; import static com.google.common.truth.Truth.assertWithMessage; ++import static java.util.function.Function.identity; +import static java.util.stream.Collectors.toCollection; ++import static java.util.stream.Collectors.toUnmodifiableMap; ++import static java.util.stream.Collectors.toUnmodifiableSet; +import com.google.common.collect.ImmutableSet; -+import com.google.common.collect.Maps; import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport; import com.puppycrawl.tools.checkstyle.Definitions; import com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck; -@@ -38,18 +42,16 @@ import java.util.HashSet; +@@ -38,18 +43,16 @@ import java.util.HashSet; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -52443,7 +53329,7 @@ "NoCodeInFile (reason is that AST is not generated for a file not containing code)", "Regexp (reason is at #7759)", "RegexpSinglelineJava (reason is at #7759)"); -@@ -79,7 +81,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -79,7 +82,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { // Older regex-based checks that are under INCOMPATIBLE_JAVADOC_CHECK_NAMES // but not subclasses of AbstractJavadocCheck. private static final Set> REGEXP_JAVADOC_CHECKS = @@ -52452,7 +53338,7 @@ JavadocStyleCheck.class, JavadocMethodCheck.class, JavadocTypeCheck.class, -@@ -122,7 +124,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -115,7 +118,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { "VisibilityModifier"); // Modules that will never have xpath support ever because they not report violations @@ -52461,22 +53347,23 @@ private static final Set SIMPLE_CHECK_NAMES = getSimpleCheckNames(); private static final Map ALLOWED_DIRECTORY_AND_CHECKS = -@@ -142,8 +144,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { - } +@@ -136,9 +139,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { private static Map getAllowedDirectoryAndChecks() { -- return SIMPLE_CHECK_NAMES.stream() -- .collect(Collectors.toMap(id -> id.toLowerCase(Locale.ENGLISH), Function.identity())); -+ return Maps.uniqueIndex(SIMPLE_CHECK_NAMES, id -> id.toLowerCase(Locale.ENGLISH)); + return SIMPLE_CHECK_NAMES.stream() +- .collect( +- Collectors.toUnmodifiableMap( +- id -> id.toLowerCase(Locale.ENGLISH), Function.identity())); ++ .collect(toUnmodifiableMap(id -> id.toLowerCase(Locale.ENGLISH), identity())); } private static Set getInternalModules() { -@@ -153,11 +154,11 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -148,11 +149,11 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { final String[] packageTokens = moduleName.split("\\."); return packageTokens[packageTokens.length - 1]; }) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } @BeforeEach @@ -52485,7 +53372,7 @@ javaDir = Paths.get("src/it/java/" + getPackageLocation()); inputDir = Paths.get(getPath("")); } -@@ -173,12 +174,12 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -168,12 +169,12 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } @Test @@ -52500,7 +53387,7 @@ // add the extra checks abstractJavadocCheckNames.addAll(REGEXP_JAVADOC_CHECKS); final Set abstractJavadocCheckSimpleNames = -@@ -192,7 +193,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -187,7 +188,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } @Test @@ -52509,7 +53396,7 @@ final Set compatibleChecks = new HashSet<>(); final Pattern pattern = Pattern.compile("^XpathRegression(.+)Test\\.java$"); try (DirectoryStream javaPaths = Files.newDirectoryStream(javaDir)) { -@@ -236,7 +237,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -231,7 +232,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { final Set allChecks = new HashSet<>(SIMPLE_CHECK_NAMES); allChecks.removeAll(INCOMPATIBLE_JAVADOC_CHECK_NAMES); allChecks.removeAll(INCOMPATIBLE_CHECK_NAMES); @@ -52518,7 +53405,7 @@ allChecks.removeAll(MISSING_CHECK_NAMES); allChecks.removeAll(NO_VIOLATION_MODULES); allChecks.removeAll(compatibleChecks); -@@ -251,7 +252,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { +@@ -246,7 +247,7 @@ public class XpathRegressionTest extends AbstractModuleTestSupport { } @Test @@ -52603,8 +53490,8 @@ package com.puppycrawl.tools.checkstyle.internal.utils; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; +import static java.util.stream.Collectors.toCollection; ++import static java.util.stream.Collectors.toUnmodifiableSet; + import com.google.common.reflect.ClassPath; import com.puppycrawl.tools.checkstyle.api.FileText; @@ -52630,8 +53517,8 @@ final String packageName = "com.puppycrawl.tools.checkstyle"; return getCheckstyleModulesRecursive(packageName, loader).stream() .filter(ModuleReflectionUtil::isCheckstyleTreeWalkerCheck) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } /** @@ -52639,8 +53526,8 @@ .map(ClassPath.ClassInfo::load) .filter(ModuleReflectionUtil::isCheckstyleModule) .filter(CheckUtil::isFromAllowedPackages) -- .collect(Collectors.toSet()); -+ .collect(toImmutableSet()); +- .collect(Collectors.toUnmodifiableSet()); ++ .collect(toUnmodifiableSet()); } /** @@ -52680,7 +53567,7 @@ package com.puppycrawl.tools.checkstyle.internal.utils; -+import static com.google.common.collect.ImmutableSet.toImmutableSet; ++import static java.util.stream.Collectors.toUnmodifiableSet; + import java.io.IOException; import java.nio.file.Files; @@ -52696,8 +53583,8 @@ return attr.isRegularFile() && (path.toString().endsWith(".xml") || path.toString().endsWith(".xml.vm")); })) { -- return stream.collect(Collectors.toSet()); -+ return stream.collect(toImmutableSet()); +- return stream.collect(Collectors.toUnmodifiableSet()); ++ return stream.collect(toUnmodifiableSet()); } } @@ -52705,8 +53592,8 @@ (path, attr) -> { return attr.isRegularFile() && path.toString().endsWith(".xml.template"); })) { -- return stream.collect(Collectors.toSet()); -+ return stream.collect(toImmutableSet()); +- return stream.collect(Collectors.toUnmodifiableSet()); ++ return stream.collect(toUnmodifiableSet()); } } @@ -53937,7 +54824,7 @@ final String filename = CommonUtil.CLASSPATH_URL_PROTOCOL + getPackageLocation() -@@ -551,15 +552,15 @@ public class CommonUtilTest extends AbstractPathTestSupport { +@@ -551,14 +552,14 @@ public class CommonUtilTest extends AbstractPathTestSupport { } @Test @@ -53950,12 +54837,10 @@ @Test - public void testLoadSuppressionsUriSyntaxException() throws Exception { -- final URL configUrl = mock(URL.class); + void loadSuppressionsUriSyntaxException() throws Exception { -+ final URL configUrl = mock(); + final URL configUrl = mock(); when(configUrl.toURI()).thenThrow(URISyntaxException.class); try (MockedStatic utilities = mockStatic(CommonUtil.class, CALLS_REAL_METHODS)) { - final String fileName = "/suppressions_none.xml"; --- a/src/test/java/com/puppycrawl/tools/checkstyle/utils/FilterUtilTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/utils/FilterUtilTest.java @@ -26,19 +26,19 @@ import java.io.File; @@ -54635,7 +55520,7 @@ + void getTokenTypesTotalNumber() { final int tokenTypesTotalNumber = TokenUtil.getTokenTypesTotalNumber(); - assertWithMessage("Invalid token total number").that(tokenTypesTotalNumber).isEqualTo(188); + assertWithMessage("Invalid token total number").that(tokenTypesTotalNumber).isEqualTo(194); } @Test @@ -56973,10 +57858,10 @@ verifyWithInlineConfigParser(getPath("Example3.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -26,21 +26,21 @@ import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class NewlineAtEndOfFileCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class NewlineAtEndOfFileCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -56987,25 +57872,53 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + verifyWithInlineConfigParser(getPath("Example1.java"), expected); } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "1: " + getCheckMessage(MSG_KEY_NO_NEWLINE_EOF), + }; +@@ -49,7 +49,7 @@ public class NewlineAtEndOfFileCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; + final String[] expected = { + "1: " + getCheckMessage(MSG_KEY_WRONG_ENDING), + }; +@@ -58,7 +58,7 @@ public class NewlineAtEndOfFileCheckExamplesTest extends AbstractExamplesModuleT + } - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + @Test +- public void testExample4() throws Exception { ++ void example4() throws Exception { + final String[] expected = { + "1: " + getCheckMessage(MSG_KEY_NO_NEWLINE_EOF), + }; +@@ -67,7 +67,7 @@ public class NewlineAtEndOfFileCheckExamplesTest extends AbstractExamplesModuleT + } + + @Test +- public void testExample5() throws Exception { ++ void example5() throws Exception { + final String[] expected = { + "1: " + getCheckMessage(MSG_KEY_NO_NEWLINE_EOF), + }; +@@ -76,7 +76,7 @@ public class NewlineAtEndOfFileCheckExamplesTest extends AbstractExamplesModuleT + } + + @Test +- public void testExample6() throws Exception { ++ void example6() throws Exception { + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; + + verifyWithInlineConfigParser(getPath("Example6.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheckExamplesTest.java @@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; @@ -57725,10 +58638,10 @@ "17:3: " + getCheckMessage(MSG_KEY_LINE_PREVIOUS, "{", "3"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheckExamplesTest.java -@@ -24,49 +24,49 @@ import org.junit.jupiter.api.Disabled; +@@ -25,14 +25,14 @@ import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; + import com.puppycrawl.tools.checkstyle.utils.CommonUtil; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class NeedBracesCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class NeedBracesCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -57739,55 +58652,59 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "20:5: " + getCheckMessage(MSG_KEY_NEED_BRACES, "if"), + "24:7: " + getCheckMessage(MSG_KEY_NEED_BRACES, "else"), +@@ -47,7 +47,7 @@ public class NeedBracesCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "22:5: " + getCheckMessage(MSG_KEY_NEED_BRACES, "if"), + "26:7: " + getCheckMessage(MSG_KEY_NEED_BRACES, "else"), +@@ -57,7 +57,7 @@ public class NeedBracesCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "33:5: " + getCheckMessage(MSG_KEY_NEED_BRACES, "do"), + "40:5: " + getCheckMessage(MSG_KEY_NEED_BRACES, "while"), +@@ -67,14 +67,14 @@ public class NeedBracesCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; + final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + verifyWithInlineConfigParser(getPath("Example4.java"), expected); } @Test - public void testExample5() throws Exception { + void example5() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example5.txt"), expected); + final String[] expected = { + "39:5: " + getCheckMessage(MSG_KEY_NEED_BRACES, "while"), + }; +@@ -83,7 +83,7 @@ public class NeedBracesCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample6() throws Exception { + void example6() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example6.txt"), expected); + final String[] expected = { + "24:38: " + getCheckMessage(MSG_KEY_NEED_BRACES, "->"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheckExamplesTest.java -@@ -24,42 +24,42 @@ import org.junit.jupiter.api.Disabled; +@@ -25,14 +25,14 @@ import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_ + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class RightCurlyCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class RightCurlyCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -57798,41 +58715,45 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "19:5: " + getCheckMessage(MSG_KEY_LINE_SAME, "}", "5"), + "32:23: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", "23"), +@@ -43,7 +43,7 @@ public class RightCurlyCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "22:21: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", "21"), + "43:47: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", "47"), +@@ -53,7 +53,7 @@ public class RightCurlyCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "35:16: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", "16"), + }; +@@ -62,7 +62,7 @@ public class RightCurlyCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String[] expected = { + "22:5: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", "5"), + }; +@@ -71,7 +71,7 @@ public class RightCurlyCheckExamplesTest extends AbstractExamplesModuleTestSuppo } @Test - public void testExample5() throws Exception { + void example5() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example5.txt"), expected); + final String[] expected = { + "41:16: " + getCheckMessage(MSG_KEY_LINE_ALONE, "}", "16"), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheckExamplesTest.java @@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.ArrayTrailingCommaCh @@ -58408,10 +59329,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheckExamplesTest.java -@@ -24,35 +24,35 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextChec + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class IllegalTokenTextCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class IllegalTokenTextCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -58422,33 +59343,36 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "17:20: " + getCheckMessage(MSG_KEY, "a href"), + }; +@@ -40,7 +40,7 @@ public class IllegalTokenTextCheckExamplesTest extends AbstractExamplesModuleTes } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "18:20: " + getCheckMessage(MSG_KEY, "a href"), + "19:20: " + getCheckMessage(MSG_KEY, "a href"), +@@ -50,7 +50,7 @@ public class IllegalTokenTextCheckExamplesTest extends AbstractExamplesModuleTes } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "17:29: " + getCheckMessage(MSG_KEY, '"'), + }; +@@ -59,7 +59,7 @@ public class IllegalTokenTextCheckExamplesTest extends AbstractExamplesModuleTes } @Test - public void testExample4() throws Exception { + void example4() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example4.txt"), expected); + final String[] expected = { + "21:17: " + getCheckMessage(MSG_KEY, "^0[^lx]"), + "23:18: " + getCheckMessage(MSG_KEY, "^0[^lx]"), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheckExamplesTest.java @@ -24,56 +24,56 @@ import org.junit.jupiter.api.Disabled; @@ -59590,10 +60514,10 @@ verifyWithInlineConfigParser(getPath("Example1.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.design.InterfaceIsTypeCheck + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class InterfaceIsTypeCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class InterfaceIsTypeCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -59604,17 +60528,18 @@ @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "14:3: " + getCheckMessage(MSG_KEY), + }; +@@ -40,7 +40,7 @@ public class InterfaceIsTypeCheckExamplesTest extends AbstractExamplesModuleTest } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "16:3: " + getCheckMessage(MSG_KEY), "21:3: " + getCheckMessage(MSG_KEY), + }; --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheckExamplesTest.java @@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; @@ -61855,31 +62780,33 @@ final String[] expected = { --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,7 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.CatchParameterNameCh + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class CatchParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class CatchParameterNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { - @Override - protected String getPackageLocation() { - return "com/puppycrawl/tools/checkstyle/checks/naming/catchparametername"; + + private static final String CATCH_PARAM_NAME_PATTERN_1 = "^(e|t|ex|[a-z][a-z][a-zA-Z]+)$"; + private static final String CATCH_PARAM_NAME_PATTERN_2 = "^[a-z][a-zA-Z0-9]+$"; +@@ -35,7 +35,7 @@ public class CatchParameterNameCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "18:40: " + getCheckMessage(MSG_INVALID_PATTERN, "e123", CATCH_PARAM_NAME_PATTERN_1), + "20:35: " + getCheckMessage(MSG_INVALID_PATTERN, "ab", CATCH_PARAM_NAME_PATTERN_1), +@@ -48,7 +48,7 @@ public class CatchParameterNameCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "18:34: " + getCheckMessage(MSG_INVALID_PATTERN, "e", CATCH_PARAM_NAME_PATTERN_2), + "26:24: " --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheckExamplesTest.java @@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractClassNameChe @@ -62422,39 +63349,42 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheckExamplesTest.java -@@ -24,28 +24,28 @@ import org.junit.jupiter.api.Disabled; +@@ -24,7 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class StaticVariableNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class StaticVariableNameCheckExamplesTest extends AbstractExamplesModuleTestSupport { - @Override - protected String getPackageLocation() { - return "com/puppycrawl/tools/checkstyle/checks/naming/staticvariablename"; + + public static final String STATIC_VAR_NAME_PATTERN_1 = "^[a-z][a-zA-Z0-9]*$"; + public static final String STATIC_VAR_NAME_PATTERN_2 = "^[a-z](_?[a-zA-Z0-9]+)*$"; +@@ -35,7 +35,7 @@ public class StaticVariableNameCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample1() throws Exception { + void example1() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + final String[] expected = { + "19:21: " + getCheckMessage(MSG_INVALID_PATTERN, "ItStatic1", STATIC_VAR_NAME_PATTERN_1), + "20:24: " + getCheckMessage(MSG_INVALID_PATTERN, "ItStatic2", STATIC_VAR_NAME_PATTERN_1), +@@ -50,7 +50,7 @@ public class StaticVariableNameCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample2() throws Exception { + void example2() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + final String[] expected = { + "21:22: " + getCheckMessage(MSG_INVALID_PATTERN, "ItStatic", STATIC_VAR_NAME_PATTERN_1), + "24:22: " + getCheckMessage(MSG_INVALID_PATTERN, "It_Static1", STATIC_VAR_NAME_PATTERN_1), +@@ -61,7 +61,7 @@ public class StaticVariableNameCheckExamplesTest extends AbstractExamplesModuleT } @Test - public void testExample3() throws Exception { + void example3() throws Exception { - final String[] expected = {}; - - verifyWithInlineConfigParser(getPath("Example3.txt"), expected); + final String[] expected = { + "19:21: " + getCheckMessage(MSG_INVALID_PATTERN, "ItStatic1", STATIC_VAR_NAME_PATTERN_2), + "20:24: " + getCheckMessage(MSG_INVALID_PATTERN, "ItStatic2", STATIC_VAR_NAME_PATTERN_2), --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheckExamplesTest.java @@ -24,14 +24,14 @@ import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MS @@ -62931,10 +63861,10 @@ verifyWithInlineConfigParser(getPath("Example2.txt"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheckExamplesTest.java -@@ -24,21 +24,21 @@ import org.junit.jupiter.api.Disabled; +@@ -24,21 +24,21 @@ import static com.puppycrawl.tools.checkstyle.checks.sizes.FileLengthCheck.MSG_K + import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport; import org.junit.jupiter.api.Test; - @Disabled("until https://github.com/checkstyle/checkstyle/issues/13345") -public class FileLengthCheckExamplesTest extends AbstractExamplesModuleTestSupport { +final class FileLengthCheckExamplesTest extends AbstractExamplesModuleTestSupport { @Override @@ -62947,15 +63877,24 @@ + void example1() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example1.txt"), expected); + verifyWithInlineConfigParser(getPath("Example1.java"), expected); } @Test - public void testExample2() throws Exception { + void example2() throws Exception { + final String[] expected = { + "1: " + getCheckMessage(MSG_KEY, 18, 5), + }; +@@ -47,7 +47,7 @@ public class FileLengthCheckExamplesTest extends AbstractExamplesModuleTestSuppo + } + + @Test +- public void testExample3() throws Exception { ++ void example3() throws Exception { final String[] expected = {}; - verifyWithInlineConfigParser(getPath("Example2.txt"), expected); + verifyWithInlineConfigParser(getPath("Example3.java"), expected); --- a/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthExamplesTest.java +++ b/src/xdocs-examples/java/com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthExamplesTest.java @@ -24,7 +24,7 @@ import static com.puppycrawl.tools.checkstyle.checks.sizes.LambdaBodyLengthCheck diff --git a/integration-tests/checkstyle-expected-warnings.txt b/integration-tests/checkstyle-expected-warnings.txt index 736530b8b5..3ee09654f6 100644 --- a/integration-tests/checkstyle-expected-warnings.txt +++ b/integration-tests/checkstyle-expected-warnings.txt @@ -10,6 +10,8 @@ src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocat src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java:[40,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java:[41,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java:[166,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) +src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java:[193,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `equals` is already defined in this class or a supertype) src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) @@ -27,10 +29,10 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharacte src/test/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheckTest.java:[39,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheckTest.java:[65,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[193,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[206,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[217,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[228,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[214,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `class` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[227,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[238,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `interface` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheckTest.java:[249,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `package` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheckTest.java:[103,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheckTest.java:[49,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheckTest.java:[46,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) @@ -53,7 +55,7 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheckTes src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheckTest.java:[36,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheckTest.java:[37,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheckTest.java:[45,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java:[290,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `static` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheckTest.java:[373,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `for` is not a valid identifier) @@ -80,8 +82,8 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagTest.java src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[83,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheckTest.java:[89,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheckTest.java:[60,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[102,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[94,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[118,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `protected` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheckTest.java:[126,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `public` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtilTest.java:[38,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that a method named `extractInlineTags` is already defined in this class or a supertype) src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheckTest.java:[189,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `new` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheckTest.java:[188,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `extends` is not a valid identifier) @@ -103,8 +105,7 @@ src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineChec src/test/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheckTest.java:[195,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheckTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthCheckTest.java:[56,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java:[94,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) -src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheckTest.java:[93,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `abstract` is not a valid identifier) +src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheckTest.java:[106,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `enum` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheckTest.java:[73,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheckTest.java:[58,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) src/test/java/com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheckTest.java:[62,8] [JUnitMethodDeclaration] This method's name should not redundantly start with `test` (but note that `default` is not a valid identifier) diff --git a/integration-tests/checkstyle-init.patch b/integration-tests/checkstyle-init.patch index 20192edd62..64ceebb2f3 100644 --- a/integration-tests/checkstyle-init.patch +++ b/integration-tests/checkstyle-init.patch @@ -1,7 +1,7 @@ --- a/pom.xml +++ b/pom.xml -@@ -349,6 +349,12 @@ - 1.2.0 +@@ -362,6 +362,12 @@ + 1.3.0 test + @@ -13,7 +13,7 @@ nl.jqno.equalsverifier equalsverifier -@@ -2396,6 +2402,8 @@ +@@ -2412,6 +2418,8 @@ -Xplugin:ErrorProne ${error-prone.configuration-args} @@ -22,7 +22,7 @@ -@@ -2408,6 +2416,11 @@ +@@ -2424,6 +2432,11 @@ error-prone-contrib ${error-prone-support.version} @@ -34,7 +34,7 @@ -@@ -2452,9 +2465,10 @@ +@@ -2468,9 +2481,10 @@ -XDcompilePolicy=simple -Xplugin:ErrorProne \ @@ -46,7 +46,7 @@ -@@ -2467,6 +2481,11 @@ +@@ -2483,6 +2497,11 @@ error-prone-contrib ${error-prone-support.version} @@ -94,7 +94,7 @@ .replace(RESULTS_PLACEHOLDER, String.join(",\n", results)); --- a/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java -@@ -520,6 +520,10 @@ public final class SiteUtil { +@@ -564,6 +564,10 @@ public final class SiteUtil { * @return a set of properties for the given class. */ public static Set getPropertiesForDocumentation(Class clss, Object instance) { @@ -149,7 +149,7 @@ assertWithMessage("Exception is expected but got " + test).fail(); --- a/src/test/java/com/puppycrawl/tools/checkstyle/PropertyCacheFileTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/PropertyCacheFileTest.java -@@ -338,6 +338,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { +@@ -429,6 +429,9 @@ public class PropertyCacheFileTest extends AbstractPathTestSupport { * mock toByteArray to throw exception. */ @Test diff --git a/integration-tests/checkstyle.sh b/integration-tests/checkstyle.sh index 26494f0b27..32f2e850d0 100755 --- a/integration-tests/checkstyle.sh +++ b/integration-tests/checkstyle.sh @@ -9,7 +9,7 @@ repos_root="${integration_test_root}/.repos" test_name="$(basename "${0}" .sh)" project=checkstyle repository=https://github.com/checkstyle/checkstyle.git -revision=checkstyle-10.12.7 +revision=checkstyle-10.13.0 if [ "${#}" -gt 2 ] || ([ "${#}" = 2 ] && [ "${1:---sync}" != '--sync' ]); then echo "Usage: ${0} [--sync] []"