From 4638392d5425b8020c61c7f56b3ee41e94fa9f34 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Mon, 29 Jan 2024 06:28:51 +0100 Subject: [PATCH] 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] []"