diff --git a/.ci/check-performance-regression.sh b/.ci/check-performance-regression.sh new file mode 100755 index 00000000000..a27516eb7d9 --- /dev/null +++ b/.ci/check-performance-regression.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +set -e + +# max difference tolerance in % +THRESHOLD_PERCENTAGE=10 +# baseline of execution time in seconds +BASELINE_SECONDS=384.02 + +# JDK version +JDK_VERSION=17 +# sample project path +SAMPLE_PROJECT="./.ci-temp/jdk$JDK_VERSION" +# suppression file +SUPPRESSION_FILE="./config/projects-to-test/openjdk$JDK_VERSION-excluded.files" +# config file +CONFIG_FILE="./config/benchmark-config.xml" + +# execute a command and time it +# $TEST_COMMAND: command being timed +time_command() { + # execute the command and time it + /usr/bin/time -o time.temp -q -f "%e" "$@" &>result.tmp + + cat time.temp +} + +# execute the benchmark a few times to calculate the average metrics +# $JAR_PATH: path of the jar file being benchmarked +execute_benchmark() { + local JAR_PATH=$1 + if [ -z "$JAR_PATH" ]; then + echo "Missing JAR_PATH as an argument." + exit 1 + fi + + local TOTAL_SECONDS=0 + local NUM_EXECUTIONS=3 + + [ ! -d "$SAMPLE_PROJECT" ] && + echo "Directory $SAMPLE_PROJECT DOES NOT exist." | exit 1 + + # add suppressions to config file + sed -i "/ /r $SUPPRESSION_FILE" \ + $CONFIG_FILE + + for ((i = 0; i < NUM_EXECUTIONS; i++)); do + local CMD=(java -jar "$JAR_PATH" -c "$CONFIG_FILE" \ + -x .git -x module-info.java "$SAMPLE_PROJECT") + local BENCHMARK=($(time_command "${CMD[@]}")) + TOTAL_SECONDS=$(echo "$TOTAL_SECONDS + $BENCHMARK" | bc) + done + + # average execution time in patch + local AVERAGE_IN_SECONDS=$(echo "scale=2; $TOTAL_SECONDS / $NUM_EXECUTIONS" | bc) + echo "$AVERAGE_IN_SECONDS" +} + +# compare baseline and patch benchmarks +# $EXECUTION_TIME_SECONDS execution time of the patch +compare_results() { + local EXECUTION_TIME_SECONDS=$1 + if [ -z "$EXECUTION_TIME_SECONDS" ]; then + echo "Missing EXECUTION_TIME_SECONDS as an argument." + exit 1 + fi + # Calculate absolute percentage difference for execution time + local DEVIATION_IN_SECONDS=$(echo "scale=4; \ + ((${EXECUTION_TIME_SECONDS} - ${BASELINE_SECONDS}) / ${BASELINE_SECONDS}) * 100" | bc) + DEVIATION_IN_SECONDS=$(echo "scale=4; \ + if ($DEVIATION_IN_SECONDS < 0) -($DEVIATION_IN_SECONDS) else $DEVIATION_IN_SECONDS" | bc) + + echo "Execution Time Difference: $DEVIATION_IN_SECONDS%" + + # Check if differences exceed the maximum allowed difference + if (( $(echo "$DEVIATION_IN_SECONDS > $THRESHOLD_PERCENTAGE" | bc -l) )); then + echo "Difference exceeds the maximum allowed difference (${DEVIATION_IN_SECONDS}% \ + > ${THRESHOLD_PERCENTAGE}%)!" + exit 1 + else + echo "Difference is within the maximum allowed difference (${DEVIATION_IN_SECONDS}% \ + <= ${THRESHOLD_PERCENTAGE}%)." + exit 0 + fi +} + +# package patch +mvn -e --no-transfer-progress -Passembly,no-validations package + +# start benchmark +echo "Benchmark launching..." +AVERAGE_IN_SECONDS="$(execute_benchmark "$(find "./target/" -type f -name "checkstyle-*-all.jar")")" + +# print the command execution result +echo "================ MOST RECENT COMMAND RESULT =================" +cat result.tmp + +echo "===================== BENCHMARK SUMMARY ====================" +echo "Execution Time Baseline: ${BASELINE_SECONDS} s" +echo "Average Execution Time: ${AVERAGE_IN_SECONDS} s" +echo "============================================================" + +# compare result with baseline +compare_results "$AVERAGE_IN_SECONDS" + +exit $? diff --git a/.ci/checker-framework.groovy b/.ci/checker-framework.groovy index d51c0782e1f..5aca6f8b8d1 100644 --- a/.ci/checker-framework.groovy +++ b/.ci/checker-framework.groovy @@ -127,7 +127,10 @@ private static List> getCheckerFrameworkErrors(final String profile checkerFrameworkLines.add(lineFromReader) lineFromReader = reader.readLine() } - process.waitFor() + int exitCode = process.waitFor() + if (exitCode != 0) { + throw new IllegalStateException("Maven process exited with error code: " + exitCode) + } } finally { reader.close() } diff --git a/.ci/codenarc.groovy b/.ci/codenarc.groovy index c0a8575d132..5ecd8db68d7 100644 --- a/.ci/codenarc.groovy +++ b/.ci/codenarc.groovy @@ -1,5 +1,5 @@ @Grapes( - @Grab(group='org.codenarc', module='CodeNarc', version='1.4') + @Grab(group='org.codenarc', module='CodeNarc', version='2.2.0') ) @GrabExclude('org.codehaus.groovy:groovy-xml') import java.lang.Object diff --git a/.ci/diff-report.sh b/.ci/diff-report.sh index 36e2efac305..f3170e0b6b6 100755 --- a/.ci/diff-report.sh +++ b/.ci/diff-report.sh @@ -40,7 +40,7 @@ download-files) echo "Downloading files..." # check for projects link from PR, if not found use default from contribution repo - LINK="${LINK_FROM_PR:-$DEFAULT_PROJECTS_LINK}" + LINK="${DIFF_PROJECTS_LINK:-$DEFAULT_PROJECTS_LINK}" # get projects file curl --fail-with-body -X GET "${LINK}" \ @@ -95,6 +95,11 @@ parse-pr-description-text) NEW_MODULE_CONFIG_LINK=$(echo "$NEW_MODULE_CONFIG_PARAMETER" | sed -E 's/New module config: //') PATCH_CONFIG_LINK=$(echo "$PATCH_CONFIG_PARAMETER" | sed -E 's/Diff Regression patch config: //') REPORT_LABEL=$(echo "$REPORT_LABEL_PARAMETER" | sed -E 's/Report label: //') + # trim + PROJECTS_LINK=$(echo "$PROJECTS_LINK" | tr -d '[:space:]') + CONFIG_LINK=$(echo "$CONFIG_LINK" | tr -d '[:space:]') + NEW_MODULE_CONFIG_LINK=$(echo "$NEW_MODULE_CONFIG_LINK" | tr -d '[:space:]') + PATCH_CONFIG_LINK=$(echo "$PATCH_CONFIG_LINK" | tr -d '[:space:]') echo "URLs extracted from parameters:" echo "PROJECTS_LINK: '$PROJECTS_LINK'" diff --git a/.ci/generate-extra-site-links.sh b/.ci/generate-extra-site-links.sh index 3b934ed78bd..40d354e8a2c 100755 --- a/.ci/generate-extra-site-links.sh +++ b/.ci/generate-extra-site-links.sh @@ -18,12 +18,19 @@ checkForVariable "REPOSITORY_OWNER" echo "PR_NUMBER=$PR_NUMBER" echo "AWS_FOLDER_LINK=$AWS_FOLDER_LINK" -# Extract a list of the changed xdocs in the pull request. For example 'src/xdocs/config_misc.xml'. -CHANGED_XDOCS_PATHS=$(curl --fail-with-body -Ls \ +GITHUB_API_RESPONSE=$(curl --fail-with-body -Ls \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ - "https://api.github.com/repos/$REPOSITORY_OWNER/checkstyle/pulls/$PR_NUMBER/files?per_page=100" | - jq -r ".[] | .filename" | grep src/xdocs/ || true) + "https://api.github.com/repos/$REPOSITORY_OWNER/checkstyle/pulls/$PR_NUMBER/files?per_page=100") +echo "GITHUB_API_RESPONSE=$GITHUB_API_RESPONSE" + +# Extract a list of the changed xdocs in the pull request. For example 'src/xdocs/config_misc.xml'. +# We ignore template files and deleted files. +CHANGED_XDOCS_PATHS=$(echo "$GITHUB_API_RESPONSE" \ + | jq -r '.[] | select(.status != "removed") | .filename' \ + | grep src/xdocs/ \ + | grep -v '.*xml.template$' \ + || true) echo "CHANGED_XDOCS_PATHS=$CHANGED_XDOCS_PATHS" if [[ -z "$CHANGED_XDOCS_PATHS" ]]; then diff --git a/.ci/google-java-format.sh b/.ci/google-java-format.sh new file mode 100755 index 00000000000..22047bf492a --- /dev/null +++ b/.ci/google-java-format.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +set -e + +JAR_PATH="$1" + +INPUT_PATHS=($(find src/it/resources/com/google/checkstyle/test/ -name "Input*.java" \ + | sed "s|src/it/resources/com/google/checkstyle/test/||" \ + | grep -v "rule711generalform/InputSingleLineJavadocAndInvalidJavadocPosition.java" \ + | grep -v "rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroup.java" \ + | grep -v "rule712paragraphs/InputIncorrectJavadocParagraph.java" \ + | grep -v "rule713atclauses/InputJavaDocTagContinuationIndentation.java" \ + | grep -v "rule734nonrequiredjavadoc/InputInvalidJavadocPosition.java" \ + | grep -v "rule53camelcase/InputCamelCaseDefined.java" \ + | grep -v "rule522classnames/InputClassNames.java" \ + | grep -v "rule411optionalbracesusage/InputUseOfOptionalBraces.java" \ + | grep -v "rule412nonemptyblocks/InputNonemptyBlocksLeftRightCurly.java" \ + | grep -v "rule412nonemptyblocks/InputLeftCurlyAnnotations.java" \ + | grep -v "rule412nonemptyblocks/InputLeftCurlyMethod.java" \ + | grep -v "rule412nonemptyblocks/InputRightCurly.java" \ + | grep -v "rule412nonemptyblocks/InputRightCurlyOther.java" \ + | grep -v "rule412nonemptyblocks/InputRightCurlySwitchCase.java" \ + | grep -v "rule412nonemptyblocks/InputRightCurlySwitchCasesBlocks.java" \ + | grep -v "rule413emptyblocks/InputEmptyBlocksAndCatchBlocks.java" \ + | grep -v "rule413emptyblocks/InputEmptyFinallyBlocks.java" \ + | grep -v "rule42blockindentation/ClassWithChainedMethods.java" \ + | grep -v "rule43onestatement/InputOneStatementPerLine.java" \ + | grep -v "rule44columnlimit/InputColumnLimit.java" \ + | grep -v "rule452indentcontinuationlines/ClassWithChainedMethods.java" \ + | grep -v "rule451wheretobreak/InputOperatorWrap.java" \ + | grep -v "rule451wheretobreak/InputMethodParamPad.java" \ + | grep -v "rule451wheretobreak/InputSeparatorWrap.java" \ + | grep -v "rule451wheretobreak/InputSeparatorWrapComma.java" \ + | grep -v "rule451wheretobreak/InputSeparatorWrapMethodRef.java" \ + | grep -v "rule451wheretobreak/InputSeparatorWrapEllipsis.java" \ + | grep -v "rule451wheretobreak/InputSeparatorWrapArrayDeclarator.java" \ + | grep -v "rule451wheretobreak/InputLambdaBodyWrap.java" \ + | grep -v "rule461verticalwhitespace/InputVerticalWhitespace.java" \ + | grep -v "rule462horizontalwhitespace/InputWhitespaceAroundBasic.java" \ + | grep -v "rule462horizontalwhitespace/InputWhitespaceAfterBad.java" \ + | grep -v "rule462horizontalwhitespace/InputWhitespaceAfterGood.java" \ + | grep -v "rule462horizontalwhitespace/InputParenPad.java" \ + | grep -v "rule462horizontalwhitespace/InputNoWhitespaceBeforeEmptyForLoop.java" \ + | grep -v "rule462horizontalwhitespace/InputNoWhitespaceBeforeColonOfLabel.java" \ + | grep -v "rule462horizontalwhitespace/InputNoWhitespaceBeforeCaseDefaultColon.java" \ + | grep -v "rule462horizontalwhitespace/InputMethodParamPad.java" \ + | grep -v "rule462horizontalwhitespace/InputWhitespaceAroundGenerics.java" \ + | grep -v "rule462horizontalwhitespace/InputGenericWhitespace.java" \ + | grep -v "rule487modifiers/InputModifierOrder.java" \ + | grep -v "rule4821onevariableperline/InputOneVariablePerDeclaration.java" \ + | grep -v "rule4822declaredwhenneeded/InputDeclaredWhenNeeded.java" \ + | grep -v "rule4841indentation/ClassWithChainedMethods.java" \ + | grep -v "rule4842fallthrough/InputFallThrough.java" \ + | grep -v "rule485annotations/InputAnnotationLocation.java" \ + | grep -v "rule485annotations/InputAnnotationLocationVariables.java" \ + | grep -v "rule4852classannotations/InputClassAnnotations.java" \ + | grep -v "rule4853methods.*/InputMethodsAndConstructorsAnnotations.java" \ + | grep -v "rule4854fieldannotations/InputFieldAnnotations.java" \ + | grep -v "rule4861blockcommentstyle/InputCommentsIndentation.*.java" \ + | grep -v "rule3sourcefile/InputSourceFileStructure.java" \ + | grep -v "rule331nowildcard/InputNoWildcardImports.java" \ + | grep -v "rule332nolinewrap/InputNoLineWrapping.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacing1.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacing2.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacing3.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacing4.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacing5.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacingValid.java" \ + | grep -v "rule333orderingandspacing/InputOrderingAndSpacingValid2.java" \ + | grep -v "rule231filetab/InputWhitespaceCharacters.java" \ + )) + +for INPUT_PATH in "${INPUT_PATHS[@]}"; do + java -jar "$JAR_PATH" --replace src/it/resources/com/google/checkstyle/test/"$INPUT_PATH" +done diff --git a/.ci/no-exception-test.sh b/.ci/no-exception-test.sh index 2e6ee11b6d3..29f08aeff4e 100755 --- a/.ci/no-exception-test.sh +++ b/.ci/no-exception-test.sh @@ -115,6 +115,28 @@ openjdk20-with-checks-nonjavadoc-error) removeFolderWithProtectedFiles contribution ;; +openjdk21-with-checks-nonjavadoc-error) + LOCAL_GIT_REPO=$(pwd) + BRANCH=$(git rev-parse --abbrev-ref HEAD) + checkout_from https://github.com/checkstyle/contribution + sed -i.'' 's/value=\"error\"/value=\"ignore\"/' \ + .ci-temp/contribution/checkstyle-tester/checks-nonjavadoc-error.xml + cd .ci-temp/contribution/checkstyle-tester + cp ../../../config/projects-to-test/openjdk-21-projects-to-test-on.config \ + openjdk-21-projects-to-test-on.config + sed -i '/ /r ../../../config/projects-to-test/openjdk21-excluded.files' \ + checks-nonjavadoc-error.xml + export MAVEN_OPTS="-Xmx2048m" + groovy ./diff.groovy --listOfProjects openjdk-21-projects-to-test-on.config \ + --mode single --allowExcludes \ + --patchConfig checks-nonjavadoc-error.xml \ + --localGitRepo "$LOCAL_GIT_REPO" \ + --patchBranch "$BRANCH" -xm "-Dcheckstyle.failsOnError=false" + + cd ../../ + removeFolderWithProtectedFiles contribution + ;; + no-exception-lucene-and-others-javadoc) CS_POM_VERSION="$(getCheckstylePomVersion)" BRANCH=$(git rev-parse --abbrev-ref HEAD) @@ -218,6 +240,24 @@ no-exception-samples-ant) removeFolderWithProtectedFiles checkstyle-samples ;; +no-exception-samples-gradle) + CS_POM_VERSION="$(getCheckstylePomVersion)" + echo 'CS_POM_VERSION='"${CS_POM_VERSION}" + mvn -e --no-transfer-progress -B install -Pno-validations + checkout_from https://github.com/sevntu-checkstyle/checkstyle-samples + cd .ci-temp/checkstyle-samples/gradle-project + + sed -i "s/\(project\.ext\.checkstyleVersion = \)'[0-9.]\+'/\\1'${CS_POM_VERSION}'/" \ + build.gradle + + echo "Checking gradle properties..." + ./gradlew properties + ./gradlew check + + cd ../.. + removeFolderWithProtectedFiles checkstyle-samples + ;; + *) echo "Unexpected argument: $1" diff --git a/.ci/pitest-survival-check-xml.groovy b/.ci/pitest-survival-check-xml.groovy index fa58dd33c25..d015cd9bb37 100644 --- a/.ci/pitest-survival-check-xml.groovy +++ b/.ci/pitest-survival-check-xml.groovy @@ -267,7 +267,7 @@ private static int printComparisonToConsole(Set survivingMutations, println 'No new surviving mutation(s) found.' } else if (survivingUnsuppressedMutations.isEmpty() - && !hasOnlyStableMutations(extraSuppressions)) { + && hasOnlyUnstableMutations(extraSuppressions)) { exitCode = 0 println 'No new surviving mutation(s) found.' } @@ -293,13 +293,13 @@ private static int printComparisonToConsole(Set survivingMutations, } /** - * Whether a set has only stable mutations. + * Whether a set has only unstable mutations. * * @param mutations A set of mutations - * @return {@code true} if a set has only stable mutations + * @return {@code true} if a set has only unstable mutations */ -private static boolean hasOnlyStableMutations(Set mutations) { - return mutations.every { !it.isUnstable() } +private static boolean hasOnlyUnstableMutations(Set mutations) { + return mutations.every { it.isUnstable() } } /** diff --git a/.ci/run-link-check-plugin.sh b/.ci/run-link-check-plugin.sh index 851c146c305..7de3aa985c4 100755 --- a/.ci/run-link-check-plugin.sh +++ b/.ci/run-link-check-plugin.sh @@ -15,7 +15,8 @@ OPTION=$1 echo "------------ grep of linkcheck.html--BEGIN" LINKCHECK_ERRORS=$(grep -E "doesn't exist|externalLink" target/site/linkcheck.html \ - | grep -v 'Read timed out' | sed 's/<\/table><\/td><\/tr>//g' || true) + | grep -v 'Read timed out' | sed 's/<\/table><\/td><\/tr>//g' \ + | sed 's///g' | sed 's/<\/i><\/td><\/tr>//g' | sed 's/<\/table><\/section>//g' || true) if [[ $OPTION == "--skip-external" ]]; then echo "Checking internal (checkstyle website) links only." @@ -25,11 +26,10 @@ else echo "$LINKCHECK_ERRORS" | sort > .ci-temp/linkcheck-errors-sorted.txt fi -sort config/linkcheck-suppressions.txt | sed 's/<\/table><\/td><\/tr>//g' \ - > .ci-temp/linkcheck-suppressions-sorted.txt +sort config/linkcheck-suppressions.txt > .ci-temp/linkcheck-suppressions-sorted.txt # Suppressions exist until https://github.com/checkstyle/checkstyle/issues/11572 -diff .ci-temp/linkcheck-suppressions-sorted.txt .ci-temp/linkcheck-errors-sorted.txt || true +diff -u .ci-temp/linkcheck-suppressions-sorted.txt .ci-temp/linkcheck-errors-sorted.txt || true echo "------------ grep of linkcheck.html--END" RESULT=$(diff -y --suppress-common-lines .ci-temp/linkcheck-suppressions-sorted.txt \ diff --git a/.ci/test-spelling-unknown-words.sh b/.ci/test-spelling-unknown-words.sh index 021430159d8..aa5f4be8375 100755 --- a/.ci/test-spelling-unknown-words.sh +++ b/.ci/test-spelling-unknown-words.sh @@ -55,7 +55,8 @@ echo "Run w" printDetails() { echo '' - echo 'If you are ok with the output of this run, you will need to' + echo 'If you are ok with the output of this run,' + echo 'you will need to run the following entire multiline command:' } echo "Review results" diff --git a/.ci/validation.cmd b/.ci/validation.cmd index 89e242f95ec..9b75db470b6 100644 --- a/.ci/validation.cmd +++ b/.ci/validation.cmd @@ -32,6 +32,19 @@ if "%OPTION%" == "site_without_verify" ( goto :END_CASE ) +if "%OPTION%" == "git_diff" ( + for /f "delims=" %%a in ('git status ^| findstr /c:"Changes not staged"') do set output=%%a + if defined output ( + echo Please clean up or update .gitattributes file. + echo Git status output: + echo Top 300 lines of diff: + call git diff | find /v /n "" | findstr /R "^\[[1-2]*[1-9]*[0-9]\]" + echo There should be no changes in git repository after any CI job/task + goto :ERROR + ) + goto :END_CASE +) + echo Unexpected argument %OPTION% SET ERRORLEVEL=-1 goto :END_CASE diff --git a/.ci/validation.sh b/.ci/validation.sh index da706869091..f3bc73a5a6a 100755 --- a/.ci/validation.sh +++ b/.ci/validation.sh @@ -18,6 +18,10 @@ addCheckstyleBundleToAntResolvers() { ivysettings.xml } +function list_tasks() { + cat "${0}" | sed -E -n 's/^([a-zA-Z0-9\-]*)\)$/\1/p' | sort +} + case $1 in all-sevntu-checks) @@ -135,47 +139,52 @@ test) test-de) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=de -Duser.country=DE -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=de -Duser.country=DE -Xms1024m -Xmx2048m' ;; test-es) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=es -Duser.country=ES -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=es -Duser.country=ES -Xms1024m -Xmx2048m' ;; test-fi) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=fi -Duser.country=FI -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=fi -Duser.country=FI -Xms1024m -Xmx2048m' ;; test-fr) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=fr -Duser.country=FR -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=fr -Duser.country=FR -Xms1024m -Xmx2048m' ;; test-zh) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=zh -Duser.country=CN -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=zh -Duser.country=CN -Xms1024m -Xmx2048m' ;; test-ja) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=ja -Duser.country=JP -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=ja -Duser.country=JP -Xms1024m -Xmx2048m' ;; test-pt) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=pt -Duser.country=PT -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=pt -Duser.country=PT -Xms1024m -Xmx2048m' ;; test-tr) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=tr -Duser.country=TR -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=tr -Duser.country=TR -Xms1024m -Xmx2048m' ;; test-ru) mvn -e --no-transfer-progress clean integration-test failsafe:verify \ - -DargLine='-Duser.language=ru -Duser.country=RU -Xms1024m -Xmx2048m' + -Dsurefire.options='-Duser.language=ru -Duser.country=RU -Xms1024m -Xmx2048m' + ;; + +test-al) + mvn -e --no-transfer-progress clean integration-test failsafe:verify \ + -Dsurefire.options='-Duser.language=sq -Duser.country=AL -Xms1024m -Xmx2048m' ;; versions) @@ -450,7 +459,7 @@ assembly-run-all-jar) echo version:"$CS_POM_VERSION" mkdir -p .ci-temp FOLDER=src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired - FILE=InputMissingJavadocTypeCheckNoViolations.java + FILE=InputMissingJavadocTypeCorrect.java java -jar target/checkstyle-"$CS_POM_VERSION"-all.jar -c /google_checks.xml \ $FOLDER/$FILE > .ci-temp/output.log fail=0 @@ -527,51 +536,6 @@ javac11) done ;; -javac14) - files=($(grep -Rl --include='*.java' ': Compilable with Java14' \ - src/test/resources-noncompilable \ - src/xdocs-examples/resources-noncompilable || true)) - if [[ ${#files[@]} -eq 0 ]]; then - echo "No Java14 files to process" - else - mkdir -p target - for file in "${files[@]}" - do - javac --release 14 --enable-preview -d target "${file}" - done - fi - ;; - -javac15) - files=($(grep -Rl --include='*.java' ': Compilable with Java15' \ - src/test/resources-noncompilable \ - src/xdocs-examples/resources-noncompilable || true)) - if [[ ${#files[@]} -eq 0 ]]; then - echo "No Java15 files to process" - else - mkdir -p target - for file in "${files[@]}" - do - javac --release 15 --enable-preview -d target "${file}" - done - fi - ;; - -javac16) - files=($(grep -Rl --include='*.java' ': Compilable with Java16' \ - src/test/resources-noncompilable \ - src/xdocs-examples/resources-noncompilable || true)) - if [[ ${#files[@]} -eq 0 ]]; then - echo "No Java16 files to process" - else - mkdir -p target - for file in "${files[@]}" - do - javac --release 16 --enable-preview -d target "${file}" - done - fi - ;; - javac17) files=($(grep -Rl --include='*.java' ': Compilable with Java17' \ src/test/resources-noncompilable \ @@ -617,6 +581,21 @@ javac20) fi ;; +javac21) + files=($(grep -Rl --include='*.java' ': Compilable with Java21' \ + src/test/resources-noncompilable \ + src/xdocs-examples/resources-noncompilable || true)) + if [[ ${#files[@]} -eq 0 ]]; then + echo "No Java21 files to process" + else + mkdir -p target + for file in "${files[@]}" + do + javac --release 21 --enable-preview -d target "${file}" + done + fi + ;; + package-site) mvn -e --no-transfer-progress package -Passembly,no-validations mvn -e --no-transfer-progress site -Dlinkcheck.skip=true @@ -847,6 +826,20 @@ no-error-htmlunit) removeFolderWithProtectedFiles htmlunit ;; +no-error-spotbugs) + CS_POM_VERSION="$(getCheckstylePomVersion)" + echo CS_version: "${CS_POM_VERSION}" + mvn -e --no-transfer-progress clean install -Pno-validations + echo "Checkout target sources ..." + checkout_from https://github.com/spotbugs/spotbugs + cd .ci-temp/spotbugs + sed -i'' "s/mavenCentral()/mavenLocal(); mavenCentral()/" build.gradle + sed -i'' "s/toolVersion.*$/toolVersion '${CS_POM_VERSION}'/" gradle/checkstyle.gradle + ./gradlew :eclipsePlugin-junit:checkstyleTest -Dcheckstyle.version="${CS_POM_VERSION}" + cd ../ + removeFolderWithProtectedFiles spotbugs + ;; + no-exception-struts) CS_POM_VERSION="$(getCheckstylePomVersion)" BRANCH=$(git rev-parse --abbrev-ref HEAD) @@ -857,6 +850,7 @@ no-exception-struts) sed -i'' 's/#apache-struts/apache-struts/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -875,6 +869,7 @@ no-exception-checkstyle-sevntu) sed -i'' 's/#sevntu-checkstyle/sevntu-checkstyle/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -892,6 +887,7 @@ no-exception-checkstyle-sevntu-javadoc) sed -i'' 's/#sevntu-checkstyle/sevntu-checkstyle/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-only-javadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -908,6 +904,7 @@ no-exception-guava) sed -i'' 's/#guava/guava/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -923,7 +920,8 @@ no-exception-hibernate-orm) sed -i.'' 's/#hibernate-orm/hibernate-orm/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ - --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" + --useShallowClone \ + --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution ;; @@ -938,6 +936,7 @@ no-exception-spotbugs) sed -i.'' 's/#spotbugs/spotbugs/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -953,6 +952,7 @@ no-exception-spoon) sed -i.'' 's/#spoon/spoon/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -968,7 +968,8 @@ no-exception-spring-framework) sed -i.'' 's/#spring-framework/spring-framework/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ - --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" + --useShallowClone \ + --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution ;; @@ -983,6 +984,7 @@ no-exception-hbase) sed -i.'' 's/#Hbase/Hbase/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -1000,6 +1002,7 @@ no-exception-Pmd-elasticsearch-lombok-ast) sed -i.'' 's/#lombok-ast/lombok-ast/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -1020,6 +1023,7 @@ no-exception-alot-of-projects) sed -i.'' 's/#android-launcher/android-launcher/' projects-to-test-on.properties groovy ./diff.groovy --listOfProjects projects-to-test-on.properties \ --patchConfig checks-nonjavadoc-error.xml -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --allowExcludes --mode single -xm "-Dcheckstyle.failsOnError=false" cd ../../ removeFolderWithProtectedFiles contribution @@ -1036,6 +1040,7 @@ no-warning-imports-guava) cd .ci-temp/contribution/checkstyle-tester groovy ./diff.groovy --listOfProjects $PROJECTS --patchConfig $CONFIG \ --allowExcludes -p "$BRANCH" -r ../../.. \ + --useShallowClone \ --mode single -xm "-Dcheckstyle.failsOnError=false" RESULT=$(grep -A 5 " Warning" $REPORT | cat) cd ../../ @@ -1061,6 +1066,7 @@ no-warning-imports-java-design-patterns) cd .ci-temp/contribution/checkstyle-tester groovy ./diff.groovy --listOfProjects $PROJECTS --patchConfig $CONFIG \ --allowExcludes -p "$BRANCH" -r ../../..\ + --useShallowClone \ --mode single RESULT=$(grep -A 5 " Warning" $REPORT | cat) cd ../../ @@ -1124,7 +1130,7 @@ jacoco) echo "Reporting to codecov" bash <(curl --fail-with-body -s https://codecov.io/bash) else - echo "No reporting to codecov outside CI" + echo "Result is at target/site/jacoco/index.html" fi ;; @@ -1139,7 +1145,6 @@ ci-temp-check) fail=1 fi ls -A .ci-temp - sleep 5s exit $fail ;; @@ -1180,9 +1185,53 @@ check-wildcards-on-pitest-target-classes) exit "$CLASSES_NO_WILDCARD_COUNT" ;; +verify) + mvn -e --no-transfer-progress clean verify + ;; + +package-all-jar) + mvn -e --no-transfer-progress clean package -Passembly + ;; + +website-only) + mvn -e --no-transfer-progress clean site -Pno-validations + ;; + +pmd) + mvn -e --no-transfer-progress clean test-compile pmd:check + ;; + +spotbugs) + mvn -e --no-transfer-progress clean test-compile spotbugs:check + ;; + +checkstyle) + mvn -e --no-transfer-progress clean compile antrun:run@ant-phase-verify + ;; + +forbiddenapis) + mvn -e --no-transfer-progress \ + clean compile test-compile forbiddenapis:testCheck@forbiddenapis-test + ;; + +run-test) + if [[ -z "$2" ]] ; then + echo "Error: test class is not defined." + echo "Example: mvn -e --no-transfer-progress clean test -Dtest=XdocsPagesTest,XdocsJavaDocsTest" + echo "Example: mvn -e --no-transfer-progress clean test -Dtest=CheckerTest#testDestroy" + exit 1 + fi + mvn -e --no-transfer-progress clean test -Dtest="$2" + ;; + +sevntu) + mvn -e --no-transfer-progress clean compile checkstyle:check@sevntu-checkstyle-check + ;; + *) echo "Unexpected argument: $1" - sleep 5s + echo "Supported tasks:" + list_tasks "${0}" false ;; diff --git a/.circleci/config.yml b/.circleci/config.yml index d0c8209dc67..90737cd8678 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ jobs: run-inspections: docker: - - image: checkstyle/idea-docker:jdk11-idea2022.2.2 + - image: checkstyle/idea-docker:jdk11-idea2022.3.3 steps: - checkout @@ -75,14 +75,12 @@ jobs: export PR_HEAD_SHA=$CIRCLE_SHA1 export PR_NUMBER=$CIRCLE_PR_NUMBER << parameters.command >> - sonarqube: docker: - - image: checkstyle/jdk-11-groovy-git-mvn:11.0.13__3.0.9__2.25.1__3.6.3 + - image: checkstyle/jdk-11-groovy-git-mvn:11.0.20.1__2.4.21__2.42.0__3.9.5 steps: - checkout - - run: apt-get install -y jq - run: name: Run sonarqube command: | @@ -107,30 +105,31 @@ jobs: command: yamllint -f parsable -c config/yamllint.yaml . workflows: - sonarqube: - jobs: - - sonarqube: - context: - - sonarqube + # until https://github.com/checkstyle/checkstyle/issues/13209 + # sonarqube: + # jobs: + # - sonarqube: + # context: + # - sonarqube test: jobs: # no-exception-test script - validate-with-maven-script: name: "no-exception-lucene-and-others-javadoc" - image-name: &custom_img "checkstyle/jdk-11-groovy-git-mvn:11.0.13__3.0.9__2.25.1__3.6.3" + image-name: &cs_img "checkstyle/jdk-11-groovy-git-mvn:11.0.20.1__2.4.21__2.42.0__3.9.5" command: "./.ci/no-exception-test.sh no-exception-lucene-and-others-javadoc" - validate-with-maven-script: name: "no-exception-cassandra-storm-tapestry-javadoc" - image-name: *custom_img + image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-cassandra-storm-tapestry-javadoc" - validate-with-maven-script: name: "no-exception-hadoop-apache-groovy-scouter-javadoc" - image-name: *custom_img + image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-hadoop-apache-groovy-scouter-javadoc" - validate-with-maven-script: name: "no-exception-only-javadoc" - image-name: *custom_img + image-name: *cs_img command: "./.ci/no-exception-test.sh no-exception-only-javadoc" # validation script @@ -138,90 +137,100 @@ workflows: name: "no-error-xwiki" image-name: "cimg/openjdk:18.0.1" command: "./.ci/validation.sh no-error-xwiki" - - validate-with-maven-script: - name: "no-error-pmd" - image-name: *custom_img - command: "./.ci/validation.sh no-error-pmd" + # until https://github.com/checkstyle/checkstyle/issues/15475 + # - validate-with-maven-script: + # name: "no-error-pmd" + # image-name: *cs_img + # command: "./.ci/validation.sh no-error-pmd" - validate-with-maven-script: name: "no-exception-struts" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-struts" - validate-with-maven-script: name: "no-exception-checkstyle-sevntu" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-checkstyle-sevntu" - validate-with-maven-script: name: "no-exception-checkstyle-sevntu-javadoc" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-checkstyle-sevntu-javadoc" - validate-with-maven-script: name: "no-exception-guava" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-guava" - validate-with-maven-script: name: "no-exception-hibernate-orm" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-hibernate-orm" - validate-with-maven-script: name: "no-exception-spotbugs" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-spotbugs" - validate-with-maven-script: name: "no-exception-spoon" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-spoon" - validate-with-maven-script: name: "no-exception-spring-framework" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-spring-framework" - validate-with-maven-script: name: "no-exception-hbase" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-hbase" - validate-with-maven-script: name: "no-exception-Pmd-elasticsearch-lombok-ast" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-Pmd-elasticsearch-lombok-ast" - validate-with-maven-script: name: "no-exception-alot-of-projects" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-exception-alot-of-projects" - validate-with-maven-script: name: "no-warning-imports-guava" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-warning-imports-guava" - validate-with-maven-script: name: "no-warning-imports-java-design-patterns" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-warning-imports-java-design-patterns" - validate-with-maven-script: name: "checkstyle-and-sevntu" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh checkstyle-and-sevntu" - - validate-with-maven-script: - name: "spotbugs-and-pmd" - image-name: *custom_img - command: "./.ci/validation.sh spotbugs-and-pmd" + # until https://github.com/spotbugs/spotbugs-maven-plugin/issues/806 + # - validate-with-maven-script: + # name: "spotbugs-and-pmd" + # image-name: *cs_img + # command: "./.ci/validation.sh spotbugs-and-pmd" - validate-with-maven-script: name: "site" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh site" - validate-with-maven-script: name: "release-dry-run" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh release-dry-run" - validate-with-maven-script: name: "assembly-run-all-jar" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh assembly-run-all-jar" - validate-with-maven-script: name: "no-error-test-sbe" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh no-error-test-sbe" + - validate-with-maven-script: + name: "no-error-spotbugs" + image-name: *cs_img + command: "./.ci/validation.sh no-error-spotbugs" - validate-with-maven-script: name: "linkcheck-plugin" image-name: "cimg/openjdk:11.0.19" command: "./.ci/run-link-check-plugin.sh --skip-external" + - validate-with-maven-script: + name: "no-exception-samples-gradle" + image-name: "cimg/openjdk:11.0.19" + command: "./.ci/no-exception-test.sh no-exception-samples-gradle" idea: jobs: @@ -258,18 +267,6 @@ workflows: - validate-with-script: name: "javac11" command: "./.ci/validation.sh javac11" - - validate-with-script: - name: "javac14" - image-name: "cimg/openjdk:14.0.2" - command: "./.ci/validation.sh javac14" - - validate-with-script: - name: "javac15" - image-name: "cimg/openjdk:15.0.2" - command: "./.ci/validation.sh javac15" - - validate-with-script: - name: "javac16" - image-name: "cimg/openjdk:16.0.2" - command: "./.ci/validation.sh javac16" - validate-with-script: name: "javac17" image-name: "cimg/openjdk:17.0.5" @@ -282,6 +279,10 @@ workflows: name: "javac20" image-name: "cimg/openjdk:20.0.1" command: "./.ci/validation.sh javac20" + - validate-with-script: + name: "javac21" + image-name: "cimg/openjdk:21.0.0" + command: "./.ci/validation.sh javac21" site-validation: jobs: @@ -291,5 +292,5 @@ workflows: command: "./.ci/validation.sh package-site" - validate-with-maven-script: name: "jdk11-package-site" - image-name: *custom_img + image-name: *cs_img command: "./.ci/validation.sh package-site" diff --git a/.cirrus.yml b/.cirrus.yml index a223e308590..f9f79eb8489 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,3 +1,4 @@ +only_if: $CIRRUS_BRANCH == $CIRRUS_DEFAULT_BRANCH task: name: Windows build windows_container: @@ -29,7 +30,8 @@ task: MAVEN_OPTS: "-Dhttp.keepAlive=false \ -Dmaven.repo.local=%CIRRUS_WORKING_DIR%/.m2 \ -Dmaven.wagon.http.retryHandler.count=3" - MAVEN_VERSION: "3.8.4" + # This Maven version here should be same as minimum defined maven version in pom.xml + MAVEN_VERSION: "3.6.3" PATH: "%PATH%;C:/Program Files/OpenJDK/%OPENJDK_PATH%/bin;\ C:/ProgramData/chocolatey/lib/maven/apache-maven-%MAVEN_VERSION%/bin;\ C:/ProgramData/chocolatey/bin" diff --git a/.gitattributes b/.gitattributes index ef728b8eefe..6e74fbfb238 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,3 +20,4 @@ src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/xpath/xpathquerygenerator/InputXpathQueryGeneratorTextBlockCrlf.java eol=crlf src/test/resources/com/puppycrawl/tools/checkstyle/grammar/javadoc/InputCrAsNewlineMultiline.javadoc -text src/test/resources/com/puppycrawl/tools/checkstyle/grammar/javadoc/InputDosLineEndingAsNewlineMultiline.javadoc eol=crlf +src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/newlineatendoffile/Example3.java eol=crlf diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a6a86b73803..d1dca44b426 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,7 +4,7 @@ * [Reporting issues](https://checkstyle.org/report_issue.html) * [How to report a bug?](https://checkstyle.org/report_issue.html#How_to_report_a_bug.3F) -* [Issue Template](https://github.com/checkstyle/checkstyle/blob/master/.github/ISSUE_TEMPLATE.md) +* [Issue Template](https://github.com/checkstyle/checkstyle/blob/master/.github/ISSUE_TEMPLATE/bug_report.md) Please provide issue report in the format that we request, EACH DETAIL IS A HUGE HELP. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 900bd3e48af..70c0b1f2376 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,3 @@ open_collective: checkstyle liberapay: checkstyle # issuehunt: # Replace with a single IssueHunt username # otechie: # Replace with a single Otechie username -custom: https://www.bountysource.com/teams/checkstyle/issues diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cb2c3ce8a87..02a6aa481d4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,10 @@ updates: - "> 2.1" commit-message: prefix: dependency + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + commit-message: + prefix: dependency diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index b6a577e7c5e..81882a664e2 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -6,7 +6,8 @@ on: paths: - '.github/workflows/**' pull_request: - branches: '*' + branches: + - '*' paths: - '.github/workflows/**' @@ -19,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check workflow files uses: docker://rhysd/actionlint:latest diff --git a/.github/workflows/bump-license-year.yml b/.github/workflows/bump-license-year.yml index b70d1762d0f..493a6fe3cd9 100644 --- a/.github/workflows/bump-license-year.yml +++ b/.github/workflows/bump-license-year.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set Current Year run: | diff --git a/.github/workflows/bump-version-and-update-milestone.yml b/.github/workflows/bump-version-and-update-milestone.yml index c005686f6dd..570ff2ac68c 100644 --- a/.github/workflows/bump-version-and-update-milestone.yml +++ b/.github/workflows/bump-version-and-update-milestone.yml @@ -29,10 +29,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/check-performance-regression.yml b/.github/workflows/check-performance-regression.yml new file mode 100644 index 00000000000..8b051d7bf88 --- /dev/null +++ b/.github/workflows/check-performance-regression.yml @@ -0,0 +1,50 @@ +##################################################################################### +# GitHub Action to test performance regression. +# +# Workflow starts when: +# 1) push to master +# 2) PR created or pushed +# +##################################################################################### +name: Check-Performance-Regression + +on: + push: + branches: + - master + pull_request: + branches: '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + test: + if: github.repository == 'checkstyle/checkstyle' + runs-on: ubuntu-latest + steps: + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + + - name: Checkout Pull Request Code + uses: actions/checkout@v4 + + - name: Clone JDK 17 Repo + uses: actions/checkout@v4 + with: + repository: openjdk/jdk17 + path: ./.ci-temp/jdk17 + + - name: Setup local maven cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} + + - name: Run performance test + run: | + ./.ci/check-performance-regression.sh diff --git a/.github/workflows/check-pr-description.yml b/.github/workflows/check-pr-description.yml index f27e42bfc06..f280fd05c9f 100644 --- a/.github/workflows/check-pr-description.yml +++ b/.github/workflows/check-pr-description.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Do action env: diff --git a/.github/workflows/checker-framework.yml b/.github/workflows/checker-framework.yml index d00bf0d4558..1af86d8c375 100644 --- a/.github/workflows/checker-framework.yml +++ b/.github/workflows/checker-framework.yml @@ -31,18 +31,19 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: 'temurin' - name: Install groovy run: sudo apt install groovy - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} @@ -58,7 +59,7 @@ jobs: - name: Share patch as artifact to apply on local if: failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: checker-${{ matrix.profile }}-patch path: target/checker-${{ matrix.profile }}.patch diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index fa56110640e..408dd81bf6b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,17 +31,17 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -52,7 +52,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v1 + uses: github/codeql-action/autobuild@v3 # If the Autobuild fails above, remove it and uncomment the following three lines # and modify them (or add more) to build your code if your project @@ -63,4 +63,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/diff-report.yml b/.github/workflows/diff-report.yml index 5cd0581ac11..3a6ed01a110 100644 --- a/.github/workflows/diff-report.yml +++ b/.github/workflows/diff-report.yml @@ -27,15 +27,9 @@ permissions: contents: read pull-requests: write -# Current behavior for concurrency in GitHub Actions: -# 1) If a Diff-Report workflow is NOT running for this PR, start a new one. -# 2) If a Diff-Report workflow is running for this PR, queue this workflow. -# 3) If a Diff-Report workflow is queued for this PR, cancel it and queue this workflow. -# -# It would be best to always queue a new workflow, but we are limited by -# https://github.com/orgs/community/discussions/12835. concurrency: - group: ${{ github.workflow }}-${{ github.event.issue.number }} + # run_id is guaranteed to be unique and present + group: ${{ github.run_id }} cancel-in-progress: false jobs: @@ -53,7 +47,7 @@ jobs: commit_sha: ${{ steps.branch.outputs.commit_sha }} steps: - - uses: khan/pull-request-comment-trigger@master + - uses: shanegenschaw/pull-request-comment-trigger@v3.0.0 name: React with rocket on run with: trigger: ',' @@ -65,7 +59,7 @@ jobs: if: 'true' - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Getting PR description env: @@ -113,14 +107,14 @@ jobs: steps: - name: Download checkstyle - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download files env: NEW_MODULE_CONFIG_LINK: ${{ needs.parse_body.outputs.new_module_config_link }} DIFF_CONFIG_LINK: ${{ needs.parse_body.outputs.config_link }} PATCH_CONFIG_LINK: ${{ needs.parse_body.outputs.patch_config_link }} - LINK_FROM_PR: ${{ needs.parse_body.outputs.projects_link }} + DIFF_PROJECTS_LINK: ${{ needs.parse_body.outputs.projects_link }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | ./.ci/diff-report.sh download-files @@ -138,13 +132,13 @@ jobs: git fetch forked - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} - name: Download contribution - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: checkstyle/contribution path: .ci-temp/contribution @@ -156,7 +150,7 @@ jobs: sudo apt install groovy - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -213,7 +207,7 @@ jobs: if: failure() || success() steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get message env: diff --git a/.github/workflows/error-prone.yml b/.github/workflows/error-prone.yml index 0791a7f15d8..952e6387361 100644 --- a/.github/workflows/error-prone.yml +++ b/.github/workflows/error-prone.yml @@ -17,18 +17,19 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: 'temurin' - name: Install groovy run: sudo apt install groovy - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/google-java-format.yml b/.github/workflows/google-java-format.yml new file mode 100644 index 00000000000..12d4b12d964 --- /dev/null +++ b/.github/workflows/google-java-format.yml @@ -0,0 +1,49 @@ +##################################################################################### +# GitHub Action to format specific files by google-java-format. +# +# Workflow starts when: +# 1) push to master +# 2) PR created or pushed +# +##################################################################################### +name: Google-Java-Format + +on: + push: + branches: + - master + pull_request: + branches: '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + VERSION: 1.23.0 + +jobs: + test: + if: github.repository == 'checkstyle/checkstyle' + runs-on: ubuntu-latest + steps: + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + + - name: Checkout Pull Request Code + uses: actions/checkout@v4 + + - uses: robinraju/release-downloader@v1 + with: + repository: 'google/google-java-format' + tag: "v${{env.VERSION}}" + fileName: "google-java-format-${{env.VERSION}}-all-deps.jar" + out-file-path: '.ci-temp' + + - name: Run Formatting + run: | + ./.ci/google-java-format.sh .ci-temp/google-java-format-${{env.VERSION}}-all-deps.jar + ./.ci/validation.sh git-diff diff --git a/.github/workflows/no-exception-workflow.yml b/.github/workflows/no-exception-workflow.yml index acea9b0ffa0..07ff2c6107b 100644 --- a/.github/workflows/no-exception-workflow.yml +++ b/.github/workflows/no-exception-workflow.yml @@ -18,15 +18,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: 'temurin' - name: Install dependencies run: sudo apt install groovy - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: .ci/no-exception-test.sh openjdk17-with-checks-nonjavadoc-error # this execution should stay on GitHub actions due to time/ memory limits in other CI @@ -35,15 +36,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: 'temurin' - name: Install dependencies run: sudo apt install groovy - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: .ci/no-exception-test.sh openjdk19-with-checks-nonjavadoc-error # this execution should stay on GitHub actions due to time/ memory limits in other CI @@ -52,14 +54,33 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: 'temurin' - name: Install dependencies run: sudo apt install groovy - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - run: .ci/no-exception-test.sh openjdk20-with-checks-nonjavadoc-error + # this execution should stay on GitHub actions due to time/ memory limits in other CI + no-exception-openjdk21: + if: github.repository == 'checkstyle/checkstyle' + runs-on: ubuntu-latest + steps: + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: 'temurin' + + - name: Install dependencies + run: sudo apt install groovy + + - name: Checkout repository + uses: actions/checkout@v4 + + - run: .ci/no-exception-test.sh openjdk21-with-checks-nonjavadoc-error diff --git a/.github/workflows/no-old-refs.yml b/.github/workflows/no-old-refs.yml index 011b45610a7..f8c33b18bb1 100644 --- a/.github/workflows/no-old-refs.yml +++ b/.github/workflows/no-old-refs.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Download checkstyle - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: PR linked issues id: links diff --git a/.github/workflows/pitest.yml b/.github/workflows/pitest.yml index d0553b2a9f1..ddc5f4fb8ec 100644 --- a/.github/workflows/pitest.yml +++ b/.github/workflows/pitest.yml @@ -51,9 +51,10 @@ jobs: continue-on-error: true steps: - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11 + distribution: 'temurin' - name: Install groovy run: | @@ -61,13 +62,13 @@ jobs: sudo apt install groovy - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Generate pitest-${{ matrix.profile }} report run: | @@ -89,7 +90,7 @@ jobs: - name: Archive code coverage results if: failure() || github.ref == 'refs/heads/master' - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: pitest-${{ matrix.profile }}-coverage-report path: | diff --git a/.github/workflows/regression-report.yml b/.github/workflows/regression-report.yml new file mode 100644 index 00000000000..17259f14595 --- /dev/null +++ b/.github/workflows/regression-report.yml @@ -0,0 +1,294 @@ +##################################################################################### +# GitHub Action to generate Checkstyle report. +# +# Workflow starts when: +# 1) PR comment - created +# +# Requirements: +# 1) secrets.AWS_ACCESS_KEY_ID - access key for AWS S3 service user +# 2) secrets.AWS_SECRET_ACCESS_KEY - security access key for AWS S3 service user +# +# If you need to change bucket name or region, change AWS_REGION and AWS_BUCKET_NAME variables. +# For another bucket, you will need to change the secrets. +##################################################################################### +name: regression-report +env: + AWS_REGION: us-east-2 + AWS_BUCKET_NAME: "checkstyle-diff-reports" + USER_LOGIN: ${{ github.event.issue.user.login }} + +on: + issue_comment: + types: [ created ] + +permissions: + contents: read + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.event.issue.number }} + cancel-in-progress: true + +jobs: + check_pr_status: + if: | + github.event.issue.pull_request + && (startsWith(github.event.comment.body, 'Github, generate report for ') + || startsWith(github.event.comment.body, 'GitHub, generate report for ')) + runs-on: ubuntu-latest + steps: + - name: Check PR status + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.issue.pull_request.url }} + run: | + PR_STATE=$(curl --fail-with-body -s -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "$PR_URL" | jq -r .state) + if [ "$PR_STATE" != "open" ]; then + echo "PR is not active" + exit 1 + fi + + parse_comment: + runs-on: ubuntu-latest + needs: check_pr_status + outputs: + config_bundle_path: ${{ steps.parse.outputs.config_bundle_path }} + config_link: ${{ steps.set_links.outputs.config_link }} + projects_link: ${{ steps.set_links.outputs.projects_link }} + branch: ${{ steps.set_branch.outputs.ref }} + commit_sha: ${{ steps.set_branch.outputs.commit_sha }} + + steps: + - name: React to comment + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: 'rocket' + }) + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Parse comment + id: parse + env: + COMMENT_BODY: ${{ github.event.comment.body }} + run: | + CONFIG_BUNDLE_PATH=$(echo "$COMMENT_BODY" | \ + sed -E 's/.*(Github|GitHub), generate report for //g') + echo "CONFIG_BUNDLE_PATH=$CONFIG_BUNDLE_PATH" + ./.ci/append-to-github-output.sh "config_bundle_path" "$CONFIG_BUNDLE_PATH" + + - name: Set config and projects links + id: set_links + run: | + BASE_URL="https://raw.githubusercontent.com/checkstyle/test-configs/main" + CONFIG_BUNDLE_PATH="${{ steps.parse.outputs.config_bundle_path }}" + CONFIG_LINK="$BASE_URL/$CONFIG_BUNDLE_PATH/config.xml" + PROJECTS_LINK="$BASE_URL/$CONFIG_BUNDLE_PATH/list-of-projects.properties" + echo "CONFIG_LINK=$CONFIG_LINK" + echo "PROJECTS_LINK=$PROJECTS_LINK" + ./.ci/append-to-github-output.sh "config_link" "$CONFIG_LINK" + ./.ci/append-to-github-output.sh "projects_link" "$PROJECTS_LINK" + + - name: Set branch + env: + PULL_REQUEST_URL: ${{ github.event.issue.pull_request.url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: set_branch + run: | + mkdir -p .ci-temp + curl --fail-with-body -X GET "${PULL_REQUEST_URL}" \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + -o .ci-temp/info.json + + jq --raw-output .head.ref .ci-temp/info.json > .ci-temp/branch + jq --raw-output .head.sha .ci-temp/info.json > .ci-temp/commit_sha + + ./.ci/append-to-github-output.sh "ref" "$(cat .ci-temp/branch)" + # shellcheck disable=SC2002 + ./.ci/append-to-github-output.sh "commit_sha" "$(cat .ci-temp/commit_sha | cut -c 1-7)" + + echo "GITHUB_OUTPUT:" + # need to 'echo' to see output in Github CI + # shellcheck disable=SC2005 + echo "$(cat "$GITHUB_OUTPUT")" + + make_report: + runs-on: ubuntu-latest + needs: parse_comment + if: needs.parse_comment.outputs.config_link != '' + || needs.parse_comment.outputs.projects_link != '' + outputs: + message: ${{ steps.out.outputs.message }} + download_files_failed: ${{ steps.download_files.outputs.failed }} + steps: + + - name: Download checkstyle + uses: actions/checkout@v4 + + - name: Download files + id: download_files + env: + DIFF_CONFIG_LINK: ${{ needs.parse_comment.outputs.config_link }} + DIFF_PROJECTS_LINK: ${{ needs.parse_comment.outputs.projects_link }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if ! ./.ci/diff-report.sh download-files; then + ./.ci/append-to-github-output.sh "failed" "true" + exit 1 + fi + + # set main checkstyle repo as an upstream + # Diff report will be generated taking upstream's master branch as a base branch + - name: set upstream + run: | + bash + MAIN_REPO_GIT_URL="https://github.com/checkstyle/checkstyle.git" + git remote add upstream "$MAIN_REPO_GIT_URL" + git fetch upstream + FORK_REPO_GIT_URL="https://github.com/$USER_LOGIN/checkstyle.git" + git remote add forked "$FORK_REPO_GIT_URL" + git fetch forked + + - name: Setup local maven cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} + + - name: Download contribution + uses: actions/checkout@v4 + with: + repository: checkstyle/contribution + path: .ci-temp/contribution + + - name: Prepare environment + run: | + mv .ci-temp/project.properties ./.ci-temp/contribution/checkstyle-tester/ + mv .ci-temp/*.xml ./.ci-temp/contribution/checkstyle-tester/ + sudo apt install groovy + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Generate report + env: + BRANCH: ${{ needs.parse_comment.outputs.branch }} + run: | + cd .ci-temp/contribution/checkstyle-tester + bash + REF="forked/$BRANCH" + REPO="../../../../checkstyle" + BASE_BRANCH="upstream/master" + export MAVEN_OPTS="-Xmx5g" + if [ -f new_module_config.xml ]; then + groovy diff.groovy -r "$REPO" -p "$REF" -pc new_module_config.xml -m single\ + -l project.properties -xm "-Dcheckstyle.failsOnError=false"\ + --allowExcludes + elif [ -f patch_config.xml ]; then + groovy diff.groovy -r "$REPO" -b "$BASE_BRANCH" -p "$REF" -bc diff_config.xml\ + -pc patch_config.xml -l project.properties -xm "-Dcheckstyle.failsOnError=false"\ + --allowExcludes + else + groovy diff.groovy -r "$REPO" -b "$BASE_BRANCH" -p "$REF" -c diff_config.xml\ + -l project.properties -xm "-Dcheckstyle.failsOnError=false"\ + --allowExcludes + fi + + - name: Copy Report to AWS S3 Bucket + run: | + bash + TIME=$(date +%Y%H%M%S) + FOLDER="${{needs.parse_comment.outputs.commit_sha}}_$TIME" + DIFF="./.ci-temp/contribution/checkstyle-tester/reports/diff" + LINK="https://${{env.AWS_BUCKET_NAME}}.s3.${{env.AWS_REGION}}.amazonaws.com" + aws s3 cp $DIFF "s3://${{env.AWS_BUCKET_NAME}}/$FOLDER/reports/diff/" --recursive + if [ -n "$LABEL" ]; then + echo "$LABEL: " > .ci-temp/message + fi + echo "$LINK/$FOLDER/reports/diff/index.html" >> .ci-temp/message + + - name: Set output + id: out + run: | + ./.ci/append-to-github-output.sh "message" "$(cat .ci-temp/message)" + + add_sad_Emoji: + needs: [ check_pr_status, parse_comment, make_report ] + if: cancelled() + runs-on: ubuntu-latest + steps: + - name: Add sad Emoji + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: 'confused' + }); + + # should be always last step + send_message: + runs-on: ubuntu-latest + needs: [ check_pr_status, parse_comment, make_report ] + if: failure() || success() + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get message + env: + MSG: ${{ needs.make_report.outputs.message }} + DOWNLOAD_FAILED: ${{ needs.make_report.outputs.download_files_failed }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mkdir -p .ci-temp + JOBS_LINK="https://github.com/checkstyle/checkstyle/actions/runs/${{github.run_id}}" + if [ "$DOWNLOAD_FAILED" == "true" ]; then + echo "Report generation failed. Please use 'GitHub, generate report for" \ + "check_name/example_type'
Link: $JOBS_LINK" > .ci-temp/message + elif [ -z "$MSG" ]; then + API_LINK="https://api.github.com/repos/checkstyle/checkstyle/actions/runs/" + API_LINK="${API_LINK}${{github.run_id}}/jobs" + + curl --fail-with-body -X GET "${API_LINK}" \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + -o .ci-temp/info.json + + jq '.jobs' .ci-temp/info.json > ".ci-temp/jobs" + jq '.[] | select(.conclusion == "failure") | .name' .ci-temp/jobs > .ci-temp/job_name + jq '.[] | select(.conclusion == "failure") | .steps' .ci-temp/jobs > .ci-temp/steps + jq '.[] | select(.conclusion == "failure") | .name' .ci-temp/steps > .ci-temp/step_name + echo "Report generation failed on phase $(cat .ci-temp/job_name)," > .ci-temp/message + echo "step $(cat .ci-temp/step_name).
Link: $JOBS_LINK" >> .ci-temp/message + else + echo "$MSG" > .ci-temp/message + fi + + - name: Set message + id: out + run: | + ./.ci/append-to-github-output.sh "message" "$(cat .ci-temp/message)" + + - name: Comment PR + uses: checkstyle/contribution/comment-action@master + with: + message: ${{steps.out.outputs.message}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-copy-github-io-to-sourceforge.yml b/.github/workflows/release-copy-github-io-to-sourceforge.yml index 793ead0d853..5674fb3c823 100644 --- a/.github/workflows/release-copy-github-io-to-sourceforge.yml +++ b/.github/workflows/release-copy-github-io-to-sourceforge.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Configure SSH env: diff --git a/.github/workflows/release-maven-perform.yml b/.github/workflows/release-maven-perform.yml index 2822e781bd7..0e20975f195 100644 --- a/.github/workflows/release-maven-perform.yml +++ b/.github/workflows/release-maven-perform.yml @@ -26,13 +26,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: master - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release-maven-prepare.yml b/.github/workflows/release-maven-prepare.yml index 6b7d4b836b8..74ed97b1af2 100644 --- a/.github/workflows/release-maven-prepare.yml +++ b/.github/workflows/release-maven-prepare.yml @@ -29,13 +29,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: master - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release-new-milestone-and-issues-in-other-repos.yml b/.github/workflows/release-new-milestone-and-issues-in-other-repos.yml index bebcac8602c..268808b1dab 100644 --- a/.github/workflows/release-new-milestone-and-issues-in-other-repos.yml +++ b/.github/workflows/release-new-milestone-and-issues-in-other-repos.yml @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: master @@ -41,7 +41,7 @@ jobs: sudo apt-get install ncal - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release-publish-releasenotes-twitter.yml b/.github/workflows/release-publish-releasenotes-twitter.yml index 6406c504965..9858e6f0531 100644 --- a/.github/workflows/release-publish-releasenotes-twitter.yml +++ b/.github/workflows/release-publish-releasenotes-twitter.yml @@ -27,12 +27,12 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release-update-github-io.yml b/.github/workflows/release-update-github-io.yml index b641bc59199..6ac03f7da07 100644 --- a/.github/workflows/release-update-github-io.yml +++ b/.github/workflows/release-update-github-io.yml @@ -27,13 +27,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/checkstyle fetch-depth: 0 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} @@ -43,7 +43,7 @@ jobs: ./.ci/generate-website.sh ${{ inputs.version }} - name: Checkout checkstyle.github.io repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ github.repository_owner }}/checkstyle.github.io token: ${{ secrets.PAT }} diff --git a/.github/workflows/release-update-github-page.yml b/.github/workflows/release-update-github-page.yml index b8c03f2026d..a47e8b60110 100644 --- a/.github/workflows/release-update-github-page.yml +++ b/.github/workflows/release-update-github-page.yml @@ -29,10 +29,10 @@ jobs: contents: write steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release-update-xdoc-with-releasenotes.yml b/.github/workflows/release-update-xdoc-with-releasenotes.yml index 1f1a85afa0d..d488548af3e 100644 --- a/.github/workflows/release-update-xdoc-with-releasenotes.yml +++ b/.github/workflows/release-update-xdoc-with-releasenotes.yml @@ -28,10 +28,10 @@ jobs: contents: write steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/release-upload-all-jar.yml b/.github/workflows/release-upload-all-jar.yml index 57815a5d247..f3263b0bc96 100644 --- a/.github/workflows/release-upload-all-jar.yml +++ b/.github/workflows/release-upload-all-jar.yml @@ -30,13 +30,13 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: master - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/releasenotes-gen.yml b/.github/workflows/releasenotes-gen.yml index 0b568b441e0..702aa57ca77 100644 --- a/.github/workflows/releasenotes-gen.yml +++ b/.github/workflows/releasenotes-gen.yml @@ -16,10 +16,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Download checkstyle - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/run-link-check.yml b/.github/workflows/run-link-check.yml index 4cd9eda02e5..d82b0f1998b 100644 --- a/.github/workflows/run-link-check.yml +++ b/.github/workflows/run-link-check.yml @@ -21,10 +21,10 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Download checkstyle - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/set-milestone-on-referenced-issue.yml b/.github/workflows/set-milestone-on-referenced-issue.yml index 8ab8e3aefd8..ba6964c7cc4 100644 --- a/.github/workflows/set-milestone-on-referenced-issue.yml +++ b/.github/workflows/set-milestone-on-referenced-issue.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout the latest code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set milestone on issue env: diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 9e2f2390536..ba1bd185455 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -21,7 +21,7 @@ jobs: run: sudo apt install shellcheck - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Execute shellcheck run: shellcheck ./.ci/*.sh diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 85aaa6602b6..e430a1cf960 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -27,7 +27,7 @@ permissions: concurrency: group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }} - cancel-in-progress: true + cancel-in-progress: false jobs: parse_pr_info: @@ -40,7 +40,7 @@ jobs: commit_sha: ${{ steps.branch.outputs.commit_sha }} steps: - - uses: khan/pull-request-comment-trigger@master + - uses: shanegenschaw/pull-request-comment-trigger@v3.0.0 name: React with rocket on run with: trigger: ',' @@ -77,14 +77,14 @@ jobs: message: ${{ steps.out.outputs.message}} steps: - name: Checkout repository from origin - uses: actions/checkout@v3 + uses: actions/checkout@v4 # fetch-depth - number of commits to fetch. # 0 indicates all history for all branches and tags. # 0, because we need access to all branches to create a report. # ref - branch to checkout. - name: Download checkstyle for PR - uses: actions/checkout@v3 + uses: actions/checkout@v4 env: USER_LOGIN: ${{ github.event.issue.user.login }} with: @@ -94,14 +94,14 @@ jobs: fetch-depth: 0 - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v4 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ env.AWS_REGION }} - name: Setup local maven cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: checkstyle-maven-cache-${{ hashFiles('**/pom.xml') }} @@ -138,7 +138,7 @@ jobs: if: failure() || success() steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get message env: diff --git a/.gitignore b/.gitignore index 47172199b52..20f6ee4a7ec 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,9 @@ checkstyle.ipr checkstyle.iws .idea +# Vscode project files +.vscode + # Temp files *~ diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml index 0381599ecdb..733d323fd27 100644 --- a/.semaphore/semaphore.yml +++ b/.semaphore/semaphore.yml @@ -47,11 +47,13 @@ blocks: values: - .ci/validation.sh all-sevntu-checks - .ci/validation.sh check-missing-pitests - - .ci/validation.sh eclipse-static-analysis + # until https://github.com/checkstyle/checkstyle/issues/13209 + # - .ci/validation.sh eclipse-static-analysis - .ci/validation.sh verify-regexp-id - .ci/no-exception-test.sh guava-with-google-checks - .ci/no-exception-test.sh guava-with-sun-checks - - .ci/no-exception-test.sh no-exception-samples-ant + # until https://github.com/checkstyle/checkstyle/issues/14086 + # - .ci/no-exception-test.sh no-exception-samples-ant - .ci/validation.sh nondex # until https://github.com/checkstyle/checkstyle/issues/9807 # - mvn -e --no-transfer-progress clean package -Passembly,no-validations diff --git a/README.md b/README.md index cba86025761..2b36b088fa7 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,7 @@ or set of validation rules (best practices). [![][milestone img]][milestone] -Members chat: [![][gitter_mem img]][gitter_mem] -Contributors chat: [![][gitter_con img]][gitter_con] +Contributors chat: [![][matrix_con img]][matrix_con] The latest release version can be found at [GitHub releases](https://github.com/checkstyle/checkstyle/releases/) @@ -37,7 +36,7 @@ or at [Maven repo](https://repo1.maven.org/maven2/com/puppycrawl/tools/checkstyl Each-commit builds of maven artifacts can be found at [Maven Snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/com/puppycrawl/tools/checkstyle/). -Documentation is available in HTML format, see https://checkstyle.org/checks.html. +Documentation is available in HTML format, see https://checkstyle.org/checks.html . ## Build instructions and Contribution @@ -73,8 +72,6 @@ Bugs and Feature requests (not the questions): https://github.com/checkstyle/che If you want to speed up fixing of issue and want to encourage somebody in internet to resolve any issue: -[![][bountysource img]][bountysource] -[![][salt.bountysource img]][salt.bountysource] [![][flattr img]][flattr] [![][liberapay img]][liberapay] [![][backers.opencollective img]][backers.opencollective] @@ -128,11 +125,8 @@ are in the file named "LICENSE.apache20" in this directory. [mavenbadge]:https://search.maven.org/search?q=g:%22com.puppycrawl.tools%22%20AND%20a:%22checkstyle%22 [mavenbadge img]:https://img.shields.io/maven-central/v/com.puppycrawl.tools/checkstyle.svg?label=Maven%20Central -[gitter_mem]:https://gitter.im/checkstyle -[gitter_mem img]:https://img.shields.io/badge/gitter-JOIN%20CHAT-blue.svg - -[gitter_con]:https://gitter.im/checkstyle/checkstyle -[gitter_con img]:https://badges.gitter.im/Join%20Chat.svg +[matrix_con]:https://app.element.io/#/room/#checkstyle_checkstyle:gitter.im +[matrix_con img]:https://matrix.to/img/matrix-badge.svg [stackoverflow]:https://stackoverflow.com/questions/tagged/checkstyle [stackoverflow img]:https://img.shields.io/badge/stackoverflow-CHECKSTYLE-blue.svg @@ -161,12 +155,6 @@ are in the file named "LICENSE.apache20" in this directory. [liberapay]:https://liberapay.com/checkstyle/ [liberapay img]:https://liberapay.com/assets/widgets/donate.svg -[bountysource]:https://www.bountysource.com/teams/checkstyle/issues -[bountysource img]:https://api.bountysource.com/badge/team?team_id=3568&style=bounties_posted - -[salt.bountysource]:https://salt.bountysource.com/teams/checkstyle -[salt.bountysource img]:https://img.shields.io/bountysource/team/checkstyle/activity.svg?label=salt.bountysource - [backers.opencollective]:https://opencollective.com/checkstyle/ [backers.opencollective img]:https://opencollective.com/checkstyle/backers/badge.svg diff --git a/appveyor.yml b/appveyor.yml index ef00cdd8c29..2083d0a9bed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,21 +11,21 @@ branches: install: - ps: | Add-Type -AssemblyName System.IO.Compression.FileSystem - if (!(Test-Path -Path "C:\maven\apache-maven-3.8.6" )) { + if (!(Test-Path -Path "C:\maven\apache-maven-3.8.8" )) { (new-object System.Net.WebClient).DownloadFile( - 'https://downloads.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip', + 'https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.zip', 'C:\maven-bin.zip' ) [System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven") } - - cmd: SET M2_HOME=C:\maven\apache-maven-3.8.6 + - cmd: SET M2_HOME=C:\maven\apache-maven-3.8.8 - cmd: SET PATH=%M2_HOME%\bin;%JAVA_HOME%\bin;%PATH% - cmd: git config core.autocrlf - cmd: mvn --version - cmd: java -version cache: - - C:\maven\apache-maven-3.8.6 + - C:\maven\apache-maven-3.8.8 - C:\Users\appveyor\.m2 matrix: @@ -70,6 +70,7 @@ build_script: } else { Write-Host "build is skipped ..." } + - ps: ./.ci/validation.cmd git_diff - ps: echo "Size of caches (bytes):" - - ps: Get-ChildItem -Recurse 'C:\maven\apache-maven-3.8.6' | Measure-Object -Property Length -Sum + - ps: Get-ChildItem -Recurse 'C:\maven\apache-maven-3.8.8' | Measure-Object -Property Length -Sum - ps: Get-ChildItem -Recurse 'C:\Users\appveyor\.m2' | Measure-Object -Property Length -Sum diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f7ed1fce390..663e4f5a7ff 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -80,6 +80,11 @@ strategy: image: 'ubuntu-20.04' cmd: "./.ci/validation.sh test-ru" + # unit tests in Albanian locale (openjdk11) + 'test-al': + image: 'ubuntu-20.04' + cmd: "./.ci/validation.sh test-al" + # OpenJDK11 verify 'OpenJDK11 verify': image: 'ubuntu-20.04' @@ -87,12 +92,12 @@ strategy: # MacOS JDK11 verify 'MacOS JDK11 verify': - image: 'macOS-11' + image: 'macOS-12' cmd: "JAVA_HOME=$JAVA_HOME_11_X64 mvn -e --no-transfer-progress verify" # MacOS JDK17 verify 'MacOS JDK17 verify': - image: 'macOS-11' + image: 'macOS-12' cmd: "JAVA_HOME=$JAVA_HOME_17_X64 mvn -e --no-transfer-progress verify" # moved back to Travis till we find a way to keep secrets in azure @@ -111,7 +116,7 @@ strategy: # lint for .md files, OSX is used because there is problem to install gem on linux 'markdownlint': - image: 'macOS-11' + image: 'macOS-12' cmd: "./.ci/validation.sh markdownlint" skipCache: true needMdl: true @@ -160,6 +165,7 @@ steps: - bash: | set -e + mvn --version echo "ON_CRON_ONLY:"$ON_CRON_ONLY echo "BUILD_REASON:"$BUILD_REASON echo "cmd: "$(cmd) diff --git a/cdg-pitest-licence.txt b/cdg-pitest-licence.txt index 65a31ebc5d3..62cdb43ba32 100644 --- a/cdg-pitest-licence.txt +++ b/cdg-pitest-licence.txt @@ -1,7 +1,7 @@ #Licence file for pitest extensions -#Mon Jun 13 09:05:28 BST 2022 -expires=13/06/2024 +#Sun Jul 14 10:23:06 BST 2024 +expires=14/07/2027 keyVersion=1 -signature=K7Oqt8FQtO/RZfNf0Z4VMwg9iS9bGJUGD7qfr4NsQOtmRIm0Fwm+xOiKiACYxCPQwloB1+iw6YIpBPT+wGtT9eB0n59nAoYQyq65Gmu3D8Vr3hIKAG7saWjpRbt4l+LzpLDyImKtR+dIVxadZlTB/qpTjuZ2InTd2AwiR03Ti+A\= packages=com.puppycrawl.tools.checkstyle.* +signature=Ls/M9iIyyhZMIneDBFLvafXWNzQxDW0BZb7flHoRpETrI16BU417Vyxg3Wi2wjItk9bhjf2pAQttctSH7XBE4MM3qtxr9VUZWljPjF1Mxn9REzWqs+Uj2SZ/ZLntA2nWURtM+/3XGudKequ6r3kDmtdcpSPg3WNffEjEGTkWtIo\= type=OSSS diff --git a/config/ant-phase-verify.xml b/config/ant-phase-verify.xml index 818b84cbaeb..84903357b41 100644 --- a/config/ant-phase-verify.xml +++ b/config/ant-phase-verify.xml @@ -53,6 +53,8 @@ file="config/suppressions.xml"/> + @@ -166,7 +168,10 @@ - + + + + @@ -203,6 +208,10 @@ + + + + diff --git a/config/archunit-store/slices-should-be-free-of-cycles-suppressions b/config/archunit-store/slices-should-be-free-of-cycles-suppressions deleted file mode 100644 index ba3cc3e48a9..00000000000 --- a/config/archunit-store/slices-should-be-free-of-cycles-suppressions +++ /dev/null @@ -1,1494 +0,0 @@ -Cycle detected: Slice api -> \ - Slice utils -> \ - Slice api\ - 1. Dependencies of Slice api\ - - Method calls method in (AbstractFileSetCheck.java:97)\ - - Constructor (java.io.File, java.util.List)> gets field in (FileText.java:133)\ - - Method calls method in (AbstractFileSetCheck.java:177)\ - - Constructor (java.io.File, java.lang.String)> gets field in (FileText.java:180)\ - - Method calls method in (AbstractFileSetCheck.java:230)\ - - Method calls method in (FileContents.java:234)\ - - Method calls method in (AbstractCheck.java:245)\ - - Method calls method in (AbstractCheck.java:275)\ - 2. Dependencies of Slice utils\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has generic parameter type > with type argument depending on in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has return type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has return type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has return type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (AnnotationUtil.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has return type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has return type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method has parameter of type in (BlockCommentPosition.java:0)\ - - Method throws type in (ChainedPropertyUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has return type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has generic return type > with type argument depending on in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method has parameter of type in (CheckUtil.java:0)\ - - Method throws type in (CommonUtil.java:0)\ - - Method throws type in (CommonUtil.java:0)\ - - Method throws type in (CommonUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has return type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has return type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has return type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has return type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has return type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has parameter of type in (JavadocUtil.java:0)\ - - Method has return type in (ParserUtil.java:0)\ - - Method has return type in (ParserUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has return type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has return type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has return type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has return type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has return type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (ScopeUtil.java:0)\ - - Method has parameter of type in (TokenUtil.java:0)\ - - Method has generic parameter type > with type argument depending on in (TokenUtil.java:0)\ - - Method has generic return type > with type argument depending on in (TokenUtil.java:0)\ - - Method has parameter of type in (TokenUtil.java:0)\ - - Method has generic parameter type > with type argument depending on in (TokenUtil.java:0)\ - - Method has parameter of type in (TokenUtil.java:0)\ - - Method has parameter of type in (TokenUtil.java:0)\ - - Method has parameter of type in (TokenUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method throws type in (XpathUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method calls method in (ScopeUtil.java:47)\ - - Method calls method in (ScopeUtil.java:48)\ - - Method calls method in (ScopeUtil.java:49)\ - - Method gets field in (ScopeUtil.java:51)\ - - Method gets field in (ScopeUtil.java:54)\ - - Method gets field in (ScopeUtil.java:57)\ - - Static Initializer ()> references class object in (TokenUtil.java:60)\ - - Method calls method in (ScopeUtil.java:73)\ - - Static Initializer ()> references class object in (JavadocUtil.java:79)\ - - Method calls method in (BlockCommentPosition.java:85)\ - - Method calls method in (BlockCommentPosition.java:88)\ - - Method calls method in (ScopeUtil.java:88)\ - - Method calls method in (BlockCommentPosition.java:89)\ - - Method calls method in (AnnotationUtil.java:92)\ - - Method calls method in (BlockCommentPosition.java:92)\ - - Method calls method in (CheckUtil.java:95)\ - - Method calls method in (CheckUtil.java:96)\ - - Method calls constructor (java.lang.String)> in (ChainedPropertyUtil.java:98)\ - - Method calls method in (CheckUtil.java:98)\ - - Method calls method in (CheckUtil.java:99)\ - - Method calls method in (CheckUtil.java:102)\ - - Method calls method in (JavadocUtil.java:102)\ - - Method calls method in (CheckUtil.java:103)\ - - Method calls method in (CheckUtil.java:107)\ - - Method calls method in (JavadocUtil.java:107)\ - - Method calls method in (ScopeUtil.java:107)\ - - Method calls method in (CheckUtil.java:108)\ - - Method references class object in (ModuleReflectionUtil.java:108)\ - - Method gets field in (ScopeUtil.java:108)\ - - Method calls method in (ScopeUtil.java:110)\ - - Method gets field in (ScopeUtil.java:111)\ - - Method calls method in (JavadocUtil.java:114)\ - - Method gets field in (ScopeUtil.java:114)\ - - Method gets field in (ScopeUtil.java:118)\ - - Method calls method in (JavadocUtil.java:119)\ - - Method calls method in (JavadocUtil.java:119)\ - - Method references class object in (ModuleReflectionUtil.java:119)\ - - Method gets field in (ScopeUtil.java:121)\ - - Method references class object in (ModuleReflectionUtil.java:130)\ - - Method calls method in (AnnotationUtil.java:132)\ - - Method calls method in (ScopeUtil.java:134)\ - - Method calls method in (ScopeUtil.java:136)\ - - Method calls method in (AnnotationUtil.java:137)\ - - Method calls method in (ScopeUtil.java:137)\ - - Method calls method in (AnnotationUtil.java:138)\ - - Method calls method in (AnnotationUtil.java:138)\ - - Method calls method in (ScopeUtil.java:140)\ - - Method calls method in (AnnotationUtil.java:141)\ - - Method references class object in (ModuleReflectionUtil.java:141)\ - - Method gets field in (ScopeUtil.java:145)\ - - Method calls method in (XpathUtil.java:145)\ - - Method references class object in (ModuleReflectionUtil.java:152)\ - - Method calls method in (XpathUtil.java:157)\ - - Method references class object in (ModuleReflectionUtil.java:163)\ - - Method calls method in (XpathUtil.java:167)\ - - Method calls method in (XpathUtil.java:168)\ - - Method calls method in (BlockCommentPosition.java:171)\ - - Method calls method in (BlockCommentPosition.java:172)\ - - Method calls method in (JavadocUtil.java:173)\ - - Method calls method in (BlockCommentPosition.java:174)\ - - Method calls method in (JavadocUtil.java:174)\ - - Method calls method in (AnnotationUtil.java:175)\ - - Method calls method in (BlockCommentPosition.java:175)\ - - Method calls method in (BlockCommentPosition.java:175)\ - - Method calls method in (AnnotationUtil.java:176)\ - - Method calls method in (AnnotationUtil.java:177)\ - - Method calls method in (AnnotationUtil.java:180)\ - - Method calls method in (JavadocUtil.java:185)\ - - Method calls method in (JavadocUtil.java:186)\ - - Method calls constructor (java.lang.String, java.lang.Throwable)> in (XpathUtil.java:198)\ - - Method calls method in (JavadocUtil.java:202)\ - - Method calls method in (ScopeUtil.java:205)\ - - Method calls method in (CheckUtil.java:207)\ - - Method calls method in (ScopeUtil.java:207)\ - - Method calls method in (ScopeUtil.java:208)\ - - Method calls method in (BlockCommentPosition.java:210)\ - - Method calls method in (ScopeUtil.java:211)\ - - Method calls method in (BlockCommentPosition.java:212)\ - - Method calls method in (ScopeUtil.java:212)\ - - Method calls method in (CheckUtil.java:213)\ - - Method calls method in (BlockCommentPosition.java:214)\ - - Method calls method in (BlockCommentPosition.java:214)\ - - Method calls method in (BlockCommentPosition.java:218)\ - - Method calls method in (BlockCommentPosition.java:219)\ - - Method calls method in (BlockCommentPosition.java:219)\ - - Method calls method in (JavadocUtil.java:220)\ - - Method calls method in (JavadocUtil.java:221)\ - - Method calls method in (AnnotationUtil.java:224)\ - - Method calls method in (TokenUtil.java:224)\ - - Method calls method in (TokenUtil.java:224)\ - - Method calls method in (AnnotationUtil.java:226)\ - - Method calls method in (AnnotationUtil.java:226)\ - - Method calls method in (AnnotationUtil.java:226)\ - - Method calls method in (CheckUtil.java:227)\ - - Method calls method in (CheckUtil.java:229)\ - - Method calls method in (JavadocUtil.java:234)\ - - Method calls method in (JavadocUtil.java:236)\ - - Method calls method in (JavadocUtil.java:237)\ - - Method calls method in (CheckUtil.java:240)\ - - Method calls method in (ScopeUtil.java:242)\ - - Method calls method in (TokenUtil.java:242)\ - - Method calls method in (TokenUtil.java:242)\ - - Method calls method in (ScopeUtil.java:243)\ - - Method calls method in (TokenUtil.java:243)\ - - Method calls method in (CheckUtil.java:245)\ - - Method calls method in (CheckUtil.java:247)\ - - Method calls method in (CheckUtil.java:247)\ - - Method calls method in (ScopeUtil.java:247)\ - - Method calls method in (BlockCommentPosition.java:248)\ - - Method calls method in (BlockCommentPosition.java:248)\ - - Method calls method in (AnnotationUtil.java:249)\ - - Method calls method in (BlockCommentPosition.java:249)\ - - Method calls method in (CheckUtil.java:249)\ - - Method calls method in (AnnotationUtil.java:250)\ - - Method calls method in (BlockCommentPosition.java:250)\ - - Method calls method in (AnnotationUtil.java:251)\ - - Method calls method in (CheckUtil.java:251)\ - - Method calls method in (CheckUtil.java:253)\ - - Method calls method in (CheckUtil.java:253)\ - - Method calls method in (JavadocUtil.java:254)\ - - Method calls method in (CheckUtil.java:255)\ - - Method calls method in (TokenUtil.java:258)\ - - Method calls method in (BlockCommentPosition.java:261)\ - - Method calls method in (BlockCommentPosition.java:261)\ - - Method calls method in (BlockCommentPosition.java:262)\ - - Method calls method in (BlockCommentPosition.java:262)\ - - Method calls method in (JavadocUtil.java:268)\ - - Method calls method in (CheckUtil.java:270)\ - - Method calls method in (JavadocUtil.java:270)\ - - Method calls method in (JavadocUtil.java:271)\ - - Method calls method in (BlockCommentPosition.java:274)\ - - Method calls method in (BlockCommentPosition.java:274)\ - - Method calls method in (ScopeUtil.java:274)\ - - Method calls method in (BlockCommentPosition.java:275)\ - - Method calls method in (CheckUtil.java:275)\ - - Method calls method in (BlockCommentPosition.java:276)\ - - Method calls method in (BlockCommentPosition.java:276)\ - - Method calls method in (ScopeUtil.java:276)\ - - Method calls method in (CheckUtil.java:278)\ - - Method calls method in (CheckUtil.java:280)\ - - Method calls method in (CheckUtil.java:283)\ - - Method calls method in (BlockCommentPosition.java:288)\ - - Method calls method in (BlockCommentPosition.java:290)\ - - Method calls method in (BlockCommentPosition.java:291)\ - - Method calls method in (BlockCommentPosition.java:293)\ - - Method calls method in (BlockCommentPosition.java:294)\ - - Method calls method in (ScopeUtil.java:294)\ - - Method calls method in (BlockCommentPosition.java:295)\ - - Method calls method in (BlockCommentPosition.java:295)\ - - Method calls method in (ScopeUtil.java:296)\ - - Method calls method in (BlockCommentPosition.java:297)\ - - Method calls method in (BlockCommentPosition.java:297)\ - - Method calls method in (ScopeUtil.java:297)\ - - Method calls method in (BlockCommentPosition.java:298)\ - - Method calls method in (BlockCommentPosition.java:298)\ - - Method calls method in (CheckUtil.java:302)\ - - Method calls method in (CheckUtil.java:303)\ - - Method calls method in (CheckUtil.java:304)\ - - Method calls method in (CheckUtil.java:305)\ - - Method calls method in (CheckUtil.java:305)\ - - Method calls method in (TokenUtil.java:305)\ - - Method calls method in (CheckUtil.java:308)\ - - Method calls method in (BlockCommentPosition.java:309)\ - - Method calls method in (CheckUtil.java:309)\ - - Method calls method in (BlockCommentPosition.java:310)\ - - Method calls method in (BlockCommentPosition.java:311)\ - - Method calls method in (CheckUtil.java:316)\ - - Method calls method in (TokenUtil.java:316)\ - - Method calls method in (JavadocUtil.java:317)\ - - Method calls method in (ScopeUtil.java:317)\ - - Method calls method in (CheckUtil.java:318)\ - - Method calls method in (ScopeUtil.java:318)\ - - Method calls method in (CheckUtil.java:319)\ - - Method calls method in (JavadocUtil.java:319)\ - - Method calls method in (CheckUtil.java:320)\ - - Method calls method in (CheckUtil.java:320)\ - - Method calls method in (JavadocUtil.java:322)\ - - Method calls method in (BlockCommentPosition.java:323)\ - - Method calls method in (ScopeUtil.java:323)\ - - Method calls method in (ScopeUtil.java:324)\ - - Method calls method in (BlockCommentPosition.java:325)\ - - Method calls method in (BlockCommentPosition.java:326)\ - - Method calls method in (BlockCommentPosition.java:327)\ - - Method calls method in (ScopeUtil.java:328)\ - - Method calls method in (ScopeUtil.java:329)\ - - Method calls method in (ScopeUtil.java:330)\ - - Method calls method in (CheckUtil.java:339)\ - - Method calls method in (CheckUtil.java:340)\ - - Method calls method in (CheckUtil.java:341)\ - - Method calls method in (CheckUtil.java:342)\ - - Method calls method in (CheckUtil.java:342)\ - - Method calls method in (CheckUtil.java:345)\ - - Method calls method in (CheckUtil.java:346)\ - - Method calls method in (ScopeUtil.java:349)\ - - Method calls method in (CheckUtil.java:352)\ - - Method calls method in (CheckUtil.java:354)\ - - Method calls method in (CheckUtil.java:355)\ - - Method calls method in (CheckUtil.java:356)\ - - Method calls method in (JavadocUtil.java:356)\ - - Method calls method in (JavadocUtil.java:358)\ - - Method calls method in (JavadocUtil.java:363)\ - - Method calls method in (JavadocUtil.java:365)\ - - Method calls method in (JavadocUtil.java:366)\ - - Method calls method in (CheckUtil.java:371)\ - - Method calls method in (CheckUtil.java:372)\ - - Method calls method in (CheckUtil.java:373)\ - - Method calls method in (CheckUtil.java:387)\ - - Method calls method in (CheckUtil.java:388)\ - - Method calls method in (CheckUtil.java:400)\ - - Method calls method in (CheckUtil.java:405)\ - - Method calls method in (CheckUtil.java:431)\ - - Method calls method in (CheckUtil.java:432)\ - - Method calls method in (CheckUtil.java:433)\ - - Method calls method in (CheckUtil.java:457)\ - - Method calls method in (CheckUtil.java:458)\ - - Method calls constructor (java.lang.String)> in (CommonUtil.java:462)\ - - Method calls constructor (java.lang.String, java.lang.Throwable)> in (CommonUtil.java:470)\ - - Method calls method in (CheckUtil.java:619)\ - - Method calls method in (CheckUtil.java:619)\ - - Method calls method in (CheckUtil.java:636)\ - - Method calls method in (CheckUtil.java:638) -Cycle detected: Slice api -> \ - Slice utils -> \ - Slice checks.javadoc -> \ - Slice api\ - 1. Dependencies of Slice api\ - - Method calls method in (AbstractFileSetCheck.java:97)\ - - Constructor (java.io.File, java.util.List)> gets field in (FileText.java:133)\ - - Method calls method in (AbstractFileSetCheck.java:177)\ - - Constructor (java.io.File, java.lang.String)> gets field in (FileText.java:180)\ - - Method calls method in (AbstractFileSetCheck.java:230)\ - - Method calls method in (FileContents.java:234)\ - - Method calls method in (AbstractCheck.java:245)\ - - Method calls method in (AbstractCheck.java:275)\ - 2. Dependencies of Slice utils\ - - Method has return type in (JavadocUtil.java:0)\ - - Method calls method in (JavadocUtil.java:121)\ - - Method calls constructor (int, int, java.lang.String, java.lang.String)> in (JavadocUtil.java:123)\ - - Method calls constructor (int, int, java.lang.String)> in (JavadocUtil.java:126)\ - - Method calls constructor (java.util.Collection, java.util.Collection)> in (JavadocUtil.java:130)\ - 3. Dependencies of Slice checks.javadoc\ - - Class extends class in (AbstractJavadocCheck.java:0)\ - - Class extends class in (InvalidJavadocPositionCheck.java:0)\ - - Class extends class in (JavadocContentLocationCheck.java:0)\ - - Class extends class in (JavadocMethodCheck.java:0)\ - - Class implements interface in (JavadocNodeImpl.java:0)\ - - Class extends class in (JavadocPackageCheck.java:0)\ - - Class extends class in (JavadocStyleCheck.java:0)\ - - Class extends class in (JavadocTypeCheck.java:0)\ - - Class extends class in (JavadocVariableCheck.java:0)\ - - Class extends class in (MissingJavadocMethodCheck.java:0)\ - - Class extends class in (MissingJavadocPackageCheck.java:0)\ - - Class extends class in (MissingJavadocTypeCheck.java:0)\ - - Class extends class in (WriteTagCheck.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.DetailAST, com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck$ClassInfo)> has parameter of type in (JavadocMethodCheck.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.FullIdent)> has parameter of type in (JavadocMethodCheck.java:0)\ - - Field has type in (AbstractJavadocCheck.java:0)\ - - Field has generic type >> with type argument depending on in (AbstractJavadocCheck.java:0)\ - - Field has type in (JavadocMethodCheck.java:0)\ - - Field depends on component type in (JavadocNodeImpl.java:0)\ - - Field has type in (JavadocNodeImpl.java:0)\ - - Field has type in (JavadocStyleCheck.java:0)\ - - Field has type in (JavadocStyleCheck.java:0)\ - - Field has type in (JavadocTypeCheck.java:0)\ - - Field has type in (JavadocTypeCheck.java:0)\ - - Field has type in (JavadocVariableCheck.java:0)\ - - Field has type in (JavadocVariableCheck.java:0)\ - - Field has type in (MissingJavadocMethodCheck.java:0)\ - - Field has type in (MissingJavadocMethodCheck.java:0)\ - - Field has type in (MissingJavadocTypeCheck.java:0)\ - - Field has type in (MissingJavadocTypeCheck.java:0)\ - - Field has type in (WriteTagCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has return type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AbstractJavadocCheck.java:0)\ - - Method has parameter of type in (AtclauseOrderCheck.java:0)\ - - Method has parameter of type in (AtclauseOrderCheck.java:0)\ - - Method has parameter of type in (AtclauseOrderCheck.java:0)\ - - Method has parameter of type in (InvalidJavadocPositionCheck.java:0)\ - - Method has parameter of type in (JavadocBlockTagLocationCheck.java:0)\ - - Method has parameter of type in (JavadocBlockTagLocationCheck.java:0)\ - - Method has parameter of type in (JavadocContentLocationCheck.java:0)\ - - Method has parameter of type in (JavadocContentLocationCheck.java:0)\ - - Method has return type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has generic return type > with type argument depending on in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has return type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has generic return type > with type argument depending on in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has generic parameter type > with type argument depending on in (JavadocMethodCheck.java:0)\ - - Method has generic parameter type > with type argument depending on in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMethodCheck.java:0)\ - - Method has parameter of type in (JavadocMissingLeadingAsteriskCheck.java:0)\ - - Method has return type in (JavadocMissingLeadingAsteriskCheck.java:0)\ - - Method has parameter of type in (JavadocMissingLeadingAsteriskCheck.java:0)\ - - Method has parameter of type in (JavadocMissingLeadingAsteriskCheck.java:0)\ - - Method has parameter of type in (JavadocMissingLeadingAsteriskCheck.java:0)\ - - Method has parameter of type in (JavadocMissingWhitespaceAfterAsteriskCheck.java:0)\ - - Method depends on component type in (JavadocNodeImpl.java:0)\ - - Method has return type in (JavadocNodeImpl.java:0)\ - - Method depends on component type in (JavadocNodeImpl.java:0)\ - - Method has parameter of type in (JavadocNodeImpl.java:0)\ - - Method has parameter of type in (JavadocPackageCheck.java:0)\ - - Method throws type in (JavadocPackageCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has return type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has return type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocParagraphCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has parameter of type in (JavadocStyleCheck.java:0)\ - - Method has generic return type > with type argument depending on in (JavadocTagContinuationIndentationCheck.java:0)\ - - Method has parameter of type in (JavadocTagContinuationIndentationCheck.java:0)\ - - Method has parameter of type in (JavadocTagContinuationIndentationCheck.java:0)\ - - Method has parameter of type in (JavadocTagContinuationIndentationCheck.java:0)\ - - Method has parameter of type in (JavadocTagContinuationIndentationCheck.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTagInfo.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocTypeCheck.java:0)\ - - Method has parameter of type in (JavadocVariableCheck.java:0)\ - - Method has parameter of type in (JavadocVariableCheck.java:0)\ - - Method has parameter of type in (JavadocVariableCheck.java:0)\ - - Method has parameter of type in (JavadocVariableCheck.java:0)\ - - Method has parameter of type in (JavadocVariableCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocMethodCheck.java:0)\ - - Method has parameter of type in (MissingJavadocPackageCheck.java:0)\ - - Method has parameter of type in (MissingJavadocPackageCheck.java:0)\ - - Method has parameter of type in (MissingJavadocPackageCheck.java:0)\ - - Method has parameter of type in (MissingJavadocPackageCheck.java:0)\ - - Method has parameter of type in (MissingJavadocTypeCheck.java:0)\ - - Method has parameter of type in (MissingJavadocTypeCheck.java:0)\ - - Method has parameter of type in (MissingJavadocTypeCheck.java:0)\ - - Method has parameter of type in (MissingJavadocTypeCheck.java:0)\ - - Method has parameter of type in (NonEmptyAtclauseDescriptionCheck.java:0)\ - - Method has parameter of type in (NonEmptyAtclauseDescriptionCheck.java:0)\ - - Method has parameter of type in (NonEmptyAtclauseDescriptionCheck.java:0)\ - - Method has parameter of type in (RequireEmptyLineBeforeBlockTagGroupCheck.java:0)\ - - Method has parameter of type in (RequireEmptyLineBeforeBlockTagGroupCheck.java:0)\ - - Method has parameter of type in (RequireEmptyLineBeforeBlockTagGroupCheck.java:0)\ - - Method has parameter of type in (RequireEmptyLineBeforeBlockTagGroupCheck.java:0)\ - - Method has parameter of type in (SingleLineJavadocCheck.java:0)\ - - Method has parameter of type in (SingleLineJavadocCheck.java:0)\ - - Method has parameter of type in (SingleLineJavadocCheck.java:0)\ - - Method has parameter of type in (SingleLineJavadocCheck.java:0)\ - - Method has parameter of type in (SingleLineJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has generic return type > with type argument depending on in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has return type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (SummaryJavadocCheck.java:0)\ - - Method has parameter of type in (WriteTagCheck.java:0)\ - - Method has parameter of type in (WriteTagCheck.java:0)\ - - Constructor ()> calls constructor ()> in (AbstractJavadocCheck.java:50)\ - - Constructor ()> calls constructor ()> in (InvalidJavadocPositionCheck.java:72)\ - - Method calls method in (JavadocTagInfo.java:76)\ - - Constructor ()> calls constructor ()> in (MissingJavadocPackageCheck.java:78)\ - - Method calls method in (JavadocTagInfo.java:90)\ - - Method calls method in (JavadocTagInfo.java:104)\ - - Constructor ()> calls constructor ()> in (JavadocPackageCheck.java:109)\ - - Method calls method in (JavadocTagInfo.java:118)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:120)\ - - Method calls constructor (java.lang.String, java.lang.Throwable)> in (JavadocPackageCheck.java:124)\ - - Method calls method in (MissingJavadocPackageCheck.java:124)\ - - Method calls method in (MissingJavadocPackageCheck.java:125)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:127)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:128)\ - - Method calls method in (JavadocTagInfo.java:132)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:133)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:133)\ - - Method calls method in (MissingJavadocPackageCheck.java:136)\ - - Method references method in (MissingJavadocPackageCheck.java:136)\ - - Method references method in (MissingJavadocPackageCheck.java:137)\ - - Method calls method in (MissingJavadocPackageCheck.java:142)\ - - Method calls method in (JavadocTagInfo.java:145)\ - - Method calls method in (JavadocTagInfo.java:148)\ - - Method calls method in (JavadocTagInfo.java:149)\ - - Method gets field in (JavadocTagInfo.java:150)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:151)\ - - Constructor ()> calls constructor ()> in (JavadocContentLocationCheck.java:155)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:157)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:157)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:158)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:158)\ - - Method calls method in (MissingJavadocPackageCheck.java:159)\ - - Method calls method in (JavadocTagInfo.java:162)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:163)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:165)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:165)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:174)\ - - Method calls method in (JavadocTagInfo.java:176)\ - - Constructor ()> calls constructor ()> in (JavadocVariableCheck.java:177)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:179)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:179)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:180)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:183)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:184)\ - - Constructor ()> calls constructor ()> in (MissingJavadocTypeCheck.java:185)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:185)\ - - Constructor ()> calls constructor ()> in (WriteTagCheck.java:186)\ - - Constructor ()> gets field in (JavadocVariableCheck.java:187)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:189)\ - - Method calls method in (JavadocTagInfo.java:190)\ - - Constructor ()> gets field in (MissingJavadocTypeCheck.java:194)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:198)\ - - Method calls method in (JavadocParagraphCheck.java:200)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:201)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:202)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:202)\ - - Method calls method in (JavadocParagraphCheck.java:203)\ - - Method calls method in (JavadocParagraphCheck.java:204)\ - - Method calls method in (JavadocTagInfo.java:204)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:208)\ - - Constructor ()> gets field in (WriteTagCheck.java:215)\ - - Method calls method in (JavadocParagraphCheck.java:216)\ - - Method calls method in (JavadocParagraphCheck.java:217)\ - - Method calls method in (JavadocParagraphCheck.java:218)\ - - Method calls method in (JavadocTagInfo.java:220)\ - - Method calls method in (JavadocTagInfo.java:221)\ - - Method calls method in (JavadocTagInfo.java:224)\ - - Method calls method in (JavadocTagInfo.java:224)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:225)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:229)\ - - Method calls method in (JavadocParagraphCheck.java:230)\ - - Method calls method in (JavadocContentLocationCheck.java:232)\ - - Method calls method in (JavadocParagraphCheck.java:232)\ - - Method calls method in (JavadocBlockTagLocationCheck.java:233)\ - - Method calls method in (JavadocParagraphCheck.java:233)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:233)\ - - Method calls method in (JavadocBlockTagLocationCheck.java:234)\ - - Method calls method in (JavadocParagraphCheck.java:236)\ - - Method calls method in (JavadocTagInfo.java:236)\ - - Method calls method in (JavadocBlockTagLocationCheck.java:238)\ - - Method calls method in (AtclauseOrderCheck.java:241)\ - - Method calls method in (AtclauseOrderCheck.java:242)\ - - Method calls method in (AtclauseOrderCheck.java:243)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:247)\ - - Method calls method in (AtclauseOrderCheck.java:248)\ - - Method calls method in (JavadocParagraphCheck.java:248)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:248)\ - - Method calls method in (JavadocParagraphCheck.java:249)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:249)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:249)\ - - Method calls method in (JavadocTagInfo.java:250)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:250)\ - - Method calls method in (JavadocBlockTagLocationCheck.java:251)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:251)\ - - Method calls method in (JavadocBlockTagLocationCheck.java:252)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:255)\ - - Method calls method in (JavadocVariableCheck.java:256)\ - - Method calls method in (JavadocVariableCheck.java:256)\ - - Constructor ()> calls constructor ()> in (MissingJavadocMethodCheck.java:264)\ - - Method calls method in (MissingJavadocTypeCheck.java:264)\ - - Method calls method in (AtclauseOrderCheck.java:265)\ - - Method calls method in (JavadocParagraphCheck.java:265)\ - - Method calls method in (JavadocParagraphCheck.java:265)\ - - Method calls method in (JavadocTagInfo.java:265)\ - - Method calls method in (MissingJavadocTypeCheck.java:265)\ - - Method calls method in (AtclauseOrderCheck.java:266)\ - - Method calls method in (JavadocParagraphCheck.java:266)\ - - Method calls method in (JavadocTagInfo.java:266)\ - - Method calls method in (JavadocParagraphCheck.java:267)\ - - Method calls method in (JavadocTagInfo.java:267)\ - - Method calls method in (AtclauseOrderCheck.java:268)\ - - Method calls method in (AtclauseOrderCheck.java:268)\ - - Method calls method in (AtclauseOrderCheck.java:270)\ - - Method calls method in (AtclauseOrderCheck.java:271)\ - - Method calls method in (AtclauseOrderCheck.java:271)\ - - Method calls method in (JavadocParagraphCheck.java:271)\ - - Method calls method in (JavadocVariableCheck.java:271)\ - - Method calls method in (JavadocVariableCheck.java:271)\ - - Method calls method in (AtclauseOrderCheck.java:272)\ - - Method calls method in (AtclauseOrderCheck.java:272)\ - - Constructor ()> gets field in (MissingJavadocMethodCheck.java:276)\ - - Method calls method in (MissingJavadocTypeCheck.java:282)\ - - Method calls method in (MissingJavadocTypeCheck.java:283)\ - - Method calls method in (MissingJavadocTypeCheck.java:285)\ - - Method calls method in (JavadocParagraphCheck.java:286)\ - - Method calls method in (WriteTagCheck.java:286)\ - - Method calls method in (JavadocParagraphCheck.java:287)\ - - Method calls method in (JavadocTagInfo.java:287)\ - - Method calls method in (JavadocVariableCheck.java:287)\ - - Method calls method in (MissingJavadocTypeCheck.java:287)\ - - Method calls method in (JavadocParagraphCheck.java:288)\ - - Method calls method in (JavadocTagInfo.java:288)\ - - Method calls method in (WriteTagCheck.java:288)\ - - Method calls method in (JavadocParagraphCheck.java:289)\ - - Method calls method in (JavadocVariableCheck.java:289)\ - - Method calls method in (JavadocParagraphCheck.java:290)\ - - Method calls method in (JavadocVariableCheck.java:290)\ - - Method calls method in (JavadocTagInfo.java:291)\ - - Method calls method in (JavadocTagInfo.java:291)\ - - Method calls method in (JavadocTagInfo.java:292)\ - - Method calls method in (JavadocTagInfo.java:292)\ - - Method calls method in (WriteTagCheck.java:293)\ - - Constructor ()> calls constructor ()> in (JavadocStyleCheck.java:300)\ - - Method calls method in (JavadocTagInfo.java:304)\ - - Method calls method in (SingleLineJavadocCheck.java:307)\ - - Method calls method in (AbstractJavadocCheck.java:308)\ - - Method calls constructor (int, int)> in (AbstractJavadocCheck.java:309)\ - - Method calls method in (AbstractJavadocCheck.java:309)\ - - Method calls method in (JavadocParagraphCheck.java:309)\ - - Method calls method in (JavadocTagInfo.java:318)\ - - Method calls method in (SingleLineJavadocCheck.java:318)\ - - Method calls method in (JavadocParagraphCheck.java:325)\ - - Method calls method in (JavadocParagraphCheck.java:326)\ - - Method calls method in (JavadocParagraphCheck.java:327)\ - - Method calls method in (JavadocTagInfo.java:332)\ - - Method calls method in (SummaryJavadocCheck.java:337)\ - - Method calls method in (WriteTagCheck.java:338)\ - - Constructor ()> gets field in (JavadocStyleCheck.java:340)\ - - Method calls method in (SummaryJavadocCheck.java:343)\ - - Method calls method in (JavadocTagInfo.java:346)\ - - Method calls method in (SummaryJavadocCheck.java:347)\ - - Method calls method in (SummaryJavadocCheck.java:359)\ - - Method calls method in (SummaryJavadocCheck.java:375)\ - - Method calls method in (SummaryJavadocCheck.java:377)\ - - Method calls method in (AbstractJavadocCheck.java:378)\ - - Method calls method in (MissingJavadocMethodCheck.java:384)\ - - Method calls method in (MissingJavadocMethodCheck.java:384)\ - - Method calls method in (AbstractJavadocCheck.java:395)\ - - Method calls method in (SummaryJavadocCheck.java:399)\ - - Method calls method in (AbstractJavadocCheck.java:400)\ - - Method calls method in (MissingJavadocMethodCheck.java:400)\ - - Method calls method in (JavadocStyleCheck.java:401)\ - - Method calls method in (JavadocStyleCheck.java:401)\ - - Method calls method in (JavadocStyleCheck.java:401)\ - - Method calls method in (MissingJavadocMethodCheck.java:401)\ - - Method calls method in (MissingJavadocMethodCheck.java:403)\ - - Method calls method in (SummaryJavadocCheck.java:404)\ - - Method calls method in (SummaryJavadocCheck.java:406)\ - - Method calls method in (MissingJavadocMethodCheck.java:407)\ - - Method calls method in (JavadocStyleCheck.java:416)\ - - Method calls method in (JavadocStyleCheck.java:423)\ - - Method calls method in (JavadocStyleCheck.java:424)\ - - Method calls method in (JavadocStyleCheck.java:426)\ - - Method calls method in (JavadocStyleCheck.java:428)\ - - Method calls method in (MissingJavadocMethodCheck.java:433)\ - - Method calls method in (MissingJavadocMethodCheck.java:434)\ - - Constructor ()> calls constructor ()> in (JavadocTypeCheck.java:435)\ - - Method calls method in (MissingJavadocMethodCheck.java:435)\ - - Method calls method in (SummaryJavadocCheck.java:440)\ - - Method calls method in (SummaryJavadocCheck.java:443)\ - - Method calls method in (SummaryJavadocCheck.java:445)\ - - Method calls method in (SummaryJavadocCheck.java:448)\ - - Method calls method in (MissingJavadocMethodCheck.java:450)\ - - Method calls method in (SummaryJavadocCheck.java:450)\ - - Method calls method in (MissingJavadocMethodCheck.java:451)\ - - Method calls method in (SummaryJavadocCheck.java:452)\ - - Method calls method in (JavadocStyleCheck.java:469)\ - - Method calls method in (MissingJavadocMethodCheck.java:474)\ - - Method calls method in (JavadocStyleCheck.java:475)\ - - Method calls method in (MissingJavadocMethodCheck.java:475)\ - - Method calls method in (JavadocStyleCheck.java:485)\ - - Constructor ()> gets field in (JavadocTypeCheck.java:486)\ - - Method calls method in (SummaryJavadocCheck.java:487)\ - - Method calls method in (JavadocStyleCheck.java:488)\ - - Method calls method in (SummaryJavadocCheck.java:492)\ - - Method calls method in (SummaryJavadocCheck.java:504)\ - - Method calls method in (SummaryJavadocCheck.java:510)\ - - Constructor ()> calls constructor ()> in (JavadocMethodCheck.java:513)\ - - Method calls method in (SummaryJavadocCheck.java:513)\ - - Method calls method in (SummaryJavadocCheck.java:527)\ - - Method calls method in (SummaryJavadocCheck.java:530)\ - - Method calls method in (SummaryJavadocCheck.java:541)\ - - Method calls method in (SummaryJavadocCheck.java:546)\ - - Method calls method in (SummaryJavadocCheck.java:562)\ - - Method calls method in (SummaryJavadocCheck.java:564)\ - - Method calls method in (SummaryJavadocCheck.java:568)\ - - Method calls method in (JavadocStyleCheck.java:589)\ - - Method calls method in (JavadocStyleCheck.java:591)\ - - Method calls method in (JavadocTypeCheck.java:606)\ - - Method calls method in (JavadocTypeCheck.java:607)\ - - Method calls method in (SummaryJavadocCheck.java:637)\ - - Method calls method in (SummaryJavadocCheck.java:641)\ - - Method calls method in (SummaryJavadocCheck.java:642)\ - - Method calls method in (SummaryJavadocCheck.java:642)\ - - Method calls method in (SummaryJavadocCheck.java:645)\ - - Method calls method in (SummaryJavadocCheck.java:646)\ - - Method calls method in (JavadocTypeCheck.java:649)\ - - Method calls method in (JavadocTypeCheck.java:650)\ - - Method calls method in (JavadocTypeCheck.java:652)\ - - Method calls method in (JavadocTypeCheck.java:654)\ - - Method calls method in (SummaryJavadocCheck.java:662)\ - - Method calls method in (SummaryJavadocCheck.java:663)\ - - Method calls method in (SummaryJavadocCheck.java:664)\ - - Method calls method in (SummaryJavadocCheck.java:665)\ - - Method calls method in (SummaryJavadocCheck.java:669)\ - - Method calls method in (SummaryJavadocCheck.java:672)\ - - Method calls method in (SummaryJavadocCheck.java:690)\ - - Method calls method in (SummaryJavadocCheck.java:691)\ - - Method calls method in (JavadocMethodCheck.java:696)\ - - Method calls method in (JavadocMethodCheck.java:697)\ - - Method calls method in (JavadocMethodCheck.java:698)\ - - Method calls method in (JavadocMethodCheck.java:699)\ - - Method calls method in (SummaryJavadocCheck.java:707)\ - - Method calls method in (SummaryJavadocCheck.java:709)\ - - Method calls method in (SummaryJavadocCheck.java:710)\ - - Method calls method in (JavadocMethodCheck.java:715)\ - - Method calls method in (JavadocMethodCheck.java:715)\ - - Method calls method in (JavadocMethodCheck.java:750)\ - - Method calls method in (JavadocMethodCheck.java:751)\ - - Method calls method in (JavadocMethodCheck.java:764)\ - - Method calls method in (JavadocMethodCheck.java:771)\ - - Method calls method in (JavadocTypeCheck.java:807)\ - - Method calls method in (JavadocTypeCheck.java:813)\ - - Method calls method in (JavadocMethodCheck.java:814)\ - - Method calls method in (JavadocTypeCheck.java:814)\ - - Method calls method in (JavadocMethodCheck.java:816)\ - - Method calls method in (JavadocMethodCheck.java:817)\ - - Method calls method in (JavadocMethodCheck.java:915)\ - - Method calls method in (JavadocMethodCheck.java:918)\ - - Method calls method in (JavadocMethodCheck.java:920)\ - - Method calls method in (JavadocMethodCheck.java:921)\ - - Method calls method in (JavadocMethodCheck.java:926)\ - - Method calls method in (JavadocMethodCheck.java:940)\ - - Method calls method in (JavadocMethodCheck.java:942)\ - - Method calls method in (JavadocMethodCheck.java:944)\ - - Method calls method in (JavadocMethodCheck.java:945)\ - - Method calls method in (JavadocMethodCheck.java:948)\ - - Method calls method in (JavadocMethodCheck.java:962)\ - - Method calls method in (JavadocMethodCheck.java:968)\ - - Method calls method in (JavadocMethodCheck.java:969)\ - - Method calls method in (JavadocMethodCheck.java:970)\ - - Method calls method in (JavadocMethodCheck.java:986)\ - - Method calls method in (JavadocMethodCheck.java:1000)\ - - Method calls method in (JavadocMethodCheck.java:1001)\ - - Method calls method in (JavadocMethodCheck.java:1016)\ - - Method calls method in (JavadocMethodCheck.java:1018)\ - - Method calls method in (JavadocMethodCheck.java:1019)\ - - Method calls method in (JavadocMethodCheck.java:1020)\ - - Method calls method in (JavadocMethodCheck.java:1021)\ - - Method calls method in (JavadocMethodCheck.java:1026)\ - - Method calls method in (JavadocMethodCheck.java:1027)\ - - Method calls method in (JavadocMethodCheck.java:1030)\ - - Method calls method in (JavadocMethodCheck.java:1032)\ - - Method calls method in (JavadocMethodCheck.java:1069)\ - - Method calls method in (JavadocMethodCheck.java:1073)\ - - Method calls method in (JavadocMethodCheck.java:1074)\ - - Method calls method in (JavadocMethodCheck.java:1078)\ - - Method calls method in (JavadocMethodCheck.java:1079)\ - - Method calls method in (JavadocMethodCheck.java:1083)\ - - Method calls method in (JavadocMethodCheck.java:1134)\ - - Method calls method in (JavadocMethodCheck.java:1140)\ - - Method calls method in (JavadocMethodCheck.java:1140)\ - - Method calls method in (JavadocMethodCheck.java:1162)\ - - Method calls method in (JavadocMethodCheck.java:1162)\ - - Method calls method in (JavadocMethodCheck.java:1184)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.FullIdent)> calls method in (JavadocMethodCheck.java:1393)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.FullIdent)> calls method in (JavadocMethodCheck.java:1394)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.FullIdent)> calls method in (JavadocMethodCheck.java:1395) -Cycle detected: Slice api -> \ - Slice utils -> \ - Slice checks.javadoc -> \ - Slice checks.naming -> \ - Slice api\ - 1. Dependencies of Slice api\ - - Method calls method in (AbstractFileSetCheck.java:97)\ - - Constructor (java.io.File, java.util.List)> gets field in (FileText.java:133)\ - - Method calls method in (AbstractFileSetCheck.java:177)\ - - Constructor (java.io.File, java.lang.String)> gets field in (FileText.java:180)\ - - Method calls method in (AbstractFileSetCheck.java:230)\ - - Method calls method in (FileContents.java:234)\ - - Method calls method in (AbstractCheck.java:245)\ - - Method calls method in (AbstractCheck.java:275)\ - 2. Dependencies of Slice utils\ - - Method has return type in (JavadocUtil.java:0)\ - - Method calls method in (JavadocUtil.java:121)\ - - Method calls constructor (int, int, java.lang.String, java.lang.String)> in (JavadocUtil.java:123)\ - - Method calls constructor (int, int, java.lang.String)> in (JavadocUtil.java:126)\ - - Method calls constructor (java.util.Collection, java.util.Collection)> in (JavadocUtil.java:130)\ - 3. Dependencies of Slice checks.javadoc\ - - Field depends on component type in (JavadocMethodCheck.java:0)\ - - Method depends on component type in (JavadocMethodCheck.java:0)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - 4. Dependencies of Slice checks.naming\ - - Class extends class in (AbbreviationAsWordInNameCheck.java:0)\ - - Class extends class in (AbstractClassNameCheck.java:0)\ - - Class extends class in (AbstractNameCheck.java:0)\ - - Class extends class in (PackageNameCheck.java:0)\ - - Method has generic return type > with type argument depending on in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbstractAccessControlNameCheck.java:0)\ - - Method has parameter of type in (AbstractAccessControlNameCheck.java:0)\ - - Method has parameter of type in (AbstractAccessControlNameCheck.java:0)\ - - Method has parameter of type in (AbstractClassNameCheck.java:0)\ - - Method has parameter of type in (AbstractClassNameCheck.java:0)\ - - Method has parameter of type in (AbstractClassNameCheck.java:0)\ - - Method has parameter of type in (AbstractNameCheck.java:0)\ - - Method has parameter of type in (AbstractNameCheck.java:0)\ - - Method has parameter of type in (CatchParameterNameCheck.java:0)\ - - Method has parameter of type in (ClassTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (ConstantNameCheck.java:0)\ - - Method has parameter of type in (IllegalIdentifierNameCheck.java:0)\ - - Method has parameter of type in (InterfaceTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (LambdaParameterNameCheck.java:0)\ - - Method has parameter of type in (LambdaParameterNameCheck.java:0)\ - - Method has parameter of type in (LocalFinalVariableNameCheck.java:0)\ - - Method has parameter of type in (LocalVariableNameCheck.java:0)\ - - Method has parameter of type in (LocalVariableNameCheck.java:0)\ - - Method has parameter of type in (MemberNameCheck.java:0)\ - - Method has parameter of type in (MethodNameCheck.java:0)\ - - Method has parameter of type in (MethodTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (PackageNameCheck.java:0)\ - - Method has parameter of type in (ParameterNameCheck.java:0)\ - - Method has parameter of type in (ParameterNameCheck.java:0)\ - - Method has parameter of type in (PatternVariableNameCheck.java:0)\ - - Method has parameter of type in (RecordComponentNameCheck.java:0)\ - - Method has parameter of type in (RecordTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (StaticVariableNameCheck.java:0)\ - - Constructor (java.lang.String)> calls constructor ()> in (AbstractNameCheck.java:51)\ - - Method calls method in (AbstractAccessControlNameCheck.java:74)\ - - Method calls method in (AbstractNameCheck.java:77)\ - - Method calls method in (AbstractNameCheck.java:78)\ - - Method calls method in (AbstractNameCheck.java:81)\ - - Method calls method in (AbstractAccessControlNameCheck.java:86)\ - - Method calls method in (AbstractAccessControlNameCheck.java:88)\ - - Method calls method in (RecordTypeParameterNameCheck.java:100)\ - - Method calls method in (RecordTypeParameterNameCheck.java:101)\ - - Constructor ()> calls constructor ()> in (PackageNameCheck.java:104)\ - - Method calls method in (InterfaceTypeParameterNameCheck.java:105)\ - - Method calls method in (InterfaceTypeParameterNameCheck.java:106)\ - - Method calls method in (AbstractAccessControlNameCheck.java:108)\ - - Method calls method in (MethodTypeParameterNameCheck.java:110)\ - - Method calls method in (MethodTypeParameterNameCheck.java:111)\ - - Method calls method in (AbstractAccessControlNameCheck.java:112)\ - - Method calls method in (LambdaParameterNameCheck.java:118)\ - - Method calls method in (LambdaParameterNameCheck.java:118)\ - - Method calls method in (LambdaParameterNameCheck.java:120)\ - - Method calls method in (LambdaParameterNameCheck.java:121)\ - - Method calls method in (ClassTypeParameterNameCheck.java:126)\ - - Method calls method in (ClassTypeParameterNameCheck.java:127)\ - - Method calls method in (PackageNameCheck.java:146)\ - - Method calls method in (PackageNameCheck.java:146)\ - - Method calls method in (PackageNameCheck.java:147)\ - - Method calls method in (PackageNameCheck.java:148)\ - - Method calls method in (PackageNameCheck.java:149)\ - - Method calls method in (LocalFinalVariableNameCheck.java:151)\ - - Method calls method in (PackageNameCheck.java:151)\ - - Constructor ()> calls constructor ()> in (AbstractClassNameCheck.java:152)\ - - Method calls method in (LocalFinalVariableNameCheck.java:152)\ - - Method calls method in (StaticVariableNameCheck.java:152)\ - - Method calls method in (LocalFinalVariableNameCheck.java:153)\ - - Method calls method in (StaticVariableNameCheck.java:153)\ - - Method calls method in (StaticVariableNameCheck.java:154)\ - - Method calls method in (CatchParameterNameCheck.java:156)\ - - Method calls method in (CatchParameterNameCheck.java:156)\ - - Method calls method in (MemberNameCheck.java:170)\ - - Method calls method in (ConstantNameCheck.java:171)\ - - Method calls method in (MemberNameCheck.java:171)\ - - Method calls method in (ConstantNameCheck.java:173)\ - - Method calls method in (ConstantNameCheck.java:174)\ - - Method calls method in (ConstantNameCheck.java:181)\ - - Method calls method in (ConstantNameCheck.java:182)\ - - Method calls method in (ConstantNameCheck.java:183)\ - - Method calls method in (IllegalIdentifierNameCheck.java:183)\ - - Method calls method in (LocalVariableNameCheck.java:215)\ - - Method calls method in (LocalVariableNameCheck.java:215)\ - - Method calls method in (LocalVariableNameCheck.java:219)\ - - Method calls method in (LocalVariableNameCheck.java:220)\ - - Method calls method in (LocalVariableNameCheck.java:233)\ - - Method calls method in (LocalVariableNameCheck.java:233)\ - - Method calls method in (ParameterNameCheck.java:236)\ - - Method calls method in (ParameterNameCheck.java:238)\ - - Method calls method in (MethodNameCheck.java:239)\ - - Method calls method in (ParameterNameCheck.java:239)\ - - Method calls method in (ParameterNameCheck.java:239)\ - - Method calls method in (AbstractClassNameCheck.java:241)\ - - Method calls method in (AbstractClassNameCheck.java:241)\ - - Method calls method in (MethodNameCheck.java:242)\ - - Method calls method in (ParameterNameCheck.java:242)\ - - Method calls method in (MethodNameCheck.java:244)\ - - Method calls method in (MethodNameCheck.java:252)\ - - Method calls method in (MethodNameCheck.java:253)\ - - Method calls method in (AbstractClassNameCheck.java:260)\ - - Method calls method in (AbstractClassNameCheck.java:261)\ - - Method calls method in (ParameterNameCheck.java:268)\ - - Method calls method in (ParameterNameCheck.java:270)\ - - Method calls method in (ParameterNameCheck.java:274)\ - - Method calls method in (ParameterNameCheck.java:275)\ - - Constructor ()> calls constructor ()> in (AbbreviationAsWordInNameCheck.java:336)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:491)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:492)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:509)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:512)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:521)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:537)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:538)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:558)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:559)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:561)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:562)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:579)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:581)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:702)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:705) -Cycle detected: Slice api -> \ - Slice utils -> \ - Slice checks.javadoc.utils -> \ - Slice api\ - 1. Dependencies of Slice api\ - - Method calls method in (AbstractFileSetCheck.java:97)\ - - Constructor (java.io.File, java.util.List)> gets field in (FileText.java:133)\ - - Method calls method in (AbstractFileSetCheck.java:177)\ - - Constructor (java.io.File, java.lang.String)> gets field in (FileText.java:180)\ - - Method calls method in (AbstractFileSetCheck.java:230)\ - - Method calls method in (FileContents.java:234)\ - - Method calls method in (AbstractCheck.java:245)\ - - Method calls method in (AbstractCheck.java:275)\ - 2. Dependencies of Slice utils\ - - Method calls method in (JavadocUtil.java:102)\ - - Method calls method in (JavadocUtil.java:107)\ - - Method calls method in (JavadocUtil.java:114)\ - - Method calls method in (JavadocUtil.java:119)\ - - Method calls method in (JavadocUtil.java:121)\ - - Method calls method in (JavadocUtil.java:123)\ - - Method calls method in (JavadocUtil.java:123)\ - - Method calls method in (JavadocUtil.java:126)\ - 3. Dependencies of Slice checks.javadoc.utils\ - - Constructor (java.lang.String, java.lang.String, com.puppycrawl.tools.checkstyle.api.LineColumn)> has parameter of type in (TagInfo.java:0)\ - - Field has type in (TagInfo.java:0)\ - - Method has return type in (InlineTagUtil.java:0)\ - - Method has return type in (TagInfo.java:0)\ - - Method calls constructor (int, int)> in (BlockTagUtil.java:89)\ - - Method calls constructor (int, int)> in (InlineTagUtil.java:128) -Cycle detected: Slice api -> \ - Slice utils -> \ - Slice checks.naming -> \ - Slice api\ - 1. Dependencies of Slice api\ - - Method calls method in (AbstractFileSetCheck.java:97)\ - - Constructor (java.io.File, java.util.List)> gets field in (FileText.java:133)\ - - Method calls method in (AbstractFileSetCheck.java:177)\ - - Constructor (java.io.File, java.lang.String)> gets field in (FileText.java:180)\ - - Method calls method in (AbstractFileSetCheck.java:230)\ - - Method calls method in (FileContents.java:234)\ - - Method calls method in (AbstractCheck.java:245)\ - - Method calls method in (AbstractCheck.java:275)\ - 2. Dependencies of Slice utils\ - - Method has return type in (CheckUtil.java:0)\ - - Method has return type in (CheckUtil.java:0)\ - - Method has return type in (CheckUtil.java:0)\ - - Method gets field in (CheckUtil.java:404)\ - - Method gets field in (CheckUtil.java:406)\ - - Method gets field in (CheckUtil.java:409)\ - - Method gets field in (CheckUtil.java:430)\ - - Method gets field in (CheckUtil.java:435)\ - - Method gets field in (CheckUtil.java:438)\ - - Method gets field in (CheckUtil.java:441)\ - 3. Dependencies of Slice checks.naming\ - - Class extends class in (AbbreviationAsWordInNameCheck.java:0)\ - - Class extends class in (AbstractClassNameCheck.java:0)\ - - Class extends class in (AbstractNameCheck.java:0)\ - - Class extends class in (PackageNameCheck.java:0)\ - - Method has generic return type > with type argument depending on in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbbreviationAsWordInNameCheck.java:0)\ - - Method has parameter of type in (AbstractAccessControlNameCheck.java:0)\ - - Method has parameter of type in (AbstractAccessControlNameCheck.java:0)\ - - Method has parameter of type in (AbstractAccessControlNameCheck.java:0)\ - - Method has parameter of type in (AbstractClassNameCheck.java:0)\ - - Method has parameter of type in (AbstractClassNameCheck.java:0)\ - - Method has parameter of type in (AbstractClassNameCheck.java:0)\ - - Method has parameter of type in (AbstractNameCheck.java:0)\ - - Method has parameter of type in (AbstractNameCheck.java:0)\ - - Method has parameter of type in (CatchParameterNameCheck.java:0)\ - - Method has parameter of type in (ClassTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (ConstantNameCheck.java:0)\ - - Method has parameter of type in (IllegalIdentifierNameCheck.java:0)\ - - Method has parameter of type in (InterfaceTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (LambdaParameterNameCheck.java:0)\ - - Method has parameter of type in (LambdaParameterNameCheck.java:0)\ - - Method has parameter of type in (LocalFinalVariableNameCheck.java:0)\ - - Method has parameter of type in (LocalVariableNameCheck.java:0)\ - - Method has parameter of type in (LocalVariableNameCheck.java:0)\ - - Method has parameter of type in (MemberNameCheck.java:0)\ - - Method has parameter of type in (MethodNameCheck.java:0)\ - - Method has parameter of type in (MethodTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (PackageNameCheck.java:0)\ - - Method has parameter of type in (ParameterNameCheck.java:0)\ - - Method has parameter of type in (ParameterNameCheck.java:0)\ - - Method has parameter of type in (PatternVariableNameCheck.java:0)\ - - Method has parameter of type in (RecordComponentNameCheck.java:0)\ - - Method has parameter of type in (RecordTypeParameterNameCheck.java:0)\ - - Method has parameter of type in (StaticVariableNameCheck.java:0)\ - - Constructor (java.lang.String)> calls constructor ()> in (AbstractNameCheck.java:51)\ - - Method calls method in (AbstractAccessControlNameCheck.java:74)\ - - Method calls method in (AbstractNameCheck.java:77)\ - - Method calls method in (AbstractNameCheck.java:78)\ - - Method calls method in (AbstractNameCheck.java:81)\ - - Method calls method in (AbstractAccessControlNameCheck.java:86)\ - - Method calls method in (AbstractAccessControlNameCheck.java:88)\ - - Method calls method in (RecordTypeParameterNameCheck.java:100)\ - - Method calls method in (RecordTypeParameterNameCheck.java:101)\ - - Constructor ()> calls constructor ()> in (PackageNameCheck.java:104)\ - - Method calls method in (InterfaceTypeParameterNameCheck.java:105)\ - - Method calls method in (InterfaceTypeParameterNameCheck.java:106)\ - - Method calls method in (AbstractAccessControlNameCheck.java:108)\ - - Method calls method in (MethodTypeParameterNameCheck.java:110)\ - - Method calls method in (MethodTypeParameterNameCheck.java:111)\ - - Method calls method in (AbstractAccessControlNameCheck.java:112)\ - - Method calls method in (LambdaParameterNameCheck.java:118)\ - - Method calls method in (LambdaParameterNameCheck.java:118)\ - - Method calls method in (LambdaParameterNameCheck.java:120)\ - - Method calls method in (LambdaParameterNameCheck.java:121)\ - - Method calls method in (ClassTypeParameterNameCheck.java:126)\ - - Method calls method in (ClassTypeParameterNameCheck.java:127)\ - - Method calls method in (PackageNameCheck.java:146)\ - - Method calls method in (PackageNameCheck.java:146)\ - - Method calls method in (PackageNameCheck.java:147)\ - - Method calls method in (PackageNameCheck.java:148)\ - - Method calls method in (PackageNameCheck.java:149)\ - - Method calls method in (LocalFinalVariableNameCheck.java:151)\ - - Method calls method in (PackageNameCheck.java:151)\ - - Constructor ()> calls constructor ()> in (AbstractClassNameCheck.java:152)\ - - Method calls method in (LocalFinalVariableNameCheck.java:152)\ - - Method calls method in (StaticVariableNameCheck.java:152)\ - - Method calls method in (LocalFinalVariableNameCheck.java:153)\ - - Method calls method in (StaticVariableNameCheck.java:153)\ - - Method calls method in (StaticVariableNameCheck.java:154)\ - - Method calls method in (CatchParameterNameCheck.java:156)\ - - Method calls method in (CatchParameterNameCheck.java:156)\ - - Method calls method in (MemberNameCheck.java:170)\ - - Method calls method in (ConstantNameCheck.java:171)\ - - Method calls method in (MemberNameCheck.java:171)\ - - Method calls method in (ConstantNameCheck.java:173)\ - - Method calls method in (ConstantNameCheck.java:174)\ - - Method calls method in (ConstantNameCheck.java:181)\ - - Method calls method in (ConstantNameCheck.java:182)\ - - Method calls method in (ConstantNameCheck.java:183)\ - - Method calls method in (IllegalIdentifierNameCheck.java:183)\ - - Method calls method in (LocalVariableNameCheck.java:215)\ - - Method calls method in (LocalVariableNameCheck.java:215)\ - - Method calls method in (LocalVariableNameCheck.java:219)\ - - Method calls method in (LocalVariableNameCheck.java:220)\ - - Method calls method in (LocalVariableNameCheck.java:233)\ - - Method calls method in (LocalVariableNameCheck.java:233)\ - - Method calls method in (ParameterNameCheck.java:236)\ - - Method calls method in (ParameterNameCheck.java:238)\ - - Method calls method in (MethodNameCheck.java:239)\ - - Method calls method in (ParameterNameCheck.java:239)\ - - Method calls method in (ParameterNameCheck.java:239)\ - - Method calls method in (AbstractClassNameCheck.java:241)\ - - Method calls method in (AbstractClassNameCheck.java:241)\ - - Method calls method in (MethodNameCheck.java:242)\ - - Method calls method in (ParameterNameCheck.java:242)\ - - Method calls method in (MethodNameCheck.java:244)\ - - Method calls method in (MethodNameCheck.java:252)\ - - Method calls method in (MethodNameCheck.java:253)\ - - Method calls method in (AbstractClassNameCheck.java:260)\ - - Method calls method in (AbstractClassNameCheck.java:261)\ - - Method calls method in (ParameterNameCheck.java:268)\ - - Method calls method in (ParameterNameCheck.java:270)\ - - Method calls method in (ParameterNameCheck.java:274)\ - - Method calls method in (ParameterNameCheck.java:275)\ - - Constructor ()> calls constructor ()> in (AbbreviationAsWordInNameCheck.java:336)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:491)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:492)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:509)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:512)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:521)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:537)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:538)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:558)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:559)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:561)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:562)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:579)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:581)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:702)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:705) -Cycle detected: Slice api -> \ - Slice utils -> \ - Slice xpath -> \ - Slice api\ - 1. Dependencies of Slice api\ - - Method calls method in (AbstractFileSetCheck.java:97)\ - - Constructor (java.io.File, java.util.List)> gets field in (FileText.java:133)\ - - Method calls method in (AbstractFileSetCheck.java:177)\ - - Constructor (java.io.File, java.lang.String)> gets field in (FileText.java:180)\ - - Method calls method in (AbstractFileSetCheck.java:230)\ - - Method calls method in (FileContents.java:234)\ - - Method calls method in (AbstractCheck.java:245)\ - - Method calls method in (AbstractCheck.java:275)\ - 2. Dependencies of Slice utils\ - - Method has generic return type > with type argument depending on in (XpathUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method calls method in (XpathUtil.java:139)\ - - Method calls constructor (com.puppycrawl.tools.checkstyle.xpath.AbstractNode, com.puppycrawl.tools.checkstyle.xpath.AbstractNode, com.puppycrawl.tools.checkstyle.api.DetailAST, int, int)> in (XpathUtil.java:143)\ - - Method calls constructor (com.puppycrawl.tools.checkstyle.api.DetailAST)> in (XpathUtil.java:187)\ - - Method calls method in (XpathUtil.java:191)\ - 3. Dependencies of Slice xpath\ - - Constructor (com.puppycrawl.tools.checkstyle.xpath.AbstractNode, com.puppycrawl.tools.checkstyle.xpath.AbstractNode, com.puppycrawl.tools.checkstyle.api.DetailAST, int, int)> has parameter of type in (ElementNode.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.DetailAST)> has parameter of type in (RootNode.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.DetailAST, int, int, com.puppycrawl.tools.checkstyle.api.FileText, int)> has parameter of type in (XpathQueryGenerator.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.DetailAST, int, int, com.puppycrawl.tools.checkstyle.api.FileText, int)> has parameter of type in (XpathQueryGenerator.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.DetailAST, int, int, int, com.puppycrawl.tools.checkstyle.api.FileText, int)> has parameter of type in (XpathQueryGenerator.java:0)\ - - Constructor (com.puppycrawl.tools.checkstyle.api.DetailAST, int, int, int, com.puppycrawl.tools.checkstyle.api.FileText, int)> has parameter of type in (XpathQueryGenerator.java:0)\ - - Field has type in (ElementNode.java:0)\ - - Field has type in (RootNode.java:0)\ - - Field has type in (XpathQueryGenerator.java:0)\ - - Field has type in (XpathQueryGenerator.java:0)\ - - Method has return type in (ElementNode.java:0)\ - - Method has return type in (RootNode.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has return type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has return type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has generic return type > with type argument depending on in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method has parameter of type in (XpathQueryGenerator.java:0)\ - - Method calls method in (ElementNode.java:59)\ - - Method calls method in (ElementNode.java:69)\ - - Method calls method in (RootNode.java:73)\ - - Method calls method in (ElementNode.java:79)\ - - Method calls method in (RootNode.java:83)\ - - Method calls method in (ElementNode.java:89)\ - - Constructor (com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent, int)> calls method in (XpathQueryGenerator.java:99)\ - - Method calls method in (ElementNode.java:99)\ - - Method calls method in (ElementNode.java:109)\ - - Method calls method in (XpathQueryGenerator.java:169)\ - - Method calls method in (XpathQueryGenerator.java:170)\ - - Method calls method in (XpathQueryGenerator.java:208)\ - - Method calls method in (XpathQueryGenerator.java:211)\ - - Method calls method in (XpathQueryGenerator.java:240)\ - - Method calls method in (XpathQueryGenerator.java:242)\ - - Method calls method in (XpathQueryGenerator.java:243)\ - - Method calls method in (XpathQueryGenerator.java:264)\ - - Method calls method in (XpathQueryGenerator.java:280)\ - - Method calls method in (XpathQueryGenerator.java:293)\ - - Method calls method in (XpathQueryGenerator.java:295)\ - - Method calls method in (XpathQueryGenerator.java:299)\ - - Method calls method in (XpathQueryGenerator.java:301)\ - - Method calls method in (XpathQueryGenerator.java:303)\ - - Method calls method in (XpathQueryGenerator.java:307)\ - - Method calls method in (XpathQueryGenerator.java:319)\ - - Method calls method in (XpathQueryGenerator.java:320)\ - - Method calls method in (XpathQueryGenerator.java:331)\ - - Method calls method in (XpathQueryGenerator.java:333) -Cycle detected: Slice checks.javadoc -> \ - Slice checks.naming -> \ - Slice utils -> \ - Slice checks.javadoc\ - 1. Dependencies of Slice checks.javadoc\ - - Field depends on component type in (JavadocMethodCheck.java:0)\ - - Method depends on component type in (JavadocMethodCheck.java:0)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - - Constructor ()> gets field in (JavadocMethodCheck.java:585)\ - 2. Dependencies of Slice checks.naming\ - - Constructor (java.lang.String)> calls method in (AbstractNameCheck.java:52)\ - - Method calls method in (AbstractAccessControlNameCheck.java:109)\ - - Method calls method in (AbstractAccessControlNameCheck.java:110)\ - - Method calls method in (LambdaParameterNameCheck.java:122)\ - - Method gets field in (LocalFinalVariableNameCheck.java:145)\ - - Method calls method in (LocalFinalVariableNameCheck.java:154)\ - - Method calls method in (StaticVariableNameCheck.java:159)\ - - Method gets field in (TypeNameCheck.java:171)\ - - Method calls method in (MemberNameCheck.java:173)\ - - Method calls method in (MemberNameCheck.java:174)\ - - Method calls method in (ConstantNameCheck.java:175)\ - - Method calls method in (ConstantNameCheck.java:176)\ - - Method calls method in (ConstantNameCheck.java:178)\ - - Method gets field in (IllegalIdentifierNameCheck.java:178)\ - - Method calls method in (LocalVariableNameCheck.java:221)\ - - Method calls method in (MethodNameCheck.java:232)\ - - Method calls method in (ParameterNameCheck.java:240)\ - - Method calls method in (ParameterNameCheck.java:242)\ - - Method gets field in (AbbreviationAsWordInNameCheck.java:485)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:525)\ - 3. Dependencies of Slice utils\ - - Method has return type in (JavadocUtil.java:0)\ - - Method calls method in (JavadocUtil.java:121)\ - - Method calls constructor (int, int, java.lang.String, java.lang.String)> in (JavadocUtil.java:123)\ - - Method calls constructor (int, int, java.lang.String)> in (JavadocUtil.java:126)\ - - Method calls constructor (java.util.Collection, java.util.Collection)> in (JavadocUtil.java:130) -Cycle detected: Slice checks.javadoc -> \ - Slice utils -> \ - Slice checks.javadoc\ - 1. Dependencies of Slice checks.javadoc\ - - Method calls method in (JavadocTagInfo.java:78)\ - - Method calls method in (JavadocTagInfo.java:92)\ - - Method calls method in (InvalidJavadocPositionCheck.java:104)\ - - Method calls method in (InvalidJavadocPositionCheck.java:106)\ - - Method calls method in (JavadocTagInfo.java:106)\ - - Method calls method in (InvalidJavadocPositionCheck.java:107)\ - - Method calls method in (MissingJavadocPackageCheck.java:108)\ - - Method calls method in (JavadocTagInfo.java:120)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:121)\ - - Method calls method in (JavadocMissingWhitespaceAfterAsteriskCheck.java:124)\ - - Method gets field in (AbstractJavadocCheck.java:144)\ - - Method calls method in (JavadocTagInfo.java:150)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:151)\ - - Method calls method in (MissingJavadocPackageCheck.java:159)\ - - Method calls method in (JavadocTagInfo.java:164)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:168)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:170)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:170)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:175)\ - - Constructor ()> calls method in (AtclauseOrderCheck.java:176)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:177)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:178)\ - - Method calls method in (JavadocTagInfo.java:178)\ - - Method calls method in (JavadocNodeImpl.java:179)\ - - Method calls method in (AbstractJavadocCheck.java:181)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:183)\ - - Method calls method in (NonEmptyAtclauseDescriptionCheck.java:185)\ - - Method calls method in (JavadocTagInfo.java:192)\ - - Method calls method in (AbstractJavadocCheck.java:199)\ - - Method calls method in (AtclauseOrderCheck.java:199)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:200)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:201)\ - - Method calls method in (JavadocMissingLeadingAsteriskCheck.java:202)\ - - Method calls method in (JavadocParagraphCheck.java:204)\ - - Method calls method in (JavadocContentLocationCheck.java:207)\ - - Method calls method in (JavadocContentLocationCheck.java:208)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:212)\ - - Method calls method in (JavadocParagraphCheck.java:217)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:223)\ - - Method calls method in (WriteTagCheck.java:225)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:226)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:227)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:228)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:230)\ - - Method calls method in (JavadocContentLocationCheck.java:232)\ - - Method calls method in (JavadocTagContinuationIndentationCheck.java:236)\ - - Method calls method in (JavadocTagInfo.java:238)\ - - Method calls method in (AtclauseOrderCheck.java:243)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:244)\ - - Method calls method in (JavadocParagraphCheck.java:247)\ - - Method calls method in (JavadocParagraphCheck.java:250)\ - - Method calls method in (JavadocTagInfo.java:253)\ - - Method calls method in (RequireEmptyLineBeforeBlockTagGroupCheck.java:253)\ - - Method gets field in (MissingJavadocTypeCheck.java:255)\ - - Method calls method in (JavadocParagraphCheck.java:263)\ - - Static Initializer ()> calls method in (SummaryJavadocCheck.java:265)\ - - Method calls method in (JavadocParagraphCheck.java:267)\ - - Method calls method in (JavadocParagraphCheck.java:268)\ - - Constructor ()> calls method in (SummaryJavadocCheck.java:273)\ - - Method gets field in (WriteTagCheck.java:278)\ - - Method calls method in (MissingJavadocTypeCheck.java:279)\ - - Method calls method in (MissingJavadocTypeCheck.java:280)\ - - Method calls method in (JavadocParagraphCheck.java:284)\ - - Method calls method in (JavadocVariableCheck.java:284)\ - - Method calls method in (JavadocVariableCheck.java:285)\ - - Method calls method in (JavadocVariableCheck.java:286)\ - - Method calls method in (JavadocParagraphCheck.java:287)\ - - Method calls method in (MissingJavadocTypeCheck.java:288)\ - - Method calls method in (JavadocParagraphCheck.java:294)\ - - Method calls method in (AbstractJavadocCheck.java:304)\ - - Method calls method in (JavadocParagraphCheck.java:306)\ - - Method calls method in (JavadocTagInfo.java:306)\ - - Method calls method in (JavadocParagraphCheck.java:308)\ - - Method calls method in (SingleLineJavadocCheck.java:319)\ - - Method calls method in (JavadocParagraphCheck.java:324)\ - - Method calls method in (JavadocParagraphCheck.java:327)\ - - Method calls method in (JavadocTagInfo.java:334)\ - - Method calls method in (SingleLineJavadocCheck.java:335)\ - - Method calls method in (JavadocTagInfo.java:348)\ - - Method calls method in (SingleLineJavadocCheck.java:350)\ - - Static Initializer ()> calls method in (JavadocTagInfo.java:354)\ - - Method calls method in (SingleLineJavadocCheck.java:357)\ - - Method gets field in (MissingJavadocMethodCheck.java:359)\ - - Static Initializer ()> calls method in (JavadocTagInfo.java:367)\ - - Method calls method in (AbstractJavadocCheck.java:370)\ - - Method calls method in (SingleLineJavadocCheck.java:370)\ - - Method calls method in (AbstractJavadocCheck.java:376)\ - - Method calls method in (MissingJavadocMethodCheck.java:381)\ - - Method calls method in (SummaryJavadocCheck.java:385)\ - - Method gets field in (JavadocStyleCheck.java:388)\ - - Method calls method in (SummaryJavadocCheck.java:398)\ - - Method calls method in (SummaryJavadocCheck.java:400)\ - - Method calls method in (SummaryJavadocCheck.java:415)\ - - Method calls method in (JavadocStyleCheck.java:417)\ - - Method calls method in (JavadocStyleCheck.java:419)\ - - Method calls method in (JavadocStyleCheck.java:420)\ - - Method calls method in (MissingJavadocMethodCheck.java:420)\ - - Method calls method in (MissingJavadocMethodCheck.java:420)\ - - Method calls method in (JavadocStyleCheck.java:421)\ - - Method calls method in (MissingJavadocMethodCheck.java:437)\ - - Method calls method in (MissingJavadocMethodCheck.java:469)\ - - Method calls method in (SummaryJavadocCheck.java:548)\ - - Static Initializer ()> calls method in (JavadocMethodCheck.java:558)\ - - Static Initializer ()> calls method in (JavadocMethodCheck.java:562)\ - - Static Initializer ()> calls method in (JavadocMethodCheck.java:567)\ - - Static Initializer ()> calls method in (JavadocMethodCheck.java:576)\ - - Static Initializer ()> calls method in (JavadocMethodCheck.java:579)\ - - Static Initializer ()> calls method in (JavadocMethodCheck.java:582)\ - - Method gets field in (JavadocTypeCheck.java:597)\ - - Method calls method in (JavadocTypeCheck.java:610)\ - - Method calls method in (JavadocTypeCheck.java:619)\ - - Method calls method in (JavadocStyleCheck.java:633)\ - - Method calls method in (JavadocTypeCheck.java:646)\ - - Method calls method in (SummaryJavadocCheck.java:646)\ - - Method calls method in (JavadocTypeCheck.java:647)\ - - Method calls method in (JavadocTypeCheck.java:655)\ - - Method calls method in (JavadocTypeCheck.java:665)\ - - Method gets field in (JavadocTypeCheck.java:665)\ - - Method calls method in (SummaryJavadocCheck.java:670)\ - - Method calls method in (SummaryJavadocCheck.java:693)\ - - Method calls method in (JavadocMethodCheck.java:731)\ - - Method calls method in (JavadocMethodCheck.java:733)\ - - Method calls method in (JavadocMethodCheck.java:761)\ - - Method calls method in (JavadocMethodCheck.java:770)\ - - Method calls method in (JavadocTypeCheck.java:811)\ - - Method calls method in (JavadocMethodCheck.java:1101)\ - - Method calls method in (JavadocMethodCheck.java:1117)\ - - Method calls method in (JavadocMethodCheck.java:1117)\ - 2. Dependencies of Slice utils\ - - Method has return type in (JavadocUtil.java:0)\ - - Method calls method in (JavadocUtil.java:121)\ - - Method calls constructor (int, int, java.lang.String, java.lang.String)> in (JavadocUtil.java:123)\ - - Method calls constructor (int, int, java.lang.String)> in (JavadocUtil.java:126)\ - - Method calls constructor (java.util.Collection, java.util.Collection)> in (JavadocUtil.java:130) -Cycle detected: Slice checks.naming -> \ - Slice utils -> \ - Slice checks.naming\ - 1. Dependencies of Slice checks.naming\ - - Constructor (java.lang.String)> calls method in (AbstractNameCheck.java:52)\ - - Method calls method in (AbstractAccessControlNameCheck.java:109)\ - - Method calls method in (AbstractAccessControlNameCheck.java:110)\ - - Method calls method in (LambdaParameterNameCheck.java:122)\ - - Method gets field in (LocalFinalVariableNameCheck.java:145)\ - - Method calls method in (LocalFinalVariableNameCheck.java:154)\ - - Method calls method in (StaticVariableNameCheck.java:159)\ - - Method gets field in (TypeNameCheck.java:171)\ - - Method calls method in (MemberNameCheck.java:173)\ - - Method calls method in (MemberNameCheck.java:174)\ - - Method calls method in (ConstantNameCheck.java:175)\ - - Method calls method in (ConstantNameCheck.java:176)\ - - Method calls method in (ConstantNameCheck.java:178)\ - - Method gets field in (IllegalIdentifierNameCheck.java:178)\ - - Method calls method in (LocalVariableNameCheck.java:221)\ - - Method calls method in (MethodNameCheck.java:232)\ - - Method calls method in (ParameterNameCheck.java:240)\ - - Method calls method in (ParameterNameCheck.java:242)\ - - Method gets field in (AbbreviationAsWordInNameCheck.java:485)\ - - Method calls method in (AbbreviationAsWordInNameCheck.java:525)\ - 2. Dependencies of Slice utils\ - - Method has return type in (CheckUtil.java:0)\ - - Method has return type in (CheckUtil.java:0)\ - - Method has return type in (CheckUtil.java:0)\ - - Method gets field in (CheckUtil.java:404)\ - - Method gets field in (CheckUtil.java:406)\ - - Method gets field in (CheckUtil.java:409)\ - - Method gets field in (CheckUtil.java:430)\ - - Method gets field in (CheckUtil.java:435)\ - - Method gets field in (CheckUtil.java:438)\ - - Method gets field in (CheckUtil.java:441) -Cycle detected: Slice utils -> \ - Slice xpath -> \ - Slice utils\ - 1. Dependencies of Slice utils\ - - Method has generic return type > with type argument depending on in (XpathUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method has parameter of type in (XpathUtil.java:0)\ - - Method calls method in (XpathUtil.java:139)\ - - Method calls constructor (com.puppycrawl.tools.checkstyle.xpath.AbstractNode, com.puppycrawl.tools.checkstyle.xpath.AbstractNode, com.puppycrawl.tools.checkstyle.api.DetailAST, int, int)> in (XpathUtil.java:143)\ - - Method calls constructor (com.puppycrawl.tools.checkstyle.api.DetailAST)> in (XpathUtil.java:187)\ - - Method calls method in (XpathUtil.java:191)\ - 2. Dependencies of Slice xpath\ - - Method calls method in (RootNode.java:53)\ - - Method calls method in (ElementNode.java:59)\ - - Method calls method in (ElementNode.java:79)\ - - Method calls method in (ElementNode.java:126)\ - - Method calls method in (ElementNode.java:128)\ - - Method calls method in (XpathQueryGenerator.java:156)\ - - Method references method in (XpathQueryGenerator.java:156)\ - - Method calls method in (XpathQueryGenerator.java:224)\ - - Method calls method in (XpathQueryGenerator.java:264)\ - - Method calls method in (XpathQueryGenerator.java:265)\ - - Method calls method in (XpathQueryGenerator.java:267)\ - - Method calls method in (XpathQueryGenerator.java:319) \ No newline at end of file diff --git a/config/archunit-store/stored.rules b/config/archunit-store/stored.rules deleted file mode 100644 index 02437d1a854..00000000000 --- a/config/archunit-store/stored.rules +++ /dev/null @@ -1 +0,0 @@ -slices\ matching\ 'com.puppycrawl.tools.checkstyle.(**)'\ should\ be\ free\ of\ cycles=slices-should-be-free-of-cycles-suppressions diff --git a/config/benchmark-config.xml b/config/benchmark-config.xml new file mode 100644 index 00000000000..eaf42a71e7e --- /dev/null +++ b/config/benchmark-config.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/config/checker-framework-suppressions/checker-index-suppressions.xml b/config/checker-framework-suppressions/checker-index-suppressions.xml index c4130019ade..4ba5b1ed5ef 100644 --- a/config/checker-framework-suppressions/checker-index-suppressions.xml +++ b/config/checker-framework-suppressions/checker-index-suppressions.xml @@ -3,7 +3,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. baseIndentation = baseIndentation.substring(0, baseIndentation.length() - 2);
found : int @@ -11,21 +11,10 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.java - argument - incompatible argument for parameter capacity of StringBuilder. - final StringBuilder sb = new StringBuilder(bufLen); -
- found : int - required: @NonNegative int -
-
- src/main/java/com/puppycrawl/tools/checkstyle/DetailAstImpl.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return getBranchTokenTypes().get(tokenType);
found : int @@ -36,7 +25,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/DetailAstImpl.java argument - incompatible argument for parameter bitIndex of set. + incompatible argument for parameter bitIndex of BitSet.set. branchTokenTypes.set(type);
found : int @@ -47,7 +36,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return className.substring(0, className.length() - contextLength);
found : int @@ -59,22 +48,21 @@ src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java array.access.unsafe.high Potentially unsafe array access: the index could be larger than the array's bound - final String ruleName = recognizer.getRuleNames()[ruleIndex]; + children[i] = child;
found : int - required: @IndexFor("recognizer.getRuleNames()") or @LTLengthOf("recognizer.getRuleNames()") -- an integer less than recognizer.getRuleNames()'s length + required: @IndexFor("children") or @LTLengthOf("children") -- an integer less than children's length
src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java - array.access.unsafe.high.range + array.access.unsafe.high Potentially unsafe array access: the index could be larger than the array's bound - children[i] = child; + final String ruleName = recognizer.getRuleNames()[ruleIndex];
- index type found: @IntRange(from=-2147483648) int - array type found: DetailNode [] - required : index of type @IndexFor("children") or @LTLengthOf("children"), or array of type @MinLen(-9223372036854775808) + found : int + required: @IndexFor("recognizer.getRuleNames()") or @LTLengthOf("recognizer.getRuleNames()") -- an integer less than recognizer.getRuleNames()'s length
@@ -114,7 +102,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. ent.substring(prefixLength, ent.length() - 1), radix);
found : int @@ -125,7 +113,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (ent.charAt(0) == '&' && ent.endsWith(";")) {
found : @UpperBoundLiteral(0) int @@ -136,7 +124,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (ent.charAt(1) == '#') {
found : @UpperBoundLiteral(1) int @@ -147,7 +135,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (ent.charAt(2) == 'x') {
found : @UpperBoundLiteral(2) int @@ -202,7 +190,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String[] txt = {line.substring(startColNo)};
found : int @@ -213,7 +201,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. returnValue[0] = line(startLineNo - 1).substring(startColNo);
found : int @@ -224,7 +212,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. returnValue[0] = line(startLineNo - 1).substring(startColNo,
found : int @@ -235,7 +223,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String[] txt = {line.substring(startColNo)};
found : int @@ -246,7 +234,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. returnValue[0] = line(startLineNo - 1).substring(startColNo);
found : int @@ -257,7 +245,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. returnValue[0] = line(startLineNo - 1).substring(startColNo,
found : int @@ -268,7 +256,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. endColNo + 1);
found : int @@ -279,7 +267,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. endColNo + 1);
found : int @@ -290,7 +278,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. endColNo + 1);
found : int @@ -301,7 +289,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. endColNo + 1);
found : int @@ -375,6 +363,17 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java + array.access.unsafe.high + Potentially unsafe array access: the index could be larger than the array's bound + lineBreakPositions[lineNo] = matcher.end(); +
+ found : int + required: @IndexFor("lineBreakPositions") or @LTLengthOf("lineBreakPositions") -- an integer less than lineBreakPositions's length +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java array.access.unsafe.high @@ -397,18 +396,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java - array.access.unsafe.high.range - Potentially unsafe array access: the index could be larger than the array's bound - lineBreakPositions[lineNo] = matcher.end(); -
- index type found: @IntRange(from=-2147483648) int - array type found: int [] - required : index of type @IndexFor("lineBreakPositions") or @LTLengthOf("lineBreakPositions"), or array of type @MinLen(-9223372036854775808) -
-
- src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java array.access.unsafe.low @@ -445,7 +432,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. comment.getEndColNo() + 1, codePoints.length));
found : int @@ -456,7 +443,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. comment.getEndColNo() + 1, codePoints.length));
found : int @@ -522,7 +509,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. && primitiveDataTypes.get(parameterType.getType())) {
found : int @@ -533,7 +520,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java argument - incompatible argument for parameter pos of seek. + incompatible argument for parameter pos of RandomAccessFile.seek. file.seek(file.length() - len);
found : long @@ -555,7 +542,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. expr = quotedText.substring(1, quotedText.length() - 1);
found : @UpperBoundLiteral(1) int @@ -566,7 +553,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. expr = quotedText.substring(1, quotedText.length() - 1);
found : @GTENegativeOne int @@ -577,7 +564,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return sourceNameLower.substring(startIndex, endIndex);
found : @LTEqLengthOf("sourceName") int @@ -588,7 +575,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return sourceNameLower.substring(startIndex, endIndex);
found : int @@ -599,7 +586,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. lastChild.getColumnNo() + 2, lineCodePoints.length);
found : int @@ -610,7 +597,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. lastChild.getColumnNo() + 2, lineCodePoints.length);
found : int @@ -621,7 +608,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String removePattern = regexp.substring("^.+".length());
found : @LTEqLengthOf(""^.+"") int @@ -632,7 +619,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. .substring(0, fileNameWithPath.lastIndexOf(File.separator));
found : @GTENegativeOne int @@ -643,7 +630,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. if (TYPES_HASH_SET.get(type)) {
found : int @@ -665,7 +652,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. return warning.substring(1, warning.length() - 1);
found : @UpperBoundLiteral(1) int @@ -676,7 +663,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return warning.substring(1, warning.length() - 1);
found : @GTENegativeOne int @@ -687,7 +674,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. slistColNo + 1, codePointsFirstLine.length);
found : int @@ -698,7 +685,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. slistColNo + 1, rcurlyColNo);
found : int @@ -709,7 +696,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. slistColNo + 1, codePointsFirstLine.length);
found : int @@ -720,7 +707,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. slistColNo + 1, rcurlyColNo);
found : int @@ -731,7 +718,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. || braceLine.charAt(brace.getColumnNo() + 1) != '}') {
found : int @@ -742,7 +729,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. || braceLine.charAt(brace.getColumnNo() + 1) != '}') {
found : int @@ -753,7 +740,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. token -> !IGNORED_TYPES.get(token.getType());
found : int @@ -764,7 +751,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return ASSIGN_OPERATOR_TYPES.get(parentType);
found : int @@ -775,7 +762,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return LOOP_TYPES.get(ast);
found : int @@ -786,7 +773,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. setterName = name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1);
found : @UpperBoundLiteral(1) int @@ -797,7 +784,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. setterName = name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1);
found : @UpperBoundLiteral(1) int @@ -808,7 +795,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (name.length() == 1 || !Character.isUpperCase(name.charAt(1))) {
found : @UpperBoundLiteral(1) int @@ -819,7 +806,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && illegal.charAt(pkgNameLen) == '.'
found : int @@ -830,7 +817,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && illegal.charAt(pkgNameLen) == '.'
found : int @@ -841,7 +828,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. if (memberModifiers.get(modifier.getType())) {
found : int @@ -852,7 +839,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return COMPARISON_TYPES.get(astType);
found : int @@ -863,7 +850,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. while (skipTokens.get(result.getType())) {
found : int @@ -874,7 +861,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. if (!constantWaiverParentToken.get(type)) {
found : int @@ -885,7 +872,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return MUTATION_OPERATIONS.get(iteratingExpressionAST.getType());
found : int @@ -896,7 +883,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. if (ignoreOccurrenceContext.get(type)) {
found : int @@ -907,7 +894,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.java argument - incompatible argument for parameter bitIndex of set. + incompatible argument for parameter bitIndex of BitSet.set. ignoreOccurrenceContext.set(type);
found : int @@ -918,7 +905,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return fileName.substring(0, lastSeparatorPos);
found : @GTENegativeOne int @@ -929,7 +916,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return ASSIGN_TOKENS.get(tokenType);
found : int @@ -940,7 +927,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return COMPOUND_ASSIGN_TOKENS.get(tokenType);
found : int @@ -951,7 +938,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DECLARATION_TOKENS.get(parentType);
found : int @@ -962,7 +949,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. && CLASS_MEMBER_TOKENS.get(nextSibling.getType())) {
found : int @@ -973,7 +960,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return ignoreLines.get(lineNo);
found : int @@ -984,7 +971,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return multiLines.get(lineNo + 1);
found : int @@ -995,7 +982,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. excludeMinusDotStar.length() + 1);
found : @LTLengthOf(value={"exclude.substring(0, exclude.length() - 2)", "excludeMinusDotStar"}, offset={"-2", "-2"}) int @@ -1006,7 +993,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. ruleStr.indexOf(')'));
found : @GTENegativeOne int @@ -1029,22 +1016,21 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java array.access.unsafe.high Potentially unsafe array access: the index could be larger than the array's bound - if (CommonUtil.isBlank(lines[i - 1])) { + final String import2Token = import2Tokens[i];
found : int - required: @IndexFor("lines") or @LTLengthOf("lines") -- an integer less than lines's length + required: @IndexFor("import2Tokens") or @LTLengthOf("import2Tokens") -- an integer less than import2Tokens's length
src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java - array.access.unsafe.high.range + array.access.unsafe.high Potentially unsafe array access: the index could be larger than the array's bound - final String import2Token = import2Tokens[i]; + if (CommonUtil.isBlank(lines[i - 1])) {
- index type found: @IntRange(from=-2147483648) int - array type found: String @ArrayLenRange(from=1) [] - required : index of type @IndexFor("import2Tokens") or @LTLengthOf("import2Tokens"), or array of type @MinLen(-9223372036854775808) + found : int + required: @IndexFor("lines") or @LTLengthOf("lines") -- an integer less than lines's length
@@ -1062,7 +1048,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return qualifiedImportName.substring(0, lastDotIndex);
found : @GTENegativeOne int @@ -1073,7 +1059,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && (pkg.length() == length || pkg.charAt(length) == '.');
found : @LTEqLengthOf("this.fullPackageName") int @@ -1084,7 +1070,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. final String front = importName.substring(0, index);
found : @GTENegativeOne int @@ -1095,7 +1081,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. while (Character.isWhitespace(line.charAt(index))) {
found : int @@ -1106,7 +1092,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && Character.isWhitespace(line.charAt(realColumnNo))) {
found : int @@ -1139,7 +1125,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && Character.isWhitespace(line.charAt(realColumnNo))) {
found : int @@ -1227,20 +1213,19 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java - array.access.unsafe.high.range + array.access.unsafe.high Potentially unsafe array access: the index could be larger than the array's bound types[index] = val;
- index type found: @IntRange(from=-2147483648) int - array type found: int [] - required : index of type @IndexFor("types") or @LTLengthOf("types"), or array of type @MinLen(-9223372036854775808) + found : int + required: @IndexFor("types") or @LTLengthOf("types") -- an integer less than types's length
src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return levels.get(indent);
found : int @@ -1251,7 +1236,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java argument - incompatible argument for parameter bitIndex of set. + incompatible argument for parameter bitIndex of BitSet.set. levels.set(i + offset);
found : int @@ -1262,7 +1247,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java argument - incompatible argument for parameter bitIndex of set. + incompatible argument for parameter bitIndex of BitSet.set. levels.set(indent);
found : int @@ -1273,7 +1258,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java argument - incompatible argument for parameter bitIndex of set. + incompatible argument for parameter bitIndex of BitSet.set. result.levels.set(addition);
found : int @@ -1284,7 +1269,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. while (Character.isWhitespace(line.charAt(index))) {
found : int @@ -1295,7 +1280,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return PARENT_TOKEN_TYPES.get(parentType);
found : int @@ -1306,7 +1291,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. if (target.get(parentType)) {
found : int @@ -1317,7 +1302,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. return text.substring(startOfText, endOfText);
found : int @@ -1328,7 +1313,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. return text.substring(startOfText, endOfText);
found : int @@ -1339,7 +1324,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return text.substring(startOfText, endOfText);
found : int @@ -1350,7 +1335,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. return position != text.length() - 1 && text.charAt(position + 1) == '/';
found : int @@ -1361,7 +1346,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. return position != text.length() - 1 && text.charAt(position + 1) == '/';
found : int @@ -1369,6 +1354,50 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java + array.access.unsafe.high + Potentially unsafe array access: the index could be larger than the array's bound + final String lastLine = fileLines[javadocEndToken.getLineNo() - 1]; +
+ found : int + required: @IndexFor("this.fileLines") or @LTLengthOf("this.fileLines") -- an integer less than this.fileLines's length +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java + array.access.unsafe.high + Potentially unsafe array access: the index could be larger than the array's bound + final String startLine = fileLines[rootAst.getLineNumber() - 1]; +
+ found : int + required: @IndexFor("this.fileLines") or @LTLengthOf("this.fileLines") -- an integer less than this.fileLines's length +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java + array.access.unsafe.low + Potentially unsafe array access: the index could be negative. + final String lastLine = fileLines[javadocEndToken.getLineNo() - 1]; +
+ found : int + required: an integer >= 0 (@NonNegative or @Positive) +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java + array.access.unsafe.low + Potentially unsafe array access: the index could be negative. + final String startLine = fileLines[rootAst.getLineNumber() - 1]; +
+ found : int + required: an integer >= 0 (@NonNegative or @Positive) +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java array.access.unsafe.high @@ -1394,7 +1423,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && !Character.isWhitespace(text.charAt(lastAsteriskPosition + 1))) {
found : int @@ -1405,7 +1434,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && !Character.isWhitespace(text.charAt(lastAsteriskPosition + 1))) {
found : int @@ -1416,7 +1445,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. builder.append(line.substring(textStart));
found : int @@ -1427,7 +1456,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. builder.append(line.substring(textStart));
found : int @@ -1438,19 +1467,19 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter index of charAt. - if (line.charAt(textStart) == '@') { + incompatible argument for parameter index of AbstractStringBuilder.charAt. + if (Character.isWhitespace(builder.charAt(index))) {
found : int - required: @LTLengthOf("line") int + required: @NonNegative int
src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter index of charAt. - if (Character.isWhitespace(builder.charAt(index))) { + incompatible argument for parameter index of AbstractStringBuilder.charAt. + while (builder.charAt(index - 1) == '*') {
found : int required: @NonNegative int @@ -1460,19 +1489,19 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (line.charAt(textStart) == '@') {
found : int - required: @NonNegative int + required: @LTLengthOf("line") int
src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter index of charAt. - while (builder.charAt(index - 1) == '*') { + incompatible argument for parameter index of String.charAt. + if (line.charAt(textStart) == '@') {
found : int required: @NonNegative int @@ -1482,7 +1511,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter index of deleteCharAt. + incompatible argument for parameter index of StringBuilder.deleteCharAt. builder.deleteCharAt(index - 1);
found : int @@ -1493,7 +1522,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java argument - incompatible argument for parameter index of deleteCharAt. + incompatible argument for parameter index of StringBuilder.deleteCharAt. builder.deleteCharAt(index);
found : int @@ -1526,7 +1555,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. else if (!CommonUtil.isBlank(text.substring(1, offset + 1))) {
found : @UpperBoundLiteral(1) int @@ -1537,7 +1566,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. else if (!CommonUtil.isBlank(text.substring(1, offset + 1))) {
found : int @@ -1548,7 +1577,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1559,7 +1588,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1570,7 +1599,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1581,7 +1610,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1592,7 +1621,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1603,7 +1632,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1614,7 +1643,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1625,7 +1654,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES.get(astType)
found : int @@ -1636,7 +1665,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return DEF_TOKEN_TYPES_DEPRECATED.get(astType)
found : int @@ -1658,7 +1687,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. && ALLOWED_TYPES.get(child.getType())) {
found : int @@ -1666,28 +1695,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java - argument - incompatible argument for parameter end of append. - result.append(text, 0, text.indexOf(periodSuffix) + 1); -
- found : @LTLengthOf(value="text", offset="-2") int - required: @LTEqLengthOf("text") int -
-
- - - src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java - array.access.unsafe.high - Potentially unsafe array access: the index could be larger than the array's bound - final DetailNode child = children[i]; -
- found : int - required: @IndexFor("children") or @LTLengthOf("children") -- an integer less than children's length -
-
- src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java array.access.unsafe.high.constant @@ -1790,8 +1797,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter beginIndex of substring. - text = text.substring(column).trim(); + incompatible argument for parameter beginIndex of String.substring. + text = text.substring(column);
found : int required: @NonNegative int @@ -1801,7 +1808,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. tagId = text.substring(0, position);
found : int @@ -1812,7 +1819,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. .substring(0, toPoint.getColumnNo() + 1).endsWith("-->")) {
found : int @@ -1823,7 +1830,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. .substring(0, toPoint.getColumnNo() + 1).endsWith("-->")) {
found : int @@ -1834,7 +1841,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && text[curr.getLineNo()].charAt(curr.getColumnNo()) != character) {
found : int @@ -1845,7 +1852,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. .charAt(endTag.getColumnNo() - 1) == '/';
found : int @@ -1856,7 +1863,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. && text[curr.getLineNo()].charAt(curr.getColumnNo()) != character) {
found : int @@ -1867,7 +1874,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. .charAt(endTag.getColumnNo() - 1) == '/';
found : int @@ -1878,7 +1885,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (text.charAt(column) == '/') {
found : int @@ -1889,7 +1896,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. || Character.isJavaIdentifierStart(text.charAt(column))
found : int @@ -1900,7 +1907,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. || text.charAt(column) == '/';
found : int @@ -2076,7 +2083,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String content = commentValue.substring(contentStart);
found : @GTENegativeOne int @@ -2087,7 +2094,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String content = commentValue.substring(contentStart);
found : int @@ -2098,7 +2105,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/BlockTagUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String remainder = line.substring(tagMatcher.end(1));
found : @GTENegativeOne int @@ -2109,7 +2116,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/BlockTagUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. final String remainder = line.substring(tagMatcher.end(1));
found : int @@ -2120,7 +2127,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtil.java argument - incompatible argument for parameter endIndex of subSequence. + incompatible argument for parameter endIndex of String.subSequence. final String precedingText = source.subSequence(0, index).toString();
found : int @@ -2131,7 +2138,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtil.java argument - incompatible argument for parameter endIndex of subSequence. + incompatible argument for parameter endIndex of String.subSequence. final String precedingText = source.subSequence(0, index).toString();
found : int @@ -2142,7 +2149,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. classNameWithPackage.substring(0, lastDotIndex);
found : @GTENegativeOne int @@ -2153,7 +2160,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. result = str.substring(beginIndex);
found : int @@ -2164,7 +2171,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. result = str.substring(beginIndex, endIndex);
found : int @@ -2175,7 +2182,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. result = str.substring(beginIndex);
found : int @@ -2186,7 +2193,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. result = str.substring(beginIndex, endIndex);
found : int @@ -2197,7 +2204,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. result = str.substring(beginIndex, endIndex);
found : int @@ -2208,7 +2215,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. result = str.substring(beginIndex, endIndex);
found : int @@ -2219,7 +2226,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/SinglelineDetector.java argument - incompatible argument for parameter start of find. + incompatible argument for parameter start of Matcher.find. final boolean foundMatch = matcher.find(startPosition);
found : int @@ -2230,7 +2237,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java argument - incompatible argument for parameter bitIndex of set. + incompatible argument for parameter bitIndex of BitSet.set. usedLines.set(lineIndex);
found : int @@ -2241,7 +2248,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java argument - incompatible argument for parameter fromIndex of set. + incompatible argument for parameter fromIndex of BitSet.set. usedLines.set(lineIndex, endLineIndex + 1);
found : int @@ -2252,7 +2259,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java argument - incompatible argument for parameter toIndex of set. + incompatible argument for parameter toIndex of BitSet.set. usedLines.set(lineIndex, endLineIndex + 1);
found : int @@ -2362,7 +2369,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return acceptableTokens.get(ast.getType());
found : int @@ -2373,7 +2380,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. Arrays.copyOfRange(currentLine, colNo + text.length(), currentLine.length)
found : @LTLengthOf(value={"ast.getText()", "text"}, offset={"-colNo - 1", "-colNo - 1"}) int @@ -2384,7 +2391,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.java argument - incompatible argument for parameter from of copyOfRange. + incompatible argument for parameter from of Arrays.copyOfRange. Arrays.copyOfRange(currentLine, colNo + text.length(), currentLine.length)
found : int @@ -2498,7 +2505,7 @@ return COLUMN_NAMES[column];
found : int - required: @IndexFor("com.puppycrawl.tools.checkstyle.gui.ParseTreeTablePresentation.COLUMN_NAMES") or @LTLengthOf("com.puppycrawl.tools.checkstyle.gui.ParseTreeTablePresentation.COLUMN_NAMES") -- an integer less than com.puppycrawl.tools.checkstyle.gui.ParseTreeTablePresentation.COLUMN_NAMES's length + required: @IndexFor("com.puppycrawl.tools.checkstyle.gui.ParseTreeTablePresentation.class.COLUMN_NAMES") or @LTLengthOf("com.puppycrawl.tools.checkstyle.gui.ParseTreeTablePresentation.class.COLUMN_NAMES") -- an integer less than com.puppycrawl.tools.checkstyle.gui.ParseTreeTablePresentation.class.COLUMN_NAMES's length
@@ -2557,7 +2564,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. result.addLast(fileName.substring(0, fileName.length() - JAVA_FILE_EXTENSION.length()));
found : int @@ -2568,7 +2575,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return fileName.substring(0, fileName.length() - JAVA_FILE_EXTENSION.length());
found : int @@ -2579,7 +2586,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter initialCapacity of ArrayList. + incompatible argument for parameter initialCapacity of ArrayList constructor. final List<ModulePropertyDetails> result = new ArrayList<>(propertyListLength);
found : int @@ -2590,7 +2597,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter initialCapacity of ArrayList. + incompatible argument for parameter initialCapacity of ArrayList constructor. final List<String> listContent = new ArrayList<>(nodeListLength);
found : int @@ -2601,10 +2608,10 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaWriter.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. + moduleFilePath.substring(indexOfCheckstyle + 1) + xmlExtension;
- found : @LTLengthOf(value={"checkstyleString", "moduleFilePath", "moduleFilePath"}, offset={"-moduleFilePath.indexOf(checkstyleString) - 2", "-12", "-checkstyleString.length() - 2"}) int + found : @LTLengthOf(value={"checkstyleString", "moduleFilePath", "moduleFilePath"}, offset={"-moduleFilePath.indexOf(checkstyleString) - 2", "-11", "-checkstyleString.length() - 1"}) int required: @LTEqLengthOf("moduleFilePath") int
@@ -2612,18 +2619,84 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaWriter.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. + moduleFilePath.substring(0, indexOfCheckstyle) + "/meta/"
- found : @LTLengthOf(value={"checkstyleString", "moduleFilePath", "moduleFilePath"}, offset={"-moduleFilePath.indexOf(checkstyleString) - 1", "-11", "-checkstyleString.length() - 1"}) int + found : @LTLengthOf(value={"checkstyleString", "moduleFilePath", "moduleFilePath"}, offset={"-moduleFilePath.indexOf(checkstyleString) - 1", "-10", "-checkstyleString.length()"}) int required: @LTEqLengthOf("moduleFilePath") int
+ + src/main/java/com/puppycrawl/tools/checkstyle/site/ClassAndPropertiesSettersJavadocScraper.java + argument + incompatible argument for parameter beginIndex of String.substring. + return Introspector.decapitalize(setterName.substring("set".length())); +
+ found : @LTEqLengthOf(""set"") int + required: @LTEqLengthOf("setterName") int +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + argument + incompatible argument for parameter beginIndex of String.substring. + description = firstLetterCapitalized + descriptionString.substring(1); +
+ found : @UpperBoundLiteral(1) int + required: @LTEqLengthOf("descriptionString") int +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + argument + incompatible argument for parameter beginIndex of String.substring. + href = href.substring(1, href.length() - 1); +
+ found : @UpperBoundLiteral(1) int + required: @LTEqLengthOf("href") int +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + argument + incompatible argument for parameter endIndex of String.substring. + href = href.substring(1, href.length() - 1); +
+ found : @GTENegativeOne int + required: @NonNegative int +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + argument + incompatible argument for parameter endIndex of String.substring. + final String firstLetterCapitalized = descriptionString.substring(0, 1) +
+ found : @UpperBoundLiteral(1) int + required: @LTEqLengthOf("descriptionString") int +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + array.access.unsafe.high.constant + Potentially unsafe array access: the constant index 0 could be larger than the array's bound + final Class<?> parameterClass = (Class<?>) type.getActualTypeArguments()[0]; +
+ found : Type [] + required: @MinLen(1) -- an array guaranteed to have at least 1 elements +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. return variableExpression.substring(propertyStartIndex, propertyEndIndex);
found : @GTENegativeOne int @@ -2634,7 +2707,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. returnString = line.substring(indent, lastNonWhitespace);
found : int @@ -2645,7 +2718,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. returnString = line.substring(indent, lastNonWhitespace);
found : int @@ -2656,7 +2729,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. returnString = line.substring(indent, lastNonWhitespace);
found : int @@ -2667,7 +2740,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. final boolean negative = txt.charAt(0) == '-';
found : @UpperBoundLiteral(0) int @@ -2678,7 +2751,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseInt. + incompatible argument for parameter radix of Integer.parseInt. result = Integer.parseInt(txt, radix);
found : int @@ -2689,7 +2762,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseInt. + incompatible argument for parameter radix of Integer.parseInt. result = Integer.parseInt(txt, radix);
found : int @@ -2700,8 +2773,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseLong. - result = Long.parseLong(txt, radix); + incompatible argument for parameter radix of Integer.parseUnsignedInt. + result = Integer.parseUnsignedInt(txt, radix);
found : int required: @IntRange(from=2, to=36) int @@ -2711,8 +2784,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseLong. - result = Long.parseLong(txt, radix); + incompatible argument for parameter radix of Integer.parseUnsignedInt. + result = Integer.parseUnsignedInt(txt, radix);
found : int required: @Positive int @@ -2722,8 +2795,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseUnsignedInt. - result = Integer.parseUnsignedInt(txt, radix); + incompatible argument for parameter radix of Long.parseLong. + result = Long.parseLong(txt, radix);
found : int required: @IntRange(from=2, to=36) int @@ -2733,8 +2806,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseUnsignedInt. - result = Integer.parseUnsignedInt(txt, radix); + incompatible argument for parameter radix of Long.parseLong. + result = Long.parseLong(txt, radix);
found : int required: @Positive int @@ -2744,7 +2817,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseUnsignedLong. + incompatible argument for parameter radix of Long.parseUnsignedLong. result = Long.parseUnsignedLong(txt, radix);
found : int @@ -2755,7 +2828,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseUnsignedLong. + incompatible argument for parameter radix of Long.parseUnsignedLong. result = Long.parseUnsignedLong(txt, radix);
found : int @@ -2763,24 +2836,13 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/utils/CodePointUtil.java - argument - incompatible argument for parameter from of copyOfRange. - return Arrays.copyOfRange(codePoints, startIndex, codePoints.length); -
- found : int - required: @LTEqLengthOf("codePoints") int -
-
- src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. .substring(lastIndexOfClasspathProtocol));
- found : @LTEqLengthOf("com.puppycrawl.tools.checkstyle.utils.CommonUtil.CLASSPATH_URL_PROTOCOL") int + found : @LTEqLengthOf("com.puppycrawl.tools.checkstyle.utils.CommonUtil.class.CLASSPATH_URL_PROTOCOL") int required: @LTEqLengthOf("filename") int
@@ -2788,7 +2850,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (filename.charAt(0) == '/') {
found : @UpperBoundLiteral(0) int @@ -2799,7 +2861,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. isIdentifier = Character.isJavaIdentifierStart(str.charAt(0));
found : @UpperBoundLiteral(0) int @@ -2810,7 +2872,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter index of charAt. + incompatible argument for parameter index of String.charAt. if (!Character.isWhitespace(line.charAt(i))) {
found : int @@ -2821,7 +2883,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter index of codePointAt. + incompatible argument for parameter index of String.codePointAt. if (inputString.codePointAt(idx) == '\t') {
found : int @@ -2865,7 +2927,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/JavadocUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. return commentContent.getText().substring(1);
found : @UpperBoundLiteral(1) int @@ -2966,10 +3028,21 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java + argument + incompatible argument for parameter newLength of Arrays.copyOf. + return Arrays.copyOf(array, length); +
+ found : int + required: @NonNegative int +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java argument - incompatible argument for parameter beginIndex of substring. + incompatible argument for parameter beginIndex of String.substring. text = text.substring(1, text.length() - 1);
found : @UpperBoundLiteral(1) int @@ -2980,7 +3053,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java argument - incompatible argument for parameter bitIndex of get. + incompatible argument for parameter bitIndex of BitSet.get. return TOKEN_TYPES_WITH_TEXT_ATTRIBUTE.get(ast.getType());
found : int @@ -2991,7 +3064,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/XpathUtil.java argument - incompatible argument for parameter endIndex of substring. + incompatible argument for parameter endIndex of String.substring. text = text.substring(1, text.length() - 1);
found : @GTENegativeOne int diff --git a/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml b/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml index 25509e2971a..4326d43f245 100644 --- a/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml +++ b/config/checker-framework-suppressions/checker-lock-tainting-suppressions.xml @@ -44,13 +44,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/Main.java - method.guarantee.violated - @SideEffectFree method toString calls method name with a weaker @ReleasesNoLocks side effect guarantee - return name().toLowerCase(Locale.ROOT); - - src/main/java/com/puppycrawl/tools/checkstyle/Main.java methodref.receiver.bound @@ -89,7 +82,7 @@
found : @GuardSatisfied Entry<@GuardedBy String, @GuardedBy String> required: @GuardedBy Entry<@GuardedBy String, @GuardedBy String> - Consequence: method in @GuardedBy Entry<@GuardedBy String, @GuardedBy String> + Consequence: method in @GuardedBy Entry<K extends @GuardedBy Object, V extends @GuardedBy Object> @GuardedBy String getKey(@GuardSatisfied Entry<@GuardedBy String, @GuardedBy String> this) is not a valid method reference for method in @GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy String>, @GuardedBy String> @GuardedBy String apply(@GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy String>, @GuardedBy String> this, @GuardedBy Entry<@GuardedBy String, @GuardedBy String> p0) @@ -100,7 +93,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java methodref.receiver.bound Incompatible receiver type - .collect(Collectors.toMap(Function.identity(), properties::getProperty)); + Collectors.toUnmodifiableMap(Function.identity(), properties::getProperty));
found : @GuardedBy Properties required: @GuardSatisfied Properties @@ -115,14 +108,14 @@ src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java methodref.receiver Incompatible receiver type - .thenComparing(AbstractCheck::hashCode)); + .thenComparingInt(AbstractCheck::hashCode));
found : @GuardSatisfied Object required: @GuardedBy AbstractCheck Consequence: method in @GuardedBy AbstractCheck @GuardedBy int hashCode(@GuardSatisfied Object this) - is not a valid method reference for method in @GuardedBy Function<@GuardedBy AbstractCheck, @GuardedBy Integer> - @GuardedBy Integer apply(@GuardedBy Function<@GuardedBy AbstractCheck, @GuardedBy Integer> this, @GuardedBy AbstractCheck p0) + is not a valid method reference for method in @GuardedBy ToIntFunction<@GuardedBy AbstractCheck> + @GuardedBy int applyAsInt(@GuardedBy ToIntFunction<@GuardedBy AbstractCheck> this, @GuardedBy AbstractCheck p0)
@@ -145,14 +138,14 @@ src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java method.guarantee.violated @Pure method resolveEntity calls method getClassLoader with a weaker @ReleasesNoLocks side effect guarantee - getClass().getClassLoader(); + final ClassLoader loader = getClass().getClassLoader(); src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java method.guarantee.violated @Pure method resolveEntity calls method getResourceAsStream with a weaker @ReleasesNoLocks side effect guarantee - loader.getResourceAsStream(dtdResourceName); + final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName); @@ -439,16 +432,21 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java - methodref.param - Incompatible parameter type for obj + type.arguments.not.inferred + Could not infer type arguments for Stream.iterate Stream.iterate(startNode.getLastChild(), Objects::nonNull,
- found : @GuardSatisfied Object - required: @GuardedBy DetailAST - Consequence: method in @GuardedBy Objects - @GuardedBy boolean nonNull(@GuardSatisfied Object p0) - is not a valid method reference for method in @GuardedBy Predicate<@GuardedBy DetailAST> - @GuardedBy boolean test(@GuardedBy Predicate<@GuardedBy DetailAST> this, @GuardedBy DetailAST p0) + unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ConstructorsDeclarationGroupingCheck.java + type.arguments.not.inferred + Could not infer type arguments for Optional.map + .map(children::indexOf); +
+ unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object
@@ -505,7 +503,7 @@
found : @GuardSatisfied Entry<@GuardedBy String, @GuardedBy ClassDesc> required: @GuardedBy Entry<@GuardedBy String, @GuardedBy ClassDesc> - Consequence: method in @GuardedBy Entry<@GuardedBy String, @GuardedBy ClassDesc> + Consequence: method in @GuardedBy Entry<K extends @GuardedBy Object, V extends @GuardedBy Object> @GuardedBy ClassDesc getValue(@GuardSatisfied Entry<@GuardedBy String, @GuardedBy ClassDesc> this) is not a valid method reference for method in @GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy ClassDesc>, @GuardedBy ClassDesc> @GuardedBy ClassDesc apply(@GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy ClassDesc>, @GuardedBy ClassDesc> this, @GuardedBy Entry<@GuardedBy String, @GuardedBy ClassDesc> p0) @@ -541,6 +539,16 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java + type.arguments.not.inferred + Could not infer type arguments for Stream.collect + .collect(Collectors.joining(", ")), +
+ unsatisfiable constraint: @GuardedBy String <: @GuardSatisfied Object +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java override.receiver @@ -630,21 +638,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java - methodref.receiver.bound - Incompatible receiver type - .forEach(excludeClassesRegexps::add); -
- found : @GuardedBy List<@GuardedBy Pattern> - required: @GuardSatisfied List<@GuardedBy Pattern> - Consequence: method - @GuardedBy List<@GuardedBy Pattern> - is not a valid method reference for method in @GuardedBy List<@GuardedBy Pattern> - @GuardedBy boolean add(@GuardSatisfied List<@GuardedBy Pattern> this, @GuardedBy Pattern p0) -
-
- src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AccessModifierOption.java method.guarantee.violated @@ -669,16 +662,11 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.java - methodref.param - Incompatible parameter type for obj - node.getLastChild(), Objects::nonNull, DetailAST::getPreviousSibling + type.arguments.not.inferred + Could not infer type arguments for Stream.iterate + Stream.iterate(
- found : @GuardSatisfied Object - required: @GuardedBy DetailAST - Consequence: method in @GuardedBy Objects - @GuardedBy boolean nonNull(@GuardSatisfied Object p0) - is not a valid method reference for method in @GuardedBy Predicate<@GuardedBy DetailAST> - @GuardedBy boolean test(@GuardedBy Predicate<@GuardedBy DetailAST> this, @GuardedBy DetailAST p0) + unsatisfiable constraint: @GuardedBy DetailAST <: @GuardSatisfied Object
@@ -839,6 +827,69 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + && Objects.equals(getPatternSafely(checkRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + && Objects.equals(getPatternSafely(messageRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(suppressElement.checkRegexp)) + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(suppressElement.fileRegexp)) + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(suppressElement.messageRegexp)) + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + return Objects.equals(getPatternSafely(fileRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method hashCode calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(messageRegexp), moduleId, linesCsv, columnsCsv); + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method hashCode calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + return Objects.hash(getPatternSafely(fileRegexp), getPatternSafely(checkRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + method.guarantee.violated + @Pure method hashCode calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + return Objects.hash(getPatternSafely(fileRegexp), getPatternSafely(checkRegexp), + + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java override.param @@ -1109,6 +1160,69 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + && Objects.equals(getPatternSafely(checkRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + && Objects.equals(getPatternSafely(messageRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(xpathFilter.checkRegexp)) + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(xpathFilter.fileRegexp)) + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(xpathFilter.messageRegexp)) + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method equals calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + return Objects.equals(getPatternSafely(fileRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method hashCode calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + getPatternSafely(messageRegexp), moduleId, xpathQuery); + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method hashCode calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + return Objects.hash(getPatternSafely(fileRegexp), getPatternSafely(checkRegexp), + + + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java + method.guarantee.violated + @Pure method hashCode calls method getPatternSafely with a weaker @ReleasesNoLocks side effect guarantee + return Objects.hash(getPatternSafely(fileRegexp), getPatternSafely(checkRegexp), + + src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java override.param @@ -1170,17 +1284,32 @@ - src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java - methodref.receiver + src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.java + override.receiver Incompatible receiver type - .collect(BitSet::new, BitSet::set, BitSet::or); + public void println() {
- found : @GuardSatisfied BitSet - required: @GuardedBy BitSet - Consequence: method in @GuardedBy BitSet - void or(@GuardSatisfied BitSet this, @GuardedBy BitSet p0) - is not a valid method reference for method in @GuardedBy BiConsumer<@GuardedBy BitSet, @GuardedBy BitSet> - void accept(@GuardedBy BiConsumer<@GuardedBy BitSet, @GuardedBy BitSet> this, @GuardedBy BitSet p0, @GuardedBy BitSet p1) + found : @GuardedBy CustomPrintWriter + required: @GuardSatisfied PrintWriter + Consequence: method in @GuardedBy CustomPrintWriter + void println(@GuardedBy CustomPrintWriter this) + cannot override method in @GuardedBy PrintWriter + void println(@GuardSatisfied PrintWriter this) +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.java + override.receiver + Incompatible receiver type + public void write(String line, int offset, int length) { +
+ found : @GuardedBy CustomPrintWriter + required: @GuardSatisfied PrintWriter + Consequence: method in @GuardedBy CustomPrintWriter + void write(@GuardedBy CustomPrintWriter this, @GuardedBy String p0, @GuardedBy int p1, @GuardedBy int p2) + cannot override method in @GuardedBy PrintWriter + void write(@GuardSatisfied PrintWriter this, @GuardedBy String p0, @GuardedBy int p1, @GuardedBy int p2)
@@ -1188,14 +1317,14 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java methodref.receiver Incompatible receiver type - .collect(BitSet::new, BitSet::set, BitSet::or); + .collect(Collectors.toUnmodifiableMap(Map.Entry::getValue, Map.Entry::getKey));
- found : @GuardSatisfied BitSet - required: @GuardedBy BitSet - Consequence: method in @GuardedBy BitSet - void or(@GuardSatisfied BitSet this, @GuardedBy BitSet p0) - is not a valid method reference for method in @GuardedBy BiConsumer<@GuardedBy BitSet, @GuardedBy BitSet> - void accept(@GuardedBy BiConsumer<@GuardedBy BitSet, @GuardedBy BitSet> this, @GuardedBy BitSet p0, @GuardedBy BitSet p1) + found : @GuardSatisfied Entry<@GuardedBy String, @GuardedBy Integer> + required: @GuardedBy Entry<@GuardedBy String, @GuardedBy Integer> + Consequence: method in @GuardedBy Entry<K extends @GuardedBy Object, V extends @GuardedBy Object> + @GuardedBy Integer getValue(@GuardSatisfied Entry<@GuardedBy String, @GuardedBy Integer> this) + is not a valid method reference for method in @GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy Integer>, @GuardedBy Integer> + @GuardedBy Integer apply(@GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy Integer>, @GuardedBy Integer> this, @GuardedBy Entry<@GuardedBy String, @GuardedBy Integer> p0)
@@ -1203,29 +1332,44 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java methodref.receiver Incompatible receiver type + .collect(Collectors.toUnmodifiableMap(Map.Entry::getValue, Map.Entry::getKey)); +
+ found : @GuardSatisfied Entry<@GuardedBy String, @GuardedBy Integer> + required: @GuardedBy Entry<@GuardedBy String, @GuardedBy Integer> + Consequence: method in @GuardedBy Entry<K extends @GuardedBy Object, V extends @GuardedBy Object> + @GuardedBy String getKey(@GuardSatisfied Entry<@GuardedBy String, @GuardedBy Integer> this) + is not a valid method reference for method in @GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy Integer>, @GuardedBy String> + @GuardedBy String apply(@GuardedBy Function<@GuardedBy Entry<@GuardedBy String, @GuardedBy Integer>, @GuardedBy String> this, @GuardedBy Entry<@GuardedBy String, @GuardedBy Integer> p0) +
+ + + + src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java + type.arguments.not.inferred + Could not infer type arguments for IntStream.collect .collect(BitSet::new, BitSet::set, BitSet::or);
- found : @GuardSatisfied BitSet - required: @GuardedBy BitSet - Consequence: method in @GuardedBy BitSet - void set(@GuardSatisfied BitSet this, @GuardedBy int p0) - is not a valid method reference for method in @GuardedBy ObjIntConsumer<@GuardedBy BitSet> - void accept(@GuardedBy ObjIntConsumer<@GuardedBy BitSet> this, @GuardedBy BitSet p0, @GuardedBy int p1) + unsatisfiable constraint: @GuardedBy BitSet <: @GuardSatisfied BitSet
src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java - methodref.receiver - Incompatible receiver type + type.arguments.not.inferred + Could not infer type arguments for IntStream.collect .collect(BitSet::new, BitSet::set, BitSet::or);
- found : @GuardSatisfied BitSet - required: @GuardedBy BitSet - Consequence: method in @GuardedBy BitSet - void set(@GuardSatisfied BitSet this, @GuardedBy int p0) - is not a valid method reference for method in @GuardedBy ObjIntConsumer<@GuardedBy BitSet> - void accept(@GuardedBy ObjIntConsumer<@GuardedBy BitSet> this, @GuardedBy BitSet p0, @GuardedBy int p1) + unsatisfiable constraint: @GuardedBy BitSet <: @GuardSatisfied BitSet +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.collect + .collect(Collectors.toUnmodifiableMap( +
+ unsatisfiable constraint: @GuardedBy Field <: @GuardSatisfied Field
diff --git a/config/checker-framework-suppressions/checker-methods-resource-fenum-suppressions.xml b/config/checker-framework-suppressions/checker-methods-resource-fenum-suppressions.xml index 72a758cbf19..ada00f50579 100644 --- a/config/checker-framework-suppressions/checker-methods-resource-fenum-suppressions.xml +++ b/config/checker-framework-suppressions/checker-methods-resource-fenum-suppressions.xml @@ -3,22 +3,22 @@ src/main/java/com/puppycrawl/tools/checkstyle/Main.java required.method.not.called - @MustCall method close may not have been invoked on out or any of its aliases. - final OutputStream out = getOutputStream(outputLocation); + @MustCall method close may not have been invoked on getOutputStream(options.outputPath) or any of its aliases. + listener = new XpathFileGeneratorAuditListener(getOutputStream(options.outputPath),
The type of object is: java.io.OutputStream. - Reason for going out of scope: possible exceptional exit due to format.createListener(out, closeOutputStreamOption) with exception type java.io.IOException + Reason for going out of scope: regular method exit
src/main/java/com/puppycrawl/tools/checkstyle/Main.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - listener = new XpathFileGeneratorAuditListener(getOutputStream(options.outputPath), + @MustCall method close may not have been invoked on out or any of its aliases. + final OutputStream out = getOutputStream(outputLocation);
The type of object is: java.io.OutputStream. - Reason for going out of scope: regular method exit + Reason for going out of scope: possible exceptional exit due to format.createListener(out, closeOutputStreamOption) with exception type java.io.IOException
@@ -37,7 +37,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java required.method.not.called @MustCall method close may not have been invoked on dtdIs or any of its aliases. - final InputStream dtdIs = + final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName);
The type of object is: java.io.InputStream. Reason for going out of scope: regular method exit @@ -47,19 +47,19 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on debug or any of its aliases. - final OutputStream debug = new LogOutputStream(this, Project.MSG_DEBUG); + @MustCall method close may not have been invoked on Files.newOutputStream(toFile.toPath()) or any of its aliases. + sarifLogger = new SarifLogger(Files.newOutputStream(toFile.toPath()),
The type of object is: java.io.OutputStream. - Reason for going out of scope: regular method exit + Reason for going out of scope: possible exceptional exit due to new SarifLogger(Files.newOutputStream(toFile.toPath()), OutputStreamOptions.CLOSE) with exception type java.io.IOException
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on err or any of its aliases. - final OutputStream err = new LogOutputStream(this, Project.MSG_ERR); + @MustCall method close may not have been invoked on Files.newOutputStream(toFile.toPath()) or any of its aliases. + xmlLogger = new XMLLogger(Files.newOutputStream(toFile.toPath()),
The type of object is: java.io.OutputStream. Reason for going out of scope: regular method exit @@ -69,8 +69,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on infoStream or any of its aliases. - final OutputStream infoStream = Files.newOutputStream(toFile.toPath()); + @MustCall method close may not have been invoked on debug or any of its aliases. + final OutputStream debug = new LogOutputStream(this, Project.MSG_DEBUG);
The type of object is: java.io.OutputStream. Reason for going out of scope: regular method exit @@ -80,19 +80,19 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - sarifLogger = new SarifLogger(Files.newOutputStream(toFile.toPath()), + @MustCall method close may not have been invoked on err or any of its aliases. + final OutputStream err = new LogOutputStream(this, Project.MSG_ERR);
The type of object is: java.io.OutputStream. - Reason for going out of scope: possible exceptional exit due to new SarifLogger(Files.newOutputStream(toFile.toPath()), OutputStreamOptions.CLOSE) with exception type java.io.IOException + Reason for going out of scope: regular method exit
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - xmlLogger = new XMLLogger(Files.newOutputStream(toFile.toPath()), + @MustCall method close may not have been invoked on infoStream or any of its aliases. + final OutputStream infoStream = Files.newOutputStream(toFile.toPath());
The type of object is: java.io.OutputStream. Reason for going out of scope: regular method exit @@ -102,19 +102,19 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - sarifLogger = new SarifLogger(new LogOutputStream(task, Project.MSG_INFO), + @MustCall method close may not have been invoked on new LogOutputStream(task, Project.MSG_DEBUG) or any of its aliases. + new LogOutputStream(task, Project.MSG_DEBUG),
The type of object is: org.apache.tools.ant.taskdefs.LogOutputStream. - Reason for going out of scope: possible exceptional exit due to new SarifLogger(new LogOutputStream(task, Project.MSG_INFO), OutputStreamOptions.CLOSE) with exception type java.io.IOException + Reason for going out of scope: regular method exit
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - new LogOutputStream(task, Project.MSG_DEBUG), + @MustCall method close may not have been invoked on new LogOutputStream(task, Project.MSG_ERR) or any of its aliases. + new LogOutputStream(task, Project.MSG_ERR),
The type of object is: org.apache.tools.ant.taskdefs.LogOutputStream. Reason for going out of scope: regular method exit @@ -124,18 +124,18 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - new LogOutputStream(task, Project.MSG_ERR), + @MustCall method close may not have been invoked on new LogOutputStream(task, Project.MSG_INFO) or any of its aliases. + sarifLogger = new SarifLogger(new LogOutputStream(task, Project.MSG_INFO),
The type of object is: org.apache.tools.ant.taskdefs.LogOutputStream. - Reason for going out of scope: regular method exit + Reason for going out of scope: possible exceptional exit due to new SarifLogger(new LogOutputStream(task, Project.MSG_INFO), OutputStreamOptions.CLOSE) with exception type java.io.IOException
src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on new LogOutputStream(task, Project.MSG_INFO) or any of its aliases. xmlLogger = new XMLLogger(new LogOutputStream(task, Project.MSG_INFO),
The type of object is: org.apache.tools.ant.taskdefs.LogOutputStream. @@ -154,21 +154,10 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java - return - incompatible types in return. - return resultHandler; -
- type of expression: @MustCallUnknown AbstractExpressionHandler - method return type: @MustCall AbstractExpressionHandler -
-
- src/main/java/com/puppycrawl/tools/checkstyle/gui/MainFrame.java argument - incompatible argument for parameter horizontalAlignment of JLabel. + incompatible argument for parameter horizontalAlignment of JLabel constructor. final JLabel modesLabel = new JLabel("Modes:", SwingConstants.RIGHT);
found : @SwingHorizontalOrientation int @@ -179,14 +168,70 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on XmlMetaReader.class.getResourceAsStream("/" + fileName) or any of its aliases. moduleDetails = read(XmlMetaReader.class.getResourceAsStream("/" + fileName),
The type of object is: java.io.InputStream. + Reason for going out of scope: possible exceptional exit due to throw new IllegalStateException("Problem to read all modules including third party if any. Problem detected at file: " + fileName, ex); with exception type java.lang.IllegalStateException +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + methodref.param + Incompatible parameter type for obj + .mapToInt(int.class::cast); +
+ found : @FenumUnqualified Object + required: capture extends @FenumTop Object + Consequence: method in @FenumUnqualified Class<@FenumUnqualified Integer> + @FenumUnqualified Integer cast(@FenumUnqualified Class<@FenumUnqualified Integer> this, @FenumUnqualified Object p0) + is not a valid method reference for method in @FenumUnqualified ToIntFunction<capture extends @FenumTop Object> + @FenumUnqualified int applyAsInt(@FenumUnqualified ToIntFunction<capture extends @FenumTop Object> this, capture extends @FenumTop Object p0) +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.map + .map(Pattern.class::cast) +
+ unsatisfiable constraint: capture extends @FenumTop Object <: @FenumUnqualified Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.map + .map(String.class::cast) +
+ unsatisfiable constraint: capture extends @FenumTop Object <: @FenumUnqualified Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.java + required.method.not.called + @MustCall method close may not have been invoked on new CustomPrintWriter(writer) or any of its aliases. + super(new CustomPrintWriter(writer)); +
+ The type of object is: com.puppycrawl.tools.checkstyle.site.XdocsTemplateSink.CustomPrintWriter. Reason for going out of scope: regular method exit
+ + src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.map + .map(elementType::cast) +
+ unsatisfiable constraint: S extends @FenumTop Object <: @FenumUnqualified Object +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractNode.java required.method.not.called @@ -201,7 +246,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on SingleNodeIterator.makeIterator(start) or any of its aliases. descendantEnum = SingleNodeIterator.makeIterator(start);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -212,7 +257,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on queue.poll().iterateAxis(AxisInfo.CHILD) or any of its aliases. descendantEnum = queue.poll().iterateAxis(AxisInfo.CHILD);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -223,7 +268,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.CHILD) or any of its aliases. descendantEnum = start.iterateAxis(AxisInfo.CHILD);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -234,8 +279,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - ancestorEnum = start.iterateAxis(AxisInfo.ANCESTOR); + @MustCall method close may not have been invoked on parent.iterateAxis(AxisInfo.FOLLOWING_SIBLING) or any of its aliases. + siblingEnum = parent.iterateAxis(AxisInfo.FOLLOWING_SIBLING);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. Reason for going out of scope: regular method exit @@ -245,7 +290,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on result.iterateAxis(AxisInfo.DESCENDANT) or any of its aliases. descendantEnum = result.iterateAxis(AxisInfo.DESCENDANT);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -256,8 +301,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - siblingEnum = parent.iterateAxis(AxisInfo.FOLLOWING_SIBLING); + @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.ANCESTOR) or any of its aliases. + ancestorEnum = start.iterateAxis(AxisInfo.ANCESTOR);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. Reason for going out of scope: regular method exit @@ -267,7 +312,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.FOLLOWING_SIBLING) or any of its aliases. siblingEnum = start.iterateAxis(AxisInfo.FOLLOWING_SIBLING);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -278,7 +323,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on new ReverseDescendantIterator(result) or any of its aliases. descendantEnum = new ReverseDescendantIterator(result);
The type of object is: com.puppycrawl.tools.checkstyle.xpath.iterators.ReverseDescendantIterator. @@ -289,8 +334,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - ancestorEnum = start.iterateAxis(AxisInfo.ANCESTOR); + @MustCall method close may not have been invoked on result.iterateAxis(AxisInfo.PRECEDING_SIBLING) or any of its aliases. + previousSiblingEnum = result.iterateAxis(AxisInfo.PRECEDING_SIBLING);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. Reason for going out of scope: regular method exit @@ -300,8 +345,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. - previousSiblingEnum = result.iterateAxis(AxisInfo.PRECEDING_SIBLING); + @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.ANCESTOR) or any of its aliases. + ancestorEnum = start.iterateAxis(AxisInfo.ANCESTOR);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. Reason for going out of scope: regular method exit @@ -311,7 +356,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.PRECEDING_SIBLING) or any of its aliases. previousSiblingEnum = start.iterateAxis(AxisInfo.PRECEDING_SIBLING);
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -322,7 +367,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseDescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on queue.poll().iterateAxis(AxisInfo.CHILD) or any of its aliases. pushToStack(queue.poll().iterateAxis(AxisInfo.CHILD));
The type of object is: net.sf.saxon.tree.iter.AxisIterator. @@ -333,7 +378,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseDescendantIterator.java required.method.not.called - @MustCall method close may not have been invoked on temp-var or any of its aliases. + @MustCall method close may not have been invoked on start.iterateAxis(AxisInfo.CHILD) or any of its aliases. pushToStack(start.iterateAxis(AxisInfo.CHILD));
The type of object is: net.sf.saxon.tree.iter.AxisIterator. diff --git a/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml b/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml index d0fe1c5f16e..539e9a3e58f 100644 --- a/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml +++ b/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml @@ -7,17 +7,6 @@ private Configuration configuration; - - src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java - return - incompatible types in return. - return result; -
- type of expression: @Initialized @Nullable URI - method return type: @Initialized @NonNull Object -
-
- src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java toarray.nullable.elements.not.newarray @@ -35,7 +24,18 @@ src/main/java/com/puppycrawl/tools/checkstyle/Checker.java argument - incompatible argument for parameter args of Violation. + incompatible argument for parameter args of Checker.getLocalizedMessage. + getLocalizedMessage("Checker.setupChildModule", name, ex.getMessage()), ex); +
+ found : @Initialized @Nullable String + required: @Initialized @NonNull Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/Checker.java + argument + incompatible argument for parameter args of Violation constructor. new String[] {ioe.getMessage()}, null, getClass(), null));
found : @Initialized @Nullable String @Initialized @NonNull [] @@ -46,7 +46,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/Checker.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. new String[] {ioe.getMessage()}, null, getClass(), null));
found : null (NullType) @@ -57,7 +57,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/Checker.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. null, getClass(), null));
found : null (NullType) @@ -68,7 +68,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/Checker.java argument - incompatible argument for parameter moduleId of Violation. + incompatible argument for parameter moduleId of Violation constructor. new String[] {ioe.getMessage()}, null, getClass(), null));
found : null (NullType) @@ -79,7 +79,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/Checker.java argument - incompatible argument for parameter moduleId of Violation. + incompatible argument for parameter moduleId of Violation constructor. null, getClass(), null));
found : null (NullType) @@ -87,21 +87,10 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/Checker.java - assignment - incompatible types in assignment. - fileExtensions = null; -
- found : null (NullType) - required: @Initialized @NonNull String @Initialized @NonNull [] -
-
- src/main/java/com/puppycrawl/tools/checkstyle/Checker.java initialization.fields.uninitialized - the constructor does not initialize fields: basedir, moduleFactory, moduleClassLoader, childContext, cacheFile + the constructor does not initialize fields: basedir, moduleFactory, moduleClassLoader, childContext, fileExtensions, cacheFile public Checker() { @@ -119,7 +108,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java argument - incompatible argument for parameter arg0 of add. + incompatible argument for parameter arg0 of Collection.add. fragments.add(null);
found : null (NullType) @@ -323,7 +312,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java argument - incompatible argument for parameter child of addChild. + incompatible argument for parameter child of DetailAstImpl.addChild. bop.addChild(descendantList.poll());
found : @Initialized @Nullable DetailAstImpl @@ -348,42 +337,42 @@ src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElseGet(() -> createImaginary(TokenTypes.ELIST)); src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElseGet(() -> createImaginary(TokenTypes.ELIST)); src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElseGet(() -> createImaginary(TokenTypes.ELIST)); src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElseGet(() -> createImaginary(TokenTypes.ELIST)); src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElseGet(() -> createImaginary(TokenTypes.ELIST)); src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElseGet(() -> createImaginary(TokenTypes.PARAMETERS)); @@ -451,7 +440,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java argument - incompatible argument for parameter parent of createJavadocNode. + incompatible argument for parameter parent of JavadocDetailNodeParser.createJavadocNode. final JavadocNodeImpl rootJavadocNode = createJavadocNode(parseTreeNode, null, -1);
found : null (NullType) @@ -566,7 +555,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java argument - incompatible argument for parameter loader of getBundle. + incompatible argument for parameter loader of ResourceBundle.getBundle. return ResourceBundle.getBundle(bundle, sLocale, sourceClass.getClassLoader(),
found : @Initialized @Nullable ClassLoader @@ -599,7 +588,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/Main.java argument - incompatible argument for parameter moduleClassLoader of getRootModule. + incompatible argument for parameter moduleClassLoader of Main.getRootModule. final RootModule rootModule = getRootModule(config.getName(), moduleClassLoader);
found : @Initialized @Nullable ClassLoader @@ -705,7 +694,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java argument - incompatible argument for parameter arg0 of contains. + incompatible argument for parameter arg0 of Set.contains. if (packageNames.contains(null)) {
found : null (NullType) @@ -716,7 +705,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java argument - incompatible argument for parameter args of LocalizedMessage. + incompatible argument for parameter args of LocalizedMessage constructor. UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE, name, attemptedNames);
found : @Initialized @Nullable String @@ -724,6 +713,17 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java + argument + incompatible argument for parameter other of Optional.orElse. + .orElse(fullName); +
+ found : String + required: @KeyFor("com.puppycrawl.tools.checkstyle.PackageObjectFactory.class.NAME_TO_FULL_MODULE_NAME") String +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java initialization.fields.uninitialized @@ -740,16 +740,12 @@ src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java - methodref.return - Incompatible return type - Class::getCanonicalName, + return + incompatible types in return. + return instance;
- found : @Initialized @Nullable String - required: @Initialized @NonNull String - Consequence: method in @Initialized @NonNull Class</*INFERENCE FAILED for:*/ ? extends @Initialized @NonNull Object> - @Initialized @Nullable String getCanonicalName(@Initialized @NonNull Class</*INFERENCE FAILED for:*/ ? extends @Initialized @NonNull Object> this) - is not a valid method reference for method in @Initialized @NonNull Function</*INFERENCE FAILED for:*/ ? extends @Initialized @Nullable Object, @Initialized @NonNull String> - @Initialized @NonNull String apply(@Initialized @NonNull Function</*INFERENCE FAILED for:*/ ? extends @Initialized @Nullable Object, @Initialized @NonNull String> this, /*INFERENCE FAILED for:*/ ? extends @Initialized @Nullable Object p0) + type of expression: @Initialized @Nullable Object + method return type: @Initialized @NonNull Object
@@ -788,12 +784,11 @@ src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java - return - incompatible types in return. - return instance; + type.arguments.not.inferred + Could not infer type arguments for Stream.collect + .collect(Collectors.groupingBy(Class::getSimpleName,
- type of expression: @Initialized @Nullable Object - method return type: @Initialized @NonNull Object + unsatisfiable constraint: @Initialized @Nullable String <: @Initialized @NonNull String
@@ -801,14 +796,14 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java methodref.return Incompatible return type - .collect(Collectors.toMap(Function.identity(), properties::getProperty)); + Collectors.toUnmodifiableMap(Function.identity(), properties::getProperty));
found : @Initialized @Nullable String required: @Initialized @NonNull String Consequence: method in @Initialized @NonNull Properties @Initialized @Nullable String getProperty(@Initialized @NonNull Properties this, @Initialized @NonNull String p0) - is not a valid method reference for method in @Initialized @NonNull Function</*INFERENCE FAILED for:*/ ? extends @Initialized @Nullable Object, @Initialized @NonNull String> - @Initialized @NonNull String apply(@Initialized @NonNull Function</*INFERENCE FAILED for:*/ ? extends @Initialized @Nullable Object, @Initialized @NonNull String> this, /*INFERENCE FAILED for:*/ ? extends @Initialized @Nullable Object p0) + is not a valid method reference for method in @Initialized @NonNull Function<@Initialized @NonNull String, @Initialized @NonNull String> + @Initialized @NonNull String apply(@Initialized @NonNull Function<@Initialized @NonNull String, @Initialized @NonNull String> this, @Initialized @NonNull String p0)
@@ -858,7 +853,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java argument - incompatible argument for parameter s of parseInt. + incompatible argument for parameter s of Integer.parseInt. final int columnNumber = Integer.parseInt(matcher.group(2));
found : @Initialized @Nullable String @@ -869,7 +864,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java argument - incompatible argument for parameter s of parseInt. + incompatible argument for parameter s of Integer.parseInt. final int lineNumber = Integer.parseInt(matcher.group(1));
found : @Initialized @Nullable String @@ -877,6 +872,72 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java + argument + incompatible argument for parameter args of Violation constructor. + new Object[] {ex.getMessage()}, javaParseExceptionSeverity, null, +
+ found : @Initialized @Nullable Object @Initialized @NonNull [] + required: @Initialized @NonNull Object @Initialized @NonNull [] +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java + argument + incompatible argument for parameter ast of TreeWalker.walk. + walk(rootAST, contents, AstState.ORDINARY); +
+ found : @Initialized @Nullable DetailAST + required: @Initialized @NonNull DetailAST +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java + argument + incompatible argument for parameter customMessage of Violation constructor. + getClass(), null)); +
+ found : null (NullType) + required: @Initialized @NonNull String +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java + argument + incompatible argument for parameter moduleId of Violation constructor. + new Object[] {ex.getMessage()}, javaParseExceptionSeverity, null, +
+ found : null (NullType) + required: @Initialized @NonNull String +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java + argument + incompatible argument for parameter root of JavaParser.appendHiddenCommentNodes. + final DetailAST astWithComments = JavaParser.appendHiddenCommentNodes(rootAST); +
+ found : @Initialized @Nullable DetailAST + required: @Initialized @NonNull DetailAST +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java + argument + incompatible argument for parameter rootAST of TreeWalker.getFilteredViolations. + getFilteredViolations(file.getAbsolutePath(), contents, rootAST); +
+ found : @Initialized @Nullable DetailAST + required: @Initialized @NonNull DetailAST +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java initialization.fields.uninitialized @@ -909,7 +970,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java argument - incompatible argument for parameter messages of writeFileMessages. + incompatible argument for parameter messages of XMLLogger.writeFileMessages. writeFileMessages(fileName, messages);
found : @Initialized @Nullable FileMessages @@ -927,7 +988,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java argument - incompatible argument for parameter byteStream of InputSource. + incompatible argument for parameter byteStream of InputSource constructor. inputSource = new InputSource(dtdIs);
found : @Initialized @Nullable InputStream @@ -938,7 +999,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java argument - incompatible argument for parameter handler of createXmlReader. + incompatible argument for parameter handler of XmlLoader.createXmlReader. parser = createXmlReader(this);
found : @UnderInitialization(org.xml.sax.helpers.DefaultHandler.class) @NonNull XmlLoader @@ -950,24 +1011,35 @@ src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java dereference.of.nullable dereference of possibly-null reference loader - loader.getResourceAsStream(dtdResourceName); + final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName); src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java override.param Incompatible parameter type for publicId. - public InputSource resolveEntity(String publicId, String systemId) + public InputSource resolveEntity(String publicId, String systemId) {
found : @Initialized @NonNull String required: @Initialized @Nullable String Consequence: method in @Initialized @NonNull XmlLoader - @Initialized @NonNull InputSource resolveEntity(@Initialized @NonNull XmlLoader this, @Initialized @NonNull String p0, @Initialized @NonNull String p1) throws @Initialized @NonNull SAXException@Initialized @NonNull IOException + @Initialized @NonNull InputSource resolveEntity(@Initialized @NonNull XmlLoader this, @Initialized @NonNull String p0, @Initialized @NonNull String p1) cannot override method in @Initialized @NonNull EntityResolver @Initialized @Nullable InputSource resolveEntity(@Initialized @NonNull EntityResolver this, @Initialized @Nullable String p0, @Initialized @NonNull String p1) throws @Initialized @NonNull SAXException@Initialized @NonNull IOException
+ + src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java + return + incompatible types in return. + return inputSource; +
+ type of expression: @Initialized @Nullable InputSource + method return type: @Initialized @NonNull InputSource +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.java return @@ -982,7 +1054,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java argument - incompatible argument for parameter checkstyleVersion of realExecute. + incompatible argument for parameter checkstyleVersion of CheckstyleAntTask.realExecute. realExecute(version);
found : @Initialized @Nullable String @@ -993,7 +1065,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java argument - incompatible argument for parameter moduleClassLoader of PackageObjectFactory. + incompatible argument for parameter moduleClassLoader of PackageObjectFactory constructor. Checker.class.getPackage().getName() + ".", moduleClassLoader);
found : @Initialized @Nullable ClassLoader @@ -1004,7 +1076,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java argument - incompatible argument for parameter moduleClassLoader of setModuleClassLoader. + incompatible argument for parameter moduleClassLoader of RootModule.setModuleClassLoader. rootModule.setModuleClassLoader(moduleClassLoader);
found : @Initialized @Nullable ClassLoader @@ -1085,7 +1157,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. getCustomMessages().get(key)));
found : @Initialized @Nullable String @@ -1096,7 +1168,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. getCustomMessages().get(key)));
found : @Initialized @Nullable String @@ -1107,7 +1179,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. getCustomMessages().get(key)));
found : @Initialized @Nullable String @@ -1136,7 +1208,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. getCustomMessages().get(key)));
found : @Initialized @Nullable String @@ -1147,7 +1219,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. getCustomMessages().get(key)));
found : @Initialized @Nullable String @@ -1197,7 +1269,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java argument - incompatible argument for parameter fileName of AuditEvent. + incompatible argument for parameter fileName of AuditEvent constructor. this(source, null);
found : null (NullType) @@ -1208,7 +1280,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java argument - incompatible argument for parameter violation of AuditEvent. + incompatible argument for parameter violation of AuditEvent constructor. this(src, fileName, null);
found : null (NullType) @@ -1374,7 +1446,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java argument - incompatible argument for parameter args of log. + incompatible argument for parameter args of AbstractFileSetCheck.log. log(1, MSG_IO_EXCEPTION_KEY, file.getPath(), ex.getLocalizedMessage());
found : @Initialized @Nullable String @@ -1476,7 +1548,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter args of Violation. + incompatible argument for parameter args of Violation constructor. args,
found : @Initialized @NonNull String @Initialized @Nullable [] @@ -1487,7 +1559,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter customMessage of Violation. + incompatible argument for parameter customMessage of Violation constructor. getClass(), null);
found : null (NullType) @@ -1498,7 +1570,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter languageCode of getMissingFileName. + incompatible argument for parameter languageCode of TranslationCheck.getMissingFileName. getMissingFileName(bundle, null)
found : null (NullType) @@ -1531,7 +1603,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java argument - incompatible argument for parameter ast of createFullIdent. + incompatible argument for parameter ast of FullIdent.createFullIdent. packageName = FullIdent.createFullIdent(null);
found : null (NullType) @@ -1556,7 +1628,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java argument - incompatible argument for parameter args of log. + incompatible argument for parameter args of AbstractFileSetCheck.log. ex.getLocalizedMessage());
found : @Initialized @Nullable String @@ -1564,6 +1636,31 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java + cast.unsafe + cast from "@KeyFor("super") Object" to "@KeyFor("[error for expression: super; error: Invalid 'super' because the expression did not parse. Error message: Encountered unexpected token:<EOF>]") String" cannot be statically verified + final String keyString = (String) key; + + + + src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java + contracts.postcondition + postcondition of put is not satisfied. + public synchronized Object put(Object key, Object value) { +
+ found : key is @KeyFor("super") + required: key is @KeyFor("this") +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java + expression.unparsable + Expression invalid in dependent type annotation: [error for expression: super; error: Invalid 'super' because the expression did not parse. Error message: Encountered unexpected token:<EOF>] + final String keyString = (String) key; + + src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java method.invocation @@ -1578,25 +1675,32 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. .orElse(modifiers); - src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java - return - incompatible types in return. - return brace; + src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElse(Boolean.TRUE); + + + + src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java + argument + incompatible argument for parameter lcurly of Details constructor. + return new Details(lcurly.orElse(null), rcurly, nextToken.orElse(null), true);
- type of expression: @Initialized @Nullable DetailAST - method return type: @Initialized @NonNull DetailAST + found : @Initialized @Nullable DetailAST + required: @Initialized @NonNull DetailAST
src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java argument - incompatible argument for parameter nextToken of Details. + incompatible argument for parameter nextToken of Details constructor. return new Details(lcurly, rcurly, nextToken, true);
found : @Initialized @Nullable DetailAST @@ -1607,7 +1711,18 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java argument - incompatible argument for parameter rcurly of Details. + incompatible argument for parameter nextToken of Details constructor. + return new Details(lcurly.orElse(null), rcurly, nextToken.orElse(null), true); +
+ found : @Initialized @Nullable DetailAST + required: @Initialized @NonNull DetailAST +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java + argument + incompatible argument for parameter rcurly of Details constructor. return new Details(lcurly, rcurly, getNextToken(ast), true);
found : @Initialized @Nullable DetailAST @@ -1618,7 +1733,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java argument - incompatible argument for parameter rcurly of Details. + incompatible argument for parameter rcurly of Details constructor. return new Details(lcurly, rcurly, nextToken, false);
found : @Initialized @Nullable DetailAST @@ -1629,7 +1744,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java argument - incompatible argument for parameter rcurly of Details. + incompatible argument for parameter rcurly of Details constructor. return new Details(lcurly, rcurly, nextToken, shouldCheckLastRcurly);
found : @Initialized @Nullable DetailAST @@ -1640,7 +1755,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java argument - incompatible argument for parameter rcurly of Details. + incompatible argument for parameter rcurly of Details constructor. return new Details(lcurly, rcurly, nextToken, true);
found : @Initialized @Nullable DetailAST @@ -1648,6 +1763,17 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java + argument + incompatible argument for parameter rcurly of Details constructor. + return new Details(lcurly.orElse(null), rcurly, nextToken.orElse(null), true); +
+ found : @Initialized @Nullable DetailAST + required: @Initialized @NonNull DetailAST +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java return @@ -1662,7 +1788,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java argument - incompatible argument for parameter state of processModifiersState. + incompatible argument for parameter state of DeclarationOrderCheck.processModifiersState. final boolean isStateValid = processModifiersState(ast, state);
found : @Initialized @Nullable ScopeState @@ -1701,7 +1827,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.java argument - incompatible argument for parameter parent of FieldFrame. + incompatible argument for parameter parent of FieldFrame constructor. currentFrame = new FieldFrame(null);
found : null (NullType) @@ -1746,25 +1872,17 @@ - src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java - argument - incompatible argument for parameter prevScopeUninitializedVariableData of updateAllUninitializedVariables. - updateAllUninitializedVariables(prevScopeUninitializedVariableData); -
- found : @Initialized @Nullable Deque<@Initialized @NonNull DetailAST> - required: @Initialized @NonNull Deque<@Initialized @NonNull DetailAST> -
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .isPresent();
- src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java - argument - incompatible argument for parameter prevScopeUninitializedVariableData of updateAllUninitializedVariables. - updateAllUninitializedVariables(prevScopeUninitializedVariableData); -
- found : @Initialized @Nullable Deque<@Initialized @NonNull DetailAST> - required: @Initialized @NonNull Deque<@Initialized @NonNull DetailAST> -
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElse(Boolean.FALSE);
@@ -1914,7 +2032,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java argument - incompatible argument for parameter frameName of FieldFrame. + incompatible argument for parameter frameName of FieldFrame constructor. final FieldFrame newFrame = new FieldFrame(frame, isStaticInnerType, frameName);
found : @Initialized @Nullable String @@ -1925,7 +2043,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java argument - incompatible argument for parameter frameName of FieldFrame. + incompatible argument for parameter frameName of FieldFrame constructor. frame = new FieldFrame(null, true, null);
found : null (NullType) @@ -1936,7 +2054,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java argument - incompatible argument for parameter parent of FieldFrame. + incompatible argument for parameter parent of FieldFrame constructor. frame = new FieldFrame(null, true, null);
found : null (NullType) @@ -2030,6 +2148,13 @@ private XPathExpression xpathExpression; + + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingNullCaseInSwitchCheck.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .isPresent(); + + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java return @@ -2087,7 +2212,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter arg0 of push. + incompatible argument for parameter arg0 of Deque.push. current.push(frames.get(ast));
found : @Initialized @Nullable AbstractFrame @@ -2098,7 +2223,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter arg0 of push. + incompatible argument for parameter arg0 of Deque.push. current.push(frames.get(ast));
found : @Initialized @Nullable AbstractFrame @@ -2109,7 +2234,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter arg1 of put. + incompatible argument for parameter arg1 of Map.put. frames.put(ast, frameStack.poll());
found : @Initialized @Nullable AbstractFrame @@ -2120,7 +2245,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter arg1 of put. + incompatible argument for parameter arg1 of Map.put. frames.put(ast, frameStack.poll());
found : @Initialized @Nullable AbstractFrame @@ -2131,7 +2256,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter frame of collectMethodDeclarations. + incompatible argument for parameter frame of RequireThisCheck.collectMethodDeclarations. collectMethodDeclarations(frameStack, ast, frame);
found : @Initialized @Nullable AbstractFrame @@ -2142,7 +2267,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter frame of collectVariableDeclarations. + incompatible argument for parameter frame of RequireThisCheck.collectVariableDeclarations. collectVariableDeclarations(ast, frame);
found : @Initialized @Nullable AbstractFrame @@ -2153,7 +2278,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter frame of findFrame. + incompatible argument for parameter frame of RequireThisCheck.findFrame. frame = findFrame(frame, name, lookForMethod);
found : @Initialized @Nullable AbstractFrame @@ -2164,7 +2289,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter frame of findFrame. + incompatible argument for parameter frame of RequireThisCheck.findFrame. return findFrame(current.peek(), name, lookForMethod);
found : @Initialized @Nullable AbstractFrame @@ -2175,7 +2300,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter ident of ClassFrame. + incompatible argument for parameter ident of ClassFrame constructor. super(parent, null);
found : null (NullType) @@ -2186,7 +2311,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of AnonymousClassFrame. + incompatible argument for parameter parent of AnonymousClassFrame constructor. frameStack.addFirst(new AnonymousClassFrame(frame,
found : @Initialized @Nullable AbstractFrame @@ -2197,7 +2322,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of BlockFrame. + incompatible argument for parameter parent of BlockFrame constructor. frameStack.addFirst(new BlockFrame(frame, ast));
found : @Initialized @Nullable AbstractFrame @@ -2208,7 +2333,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of CatchFrame. + incompatible argument for parameter parent of CatchFrame constructor. final AbstractFrame catchFrame = new CatchFrame(frame, ast);
found : @Initialized @Nullable AbstractFrame @@ -2219,7 +2344,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of ClassFrame. + incompatible argument for parameter parent of ClassFrame constructor. frameStack.addFirst(new ClassFrame(frame, classFrameNameIdent));
found : @Initialized @Nullable AbstractFrame @@ -2230,7 +2355,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of ConstructorFrame. + incompatible argument for parameter parent of ConstructorFrame constructor. frameStack.addFirst(new ConstructorFrame(frame, ctorFrameNameIdent));
found : @Initialized @Nullable AbstractFrame @@ -2241,7 +2366,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of ForFrame. + incompatible argument for parameter parent of ForFrame constructor. final AbstractFrame forFrame = new ForFrame(frame, ast);
found : @Initialized @Nullable AbstractFrame @@ -2252,7 +2377,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java argument - incompatible argument for parameter parent of TryWithResourcesFrame. + incompatible argument for parameter parent of TryWithResourcesFrame constructor. frameStack.addFirst(new TryWithResourcesFrame(frame, ast));
found : @Initialized @Nullable AbstractFrame @@ -2399,10 +2524,17 @@ if (parentToSkip != ast && isExprSurrounded(ast)) { + + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.java + dereference.of.nullable + dereference of possibly-null reference lambdaParameters.peek() + && ast.equals(lambdaParameters.peek().enclosingLambda)) { + + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java argument - incompatible argument for parameter arg1 of put. + incompatible argument for parameter arg1 of Map.put. anonInnerAstToTypeDeclDesc.put(literalNewAst, typeDeclarations.peek());
found : @Initialized @Nullable TypeDeclDesc @@ -2413,7 +2545,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java argument - incompatible argument for parameter outerClassQualifiedName of getQualifiedTypeDeclarationName. + incompatible argument for parameter outerClassQualifiedName of CheckUtil.getQualifiedTypeDeclarationName. .getQualifiedTypeDeclarationName(packageName, outerClassQualifiedName, className);
found : @Initialized @Nullable String @@ -2424,7 +2556,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java argument - incompatible argument for parameter scope of VariableDesc. + incompatible argument for parameter scope of VariableDesc constructor. this(name, null, null);
found : null (NullType) @@ -2435,7 +2567,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java argument - incompatible argument for parameter typeAst of VariableDesc. + incompatible argument for parameter typeAst of VariableDesc constructor. this(name, null, null);
found : null (NullType) @@ -2446,7 +2578,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java argument - incompatible argument for parameter typeAst of VariableDesc. + incompatible argument for parameter typeAst of VariableDesc constructor. this(name, null, scope);
found : null (NullType) @@ -2587,38 +2719,38 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java - argument - incompatible argument for parameter key of SimpleEntry. - return new SimpleEntry<>(variableUsageAst, dist); -
- found : @Initialized @Nullable DetailAST - required: @Initialized @NonNull DetailAST -
+ not.interned + attempting to use a non-@Interned comparison operand + if (curNode == parent) {
src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java - argument - incompatible argument for parameter key of SimpleEntry. - return new SimpleEntry<>(variableUsageAst, dist); -
- found : @Initialized @Nullable DetailAST - required: @Initialized @NonNull DetailAST -
+ not.interned + attempting to use a non-@Interned comparison operand + if (curNode == parent) {
src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java - not.interned - attempting to use a non-@Interned comparison operand - if (curNode == parent) { + return + incompatible types in return. + return new SimpleEntry<>(variableUsageAst, dist); +
+ type of expression: @Initialized @NonNull SimpleEntry<@Initialized @Nullable DetailAST, @Initialized @NonNull Integer> + method return type: @Initialized @NonNull Entry<@Initialized @NonNull DetailAST, @Initialized @NonNull Integer> +
src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java - not.interned - attempting to use a non-@Interned comparison operand - if (curNode == parent) { + return + incompatible types in return. + return new SimpleEntry<>(variableUsageAst, dist); +
+ type of expression: @Initialized @NonNull SimpleEntry<@Initialized @Nullable DetailAST, @Initialized @NonNull Integer> + method return type: @Initialized @NonNull Entry<@Initialized @NonNull DetailAST, @Initialized @NonNull Integer> +
@@ -2665,6 +2797,26 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java + type.arguments.not.inferred + Could not infer type arguments for SimpleEntry constructor + return new SimpleEntry<>(variableUsageAst, dist); +
+ unsatisfiable constraint: @Initialized @Nullable DetailAST <: @Initialized @NonNull DetailAST +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java + type.arguments.not.inferred + Could not infer type arguments for SimpleEntry constructor + return new SimpleEntry<>(variableUsageAst, dist); +
+ unsatisfiable constraint: @Initialized @Nullable DetailAST <: @Initialized @NonNull DetailAST +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java not.interned @@ -2696,7 +2848,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java argument - incompatible argument for parameter outerClassQualifiedName of getQualifiedTypeDeclarationName. + incompatible argument for parameter outerClassQualifiedName of CheckUtil.getQualifiedTypeDeclarationName. outerTypeDeclarationQualifiedName,
found : @Initialized @Nullable String @@ -2760,7 +2912,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java argument - incompatible argument for parameter typeDef of isPublic. + incompatible argument for parameter typeDef of OneTopLevelClassCheck.isPublic. if (publicTypeFound && !isPublic(firstType)) {
found : @Initialized @Nullable DetailAST @@ -2793,9 +2945,6 @@
- src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java initialization.field.uninitialized @@ -2813,7 +2962,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java argument - incompatible argument for parameter previousImport of isAlphabeticalOrderBroken. + incompatible argument for parameter previousImport of CustomImportOrderCheck.isAlphabeticalOrderBroken. if (isAlphabeticalOrderBroken(previousImportFromCurrentGroup, fullImportIdent)) {
found : @Initialized @Nullable String @@ -2824,7 +2973,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java argument - incompatible argument for parameter previousImport of validateExtraEmptyLine. + incompatible argument for parameter previousImport of CustomImportOrderCheck.validateExtraEmptyLine. validateExtraEmptyLine(previousImportObjectFromCurrentGroup,
found : @Initialized @Nullable ImportDetails @@ -2835,7 +2984,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java argument - incompatible argument for parameter previousImport of validateMissedEmptyLine. + incompatible argument for parameter previousImport of CustomImportOrderCheck.validateMissedEmptyLine. validateMissedEmptyLine(previousImportObjectFromCurrentGroup,
found : @Initialized @Nullable ImportDetails @@ -2843,17 +2992,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java - assignment - incompatible types in assignment. - patternForExactMatch = null; -
- found : null (NullType) - required: @Initialized @NonNull Pattern -
-
- src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java return @@ -2932,7 +3070,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.java argument - incompatible argument for parameter parent of FileImportControl. + incompatible argument for parameter parent of FileImportControl constructor. final AbstractImportControl importControl = new FileImportControl(parentImportControl,
found : @Initialized @Nullable PkgImportControl @@ -2943,7 +3081,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.java argument - incompatible argument for parameter parent of PkgImportControl. + incompatible argument for parameter parent of PkgImportControl constructor. final AbstractImportControl importControl = new PkgImportControl(parentImportControl,
found : @Initialized @Nullable PkgImportControl @@ -2993,7 +3131,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java argument - incompatible argument for parameter parent of AbstractImportControl. + incompatible argument for parameter parent of AbstractImportControl constructor. super(null, strategyOnMismatch);
found : null (NullType) @@ -3077,7 +3215,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java argument - incompatible argument for parameter parent of Frame. + incompatible argument for parameter parent of Frame constructor. return new Frame(null);
found : null (NullType) @@ -3088,7 +3226,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java argument - incompatible argument for parameter type of topLevelType. + incompatible argument for parameter type of UnusedImportsCheck.topLevelType. references.add(topLevelType(matcher.group(1)));
found : @Initialized @Nullable String @@ -3254,11 +3392,11 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java argument - incompatible argument for parameter constructor of invokeConstructor. + incompatible argument for parameter constructor of CommonUtil.invokeConstructor. handlerCtor, indentCheck, ast, parent);
found : @Initialized @Nullable Constructor<capture extends @Initialized @Nullable Object> - required: @Initialized @NonNull Constructor<capture extends @Initialized @Nullable Object> + required: @Initialized @NonNull Constructor<@Initialized @Nullable Object>
@@ -3691,21 +3829,10 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java - type.argument - incompatible type argument for type parameter T extends Object of invokeConstructor. - resultHandler = (AbstractExpressionHandler) CommonUtil.invokeConstructor( -
- found : capture[ extends @UnknownKeyFor Object super @KeyForBottom Void] - required: [extends @UnknownKeyFor Object super @UnknownKeyFor NullType] -
-
- src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java argument - incompatible argument for parameter instance of LineWrappingHandler. + incompatible argument for parameter instance of LineWrappingHandler constructor. private final LineWrappingHandler lineWrappingHandler = new LineWrappingHandler(this);
found : @UnderInitialization(com.puppycrawl.tools.checkstyle.api.AbstractCheck.class) @NonNull IndentationCheck @@ -3716,7 +3843,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java argument - incompatible argument for parameter parent of getHandler. + incompatible argument for parameter parent of HandlerFactory.getHandler. handlers.peek());
found : @Initialized @Nullable AbstractExpressionHandler @@ -3756,6 +3883,13 @@ while (curNode != lastNode) { + + src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElse(assign); + + src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java return @@ -3781,7 +3915,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java argument - incompatible argument for parameter expr of AbstractExpressionHandler. + incompatible argument for parameter expr of AbstractExpressionHandler constructor. super(indentCheck, null, null, null);
found : null (NullType) @@ -3792,7 +3926,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java argument - incompatible argument for parameter parent of AbstractExpressionHandler. + incompatible argument for parameter parent of AbstractExpressionHandler constructor. super(indentCheck, null, null, null);
found : null (NullType) @@ -3803,7 +3937,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java argument - incompatible argument for parameter typeName of AbstractExpressionHandler. + incompatible argument for parameter typeName of AbstractExpressionHandler constructor. super(indentCheck, null, null, null);
found : null (NullType) @@ -3876,7 +4010,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java argument - incompatible argument for parameter arg0 of contains. + incompatible argument for parameter arg0 of Set.contains. if (tags.contains(tagName)) {
found : @Initialized @Nullable String @@ -3902,10 +4036,17 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java + initialization.field.uninitialized + the default constructor does not initialize field fileLines + private String[] fileLines; + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter firstArg of JavadocTag. + incompatible argument for parameter firstArg of JavadocTag constructor. javadocArgMatcher.group(2)));
found : @Initialized @Nullable String @@ -3916,7 +4057,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter firstArg of JavadocTag. + incompatible argument for parameter firstArg of JavadocTag constructor. javadocArgMissingDescriptionMatcher.group(2)));
found : @Initialized @Nullable String @@ -3927,7 +4068,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter tag of JavadocTag. + incompatible argument for parameter tag of JavadocTag constructor. javadocArgMissingDescriptionMatcher.group(1),
found : @Initialized @Nullable String @@ -3938,8 +4079,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter tag of JavadocTag. - tags.add(new JavadocTag(currentLine, col, javadocArgMatcher.group(1), + incompatible argument for parameter tag of JavadocTag constructor. + tags.add(new JavadocTag(currentLine, 0, noargCurlyMatcher.group(1)));
found : @Initialized @Nullable String required: @Initialized @NonNull String @@ -3949,8 +4090,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter tag of JavadocTag. - tags.add(new JavadocTag(currentLine, col, javadocNoargMatcher.group(1))); + incompatible argument for parameter tag of JavadocTag constructor. + tags.add(new JavadocTag(currentLine, col, javadocArgMatcher.group(1),
found : @Initialized @Nullable String required: @Initialized @NonNull String @@ -3960,8 +4101,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter tag of JavadocTag. - tags.add(new JavadocTag(currentLine, col, noargCurlyMatcher.group(1))); + incompatible argument for parameter tag of JavadocTag constructor. + tags.add(new JavadocTag(currentLine, col, javadocNoargMatcher.group(1)));
found : @Initialized @Nullable String required: @Initialized @NonNull String @@ -3971,7 +4112,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java argument - incompatible argument for parameter tag of JavadocTag. + incompatible argument for parameter tag of JavadocTag constructor. tags.add(new JavadocTag(tagLine, col, param1));
found : @Initialized @Nullable String @@ -4070,10 +4211,17 @@ private String text; + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElse(EMPTY_DETAIL_NODE_ARRAY); + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java argument - incompatible argument for parameter arg0 of add. + incompatible argument for parameter arg0 of Set.add. final boolean isDirChecked = !directoriesChecked.add(dir);
found : @Initialized @Nullable File @@ -4102,7 +4250,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.java argument - incompatible argument for parameter firstArg of JavadocTag. + incompatible argument for parameter firstArg of JavadocTag constructor. this(line, column, tag, null);
found : null (NullType) @@ -4190,7 +4338,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java argument - incompatible argument for parameter javadocInlineTag of isInlineReturnTag. + incompatible argument for parameter javadocInlineTag of SummaryJavadocCheck.isInlineReturnTag. else if (inlineTag.isPresent() && isInlineReturnTag(inlineTagNode)) {
found : @Initialized @Nullable DetailNode @@ -4201,7 +4349,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java argument - incompatible argument for parameter javadocInlineTag of isSummaryTag. + incompatible argument for parameter javadocInlineTag of SummaryJavadocCheck.isSummaryTag. && isSummaryTag(inlineTagNode)
found : @Initialized @Nullable DetailNode @@ -4255,7 +4403,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/BlockTagUtil.java argument - incompatible argument for parameter name of TagInfo. + incompatible argument for parameter name of TagInfo constructor. tags.add(new TagInfo(tagName, tagValue, position));
found : @Initialized @Nullable String @@ -4266,7 +4414,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtil.java argument - incompatible argument for parameter name of TagInfo. + incompatible argument for parameter name of TagInfo constructor. tags.add(new TagInfo(tagName, tagValue, position));
found : @Initialized @Nullable String @@ -4277,7 +4425,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtil.java argument - incompatible argument for parameter source of removeLeadingJavaDoc. + incompatible argument for parameter source of InlineTagUtil.removeLeadingJavaDoc. matchedTagValue = removeLeadingJavaDoc(matchedTagValue);
found : @Initialized @Nullable String @@ -4288,7 +4436,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.java argument - incompatible argument for parameter ast of ClassContext. + incompatible argument for parameter ast of ClassContext constructor. classesContexts.push(new ClassContext("", null));
found : null (NullType) @@ -4356,6 +4504,13 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .ifPresent(modifiers -> { + + src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.java return @@ -4399,14 +4554,21 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. message = Optional.ofNullable(message).orElse(""); src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. + It is bad style to create an Optional just to chain methods to get a non-optional value. + pattern = Optional.ofNullable(format).map(this::createPattern).orElse(null); + + + + src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. suppressor = Optional.ofNullable(suppressor).orElse(NeverSuppress.INSTANCE); @@ -4487,7 +4649,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.java argument - incompatible argument for parameter val of suppressor. + incompatible argument for parameter val of Builder.suppressor. .suppressor(suppressor)
found : @Initialized @Nullable MatchSuppressor @@ -4505,7 +4667,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.java argument - incompatible argument for parameter ast of Context. + incompatible argument for parameter ast of Context constructor. context = new Context(null);
found : null (NullType) @@ -4719,28 +4881,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java - assignment - incompatible types in assignment. - checkRegexp = null; -
- found : null (NullType) - required: @Initialized @NonNull Pattern -
-
- - - src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java - assignment - incompatible types in assignment. - fileRegexp = null; -
- found : null (NullType) - required: @Initialized @NonNull Pattern -
-
- src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java assignment @@ -4763,28 +4903,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java - assignment - incompatible types in assignment. - messageRegexp = null; -
- found : null (NullType) - required: @Initialized @NonNull Pattern -
-
- - - src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java - assignment - incompatible types in assignment. - checkPattern = null; -
- found : null (NullType) - required: @Initialized @NonNull String -
-
- src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java assignment @@ -4796,17 +4914,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java - assignment - incompatible types in assignment. - filePattern = null; -
- found : null (NullType) - required: @Initialized @NonNull String -
-
- src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java assignment @@ -4818,17 +4925,6 @@
- - src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java - assignment - incompatible types in assignment. - messagePattern = null; -
- found : null (NullType) - required: @Initialized @NonNull String -
-
- src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java override.param @@ -4844,10 +4940,21 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java + return + incompatible types in return. + return result; +
+ type of expression: @Initialized @Nullable String + method return type: @Initialized @NonNull String +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.java argument - incompatible argument for parameter text of addTag. + incompatible argument for parameter text of SuppressWithNearbyCommentFilter.addTag. addTag(matcher.group(0), line);
found : @Initialized @Nullable String @@ -4934,7 +5041,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.java argument - incompatible argument for parameter text of Suppression. + incompatible argument for parameter text of Suppression constructor. suppression = new Suppression(text, lineNo + 1, this);
found : @Initialized @Nullable String @@ -4988,7 +5095,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java argument - incompatible argument for parameter text of Suppression. + incompatible argument for parameter text of Suppression constructor. suppression = new Suppression(offCommentMatcher.group(0),
found : @Initialized @Nullable String @@ -4999,7 +5106,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java argument - incompatible argument for parameter text of Suppression. + incompatible argument for parameter text of Suppression constructor. suppression = new Suppression(onCommentMatcher.group(0),
found : @Initialized @Nullable String @@ -5083,7 +5190,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter text of addTag. + incompatible argument for parameter text of SuppressionCommentFilter.addTag. addTag(offMatcher.group(0), line, column, TagType.OFF);
found : @Initialized @Nullable String @@ -5094,7 +5201,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter text of addTag. + incompatible argument for parameter text of SuppressionCommentFilter.addTag. addTag(onMatcher.group(0), line, column, TagType.ON);
found : @Initialized @Nullable String @@ -5345,7 +5452,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java argument - incompatible argument for parameter checks of XpathFilterElement. + incompatible argument for parameter checks of XpathFilterElement constructor. Optional.ofNullable(checks).map(CommonUtil::createPattern).orElse(null),
found : @Initialized @Nullable Pattern @@ -5356,7 +5463,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java argument - incompatible argument for parameter contextItem of createDynamicContext. + incompatible argument for parameter contextItem of XPathExpression.createDynamicContext. xpathExpression.createDynamicContext(rootNode);
found : @Initialized @Nullable RootNode @@ -5367,7 +5474,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java argument - incompatible argument for parameter files of XpathFilterElement. + incompatible argument for parameter files of XpathFilterElement constructor. this(Optional.ofNullable(files).map(Pattern::compile).orElse(null),
found : @Initialized @Nullable Pattern @@ -5378,7 +5485,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java argument - incompatible argument for parameter message of XpathFilterElement. + incompatible argument for parameter message of XpathFilterElement constructor. Optional.ofNullable(message).map(Pattern::compile).orElse(null),
found : @Initialized @Nullable Pattern @@ -5390,91 +5497,67 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java assignment incompatible types in assignment. - checkRegexp = null; -
- found : null (NullType) - required: @Initialized @NonNull Pattern -
- - - - src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - assignment - incompatible types in assignment. - fileRegexp = null; + xpathExpression = null;
found : null (NullType) - required: @Initialized @NonNull Pattern + required: @Initialized @NonNull XPathExpression
src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - assignment - incompatible types in assignment. - messageRegexp = null; -
- found : null (NullType) - required: @Initialized @NonNull Pattern -
+ introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + Optional.ofNullable(checks).map(CommonUtil::createPattern).orElse(null),
src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - assignment - incompatible types in assignment. - checkPattern = null; -
- found : null (NullType) - required: @Initialized @NonNull String -
+ introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + Optional.ofNullable(message).map(Pattern::compile).orElse(null),
src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - assignment - incompatible types in assignment. - filePattern = null; -
- found : null (NullType) - required: @Initialized @NonNull String -
+ introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + this(Optional.ofNullable(files).map(Pattern::compile).orElse(null),
src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - assignment - incompatible types in assignment. - messagePattern = null; + override.param + Incompatible parameter type for other. + public boolean equals(Object other) {
- found : null (NullType) - required: @Initialized @NonNull String + found : @Initialized @NonNull Object + required: @Initialized @Nullable Object + Consequence: method in @Initialized @NonNull XpathFilterElement + @Initialized @NonNull boolean equals(@Initialized @NonNull XpathFilterElement this, @Initialized @NonNull Object p0) + cannot override method in @Initialized @NonNull Object + @Initialized @NonNull boolean equals(@Initialized @NonNull Object this, @Initialized @Nullable Object p0)
src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - assignment - incompatible types in assignment. - xpathExpression = null; + return + incompatible types in return. + return result;
- found : null (NullType) - required: @Initialized @NonNull XPathExpression + type of expression: @Initialized @Nullable String + method return type: @Initialized @NonNull String
src/main/java/com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.java - override.param - Incompatible parameter type for other. - public boolean equals(Object other) { + type.arguments.not.inferred + Could not infer type arguments for Stream.collect + .collect(Collectors.toUnmodifiableList());
- found : @Initialized @NonNull Object - required: @Initialized @Nullable Object - Consequence: method in @Initialized @NonNull XpathFilterElement - @Initialized @NonNull boolean equals(@Initialized @NonNull XpathFilterElement this, @Initialized @NonNull Object p0) - cannot override method in @Initialized @NonNull Object - @Initialized @NonNull boolean equals(@Initialized @NonNull Object this, @Initialized @Nullable Object p0) + unsatisfiable constraint: @Initialized @PolyNull AbstractNode <: @Initialized @NonNull AbstractNode
@@ -5514,7 +5597,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/MainFrame.java argument - incompatible argument for parameter arg0 of getImage. + incompatible argument for parameter arg0 of Toolkit.getImage. setIconImage(Toolkit.getDefaultToolkit().getImage(MainFrame.class.getResource(ICON)));
found : @Initialized @Nullable URL @@ -5525,7 +5608,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/MainFrame.java argument - incompatible argument for parameter event of actionPerformed. + incompatible argument for parameter event of ReloadAction.actionPerformed. reloadAction.actionPerformed(null);
found : null (NullType) @@ -5536,7 +5619,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/MainFrame.java argument - incompatible argument for parameter sourceFile of openFile. + incompatible argument for parameter sourceFile of MainFrame.openFile. openFile(file);
found : @Initialized @Nullable File @@ -5565,7 +5648,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/MainFrameModel.java argument - incompatible argument for parameter parseTree of ParseTreeTableModel. + incompatible argument for parameter parseTree of ParseTreeTableModel constructor. parseTreeTableModel = new ParseTreeTableModel(null);
found : null (NullType) @@ -5594,7 +5677,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/ParseTreeTableModel.java argument - incompatible argument for parameter childIndices of fireTreeStructureChanged. + incompatible argument for parameter childIndices of ParseTreeTableModel.fireTreeStructureChanged. fireTreeStructureChanged(this, path, null, (Object[]) null);
found : null (NullType) @@ -5605,7 +5688,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/ParseTreeTableModel.java argument - incompatible argument for parameter children of fireTreeStructureChanged. + incompatible argument for parameter children of ParseTreeTableModel.fireTreeStructureChanged. fireTreeStructureChanged(this, path, null, (Object[]) null);
found : @Initialized @NonNull Object @FBCBottom @Nullable [] @@ -5656,7 +5739,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java argument - incompatible argument for parameter font of getFontMetrics. + incompatible argument for parameter font of JComponent.getFontMetrics. final FontMetrics fontMetrics = getFontMetrics(getFont());
found : @Initialized @Nullable Font @@ -5667,7 +5750,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java argument - incompatible argument for parameter jTreeTable of ListToTreeSelectionModelWrapper. + incompatible argument for parameter jTreeTable of ListToTreeSelectionModelWrapper constructor. ListToTreeSelectionModelWrapper(this);
found : @UnderInitialization(javax.swing.JTable.class) @NonNull TreeTable @@ -5678,7 +5761,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java argument - incompatible argument for parameter selectionModel of setSelectionModel. + incompatible argument for parameter selectionModel of JTree.setSelectionModel. tree.setSelectionModel(selectionWrapper);
found : @UnderInitialization(com.puppycrawl.tools.checkstyle.gui.ListToTreeSelectionModelWrapper.class) @NonNull ListToTreeSelectionModelWrapper @@ -5689,7 +5772,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java argument - incompatible argument for parameter treeTable of TreeTableCellRenderer. + incompatible argument for parameter treeTable of TreeTableCellRenderer constructor. tree = new TreeTableCellRenderer(this, treeTableModel);
found : @UnderInitialization(javax.swing.JTable.class) @NonNull TreeTable @@ -5880,10 +5963,20 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/gui/TreeTable.java + type.arguments.not.inferred + Could not infer type arguments for Stream.map + .map(ElementNode::getUnderlyingNode) +
+ unsatisfiable constraint: @Initialized @PolyNull ElementNode <: @Initialized @NonNull ElementNode +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java argument - incompatible argument for parameter arg0 of add. + incompatible argument for parameter arg0 of Set.add. tokens.add(matcher.group(0));
found : @Initialized @Nullable String @@ -5894,7 +5987,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java argument - incompatible argument for parameter nodeTag of getTextFromTag. + incompatible argument for parameter nodeTag of JavadocMetadataScraper.getTextFromTag. return getTextFromTag(tagNode);
found : @Initialized @Nullable DetailNode @@ -5918,24 +6011,9 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java - method.invocation - call to <X>orElseThrow(java.util.function.Supplier<? extends X>) not allowed on the given receiver. - .orElseThrow(() -> { -
- found : @MaybePresent Optional</*INFERENCE FAILED for:*/ ? extends Object> - required: @Present Optional</*INFERENCE FAILED for:*/ ? extends Object> -
-
- - - src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java - method.invocation - call to <X>orElseThrow(java.util.function.Supplier<? extends X>) not allowed on the given receiver. - .orElseThrow(() -> { -
- found : @MaybePresent Optional</*INFERENCE FAILED for:*/ ? extends Object> - required: @Present Optional</*INFERENCE FAILED for:*/ ? extends Object> -
+ introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + return Optional.ofNullable(nodeTag).map(JavadocMetadataScraper::getText).orElse("");
@@ -5952,7 +6030,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.java argument - incompatible argument for parameter moduleClassLoader of setModuleClassLoader. + incompatible argument for parameter moduleClassLoader of Checker.setModuleClassLoader. checker.setModuleClassLoader(Checker.class.getClassLoader());
found : @Initialized @Nullable ClassLoader @@ -6033,8 +6111,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter description of setDescription. - .get(0).getFirstChild().getNodeValue()); + incompatible argument for parameter description of ModuleDetails.setDescription. + .getFirstChild().getNodeValue());
found : @Initialized @Nullable String required: @Initialized @NonNull String @@ -6044,8 +6122,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter description of setDescription. - .getFirstChild().getNodeValue()); + incompatible argument for parameter description of ModulePropertyDetails.setDescription. + .get(0).getFirstChild().getNodeValue());
found : @Initialized @Nullable String required: @Initialized @NonNull String @@ -6055,7 +6133,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter element of getAttributeValue. + incompatible argument for parameter element of XmlMetaReader.getAttributeValue. listContent.add(getAttributeValue((Element) nodeList.item(j), attribute));
found : @Initialized @Nullable Element @@ -6066,7 +6144,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter element of getAttributeValue. + incompatible argument for parameter element of XmlMetaReader.getAttributeValue. propertyDetails.setName(getAttributeValue(prop, XML_TAG_NAME));
found : @Initialized @Nullable Element @@ -6077,7 +6155,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.java argument - incompatible argument for parameter moduleMetadataStream of read. + incompatible argument for parameter moduleMetadataStream of XmlMetaReader.read. moduleDetails = read(XmlMetaReader.class.getResourceAsStream("/" + fileName),
found : @Initialized @Nullable InputStream @@ -6161,20 +6239,42 @@ - src/main/java/com/puppycrawl/tools/checkstyle/site/ParentModuleMacro.java - return - incompatible types in return. - .orElse(null); + src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java + argument + incompatible argument for parameter justification of XdocSink.tableRows. + sink.tableRows(null, false);
- type of expression: @Initialized @Nullable Path - method return type: @Initialized @NonNull Path + found : null (NullType) + required: @Initialized @NonNull int @Initialized @NonNull [] +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java + argument + incompatible argument for parameter moduleJavadoc of PropertiesMacro.writePropertyRow. + writePropertyRow(sink, property, propertyJavadoc, instance, currentModuleJavadoc); +
+ found : @Initialized @Nullable DetailNode + required: @Initialized @NonNull DetailNode +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/PropertiesMacro.java + argument + incompatible argument for parameter propertyJavadoc of PropertiesMacro.writePropertyRow. + writePropertyRow(sink, property, propertyJavadoc, instance, currentModuleJavadoc); +
+ found : @Initialized @Nullable DetailNode + required: @Initialized @NonNull DetailNode
src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java argument - incompatible argument for parameter classLoader of getPackageNames. + incompatible argument for parameter classLoader of PackageNamesLoader.getPackageNames. final Set<String> packageNames = PackageNamesLoader.getPackageNames(cl);
found : @Initialized @Nullable ClassLoader @@ -6182,11 +6282,144 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + argument + incompatible argument for parameter message of MacroExecutionException constructor. + throw new MacroExecutionException(exc.getMessage(), exc); +
+ found : @Initialized @Nullable String + required: @Initialized @NonNull String +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + argument + incompatible argument for parameter moduleClassLoader of Checker.setModuleClassLoader. + checker.setModuleClassLoader(Checker.class.getClassLoader()); +
+ found : @Initialized @Nullable ClassLoader + required: @Initialized @NonNull ClassLoader +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java dereference.of.nullable - dereference of possibly-null reference field.get(instance) - return field.get(instance).toString(); + dereference of possibly-null reference currentClass + result = currentClass.getDeclaredField(propertyName); + + + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElse(null); + + + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElseGet(fieldClass::getSimpleName); + + + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + methodref.return + Incompatible return type + .mapToInt(int.class::cast); +
+ found : @Initialized @Nullable Integer + required: @Initialized @NonNull int + Consequence: method in @Initialized @NonNull Class<@Initialized @NonNull Integer> + @Initialized @Nullable Integer cast(@Initialized @NonNull Class<@Initialized @NonNull Integer> this, @Initialized @Nullable Object p0) + is not a valid method reference for method in @Initialized @NonNull ToIntFunction<capture extends @Initialized @Nullable Object> + @Initialized @NonNull int applyAsInt(@Initialized @NonNull ToIntFunction<capture extends @Initialized @Nullable Object> this, capture extends @Initialized @Nullable Object p0) +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + return + incompatible types in return. + return result; +
+ type of expression: @Initialized @Nullable Class<capture extends @Initialized @Nullable Object> + method return type: @Initialized @NonNull Class<? extends @Initialized @Nullable Object> +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + return + incompatible types in return. + return javadocTagWithSince; +
+ type of expression: @Initialized @Nullable DetailNode + method return type: @Initialized @NonNull DetailNode +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + return + incompatible types in return. + return result; +
+ type of expression: @Initialized @Nullable Field + method return type: @Initialized @NonNull Field +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + return + incompatible types in return. + return field.get(instance); +
+ type of expression: @Initialized @Nullable Object + method return type: @Initialized @NonNull Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + return + incompatible types in return. + .orElse(null); +
+ type of expression: @Initialized @Nullable Path + method return type: @Initialized @NonNull Path +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.map + .map(Pattern.class::cast) +
+ unsatisfiable constraint: capture extends @Initialized @Nullable Object <: @Initialized @PolyNull Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.map + .map(String.class::cast) +
+ unsatisfiable constraint: capture extends @Initialized @Nullable Object <: @Initialized @PolyNull Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java + unnecessary.equals + use of .equals can be safely replaced by ==/!= + while (!Object.class.equals(currentClass)) { @@ -6196,13 +6429,10 @@ + clss.getPackage().getName().replace(".", "%2F") - src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java argument - incompatible argument for parameter arg0 of getAttributeValue. + incompatible argument for parameter arg0 of XmlPullParser.getAttributeValue. .getAttributeValue(null, Attribute.NAME.toString());
found : null (NullType) @@ -6213,7 +6443,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java argument - incompatible argument for parameter arg0 of getAttributeValue. + incompatible argument for parameter arg0 of XmlPullParser.getAttributeValue. .getAttributeValue(null, Attribute.VALUE.toString());
found : null (NullType) @@ -6224,7 +6454,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java argument - incompatible argument for parameter arg0 of getAttributeValue. + incompatible argument for parameter arg0 of XmlPullParser.getAttributeValue. macroName = parser.getAttributeValue(null, Attribute.NAME.toString());
found : null (NullType) @@ -6232,7 +6462,6 @@
- src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java assignment @@ -6244,7 +6473,6 @@
- src/main/java/com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.java initialization.field.uninitialized @@ -6273,7 +6501,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.java argument - incompatible argument for parameter input of matcher. + incompatible argument for parameter input of Pattern.matcher. final Matcher matcher = PROPERTY_VARIABLE_PATTERN.matcher(propertyValue);
found : @Initialized @Nullable String @@ -6295,7 +6523,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter replacement of replaceAll. + incompatible argument for parameter replacement of String.replaceAll. result = result.replaceAll("\\$" + i, matcher.group(i));
found : @Initialized @Nullable String @@ -6372,8 +6600,15 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtil.java introduce.eliminate - It is bad style to create an Optional just to chain methods to get a value. - .orElseGet(() -> getDefaultScope(aMods.getParent())); + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElseGet(() -> getDefaultScope(aMods)); + + + + src/main/java/com/puppycrawl/tools/checkstyle/utils/ScopeUtil.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElseGet(() -> getDefaultScope(ast)); @@ -6398,10 +6633,52 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java + argument + incompatible argument for parameter object of TokenUtil.getIntFromField. + Field::getName, fld -> getIntFromField(fld, null)) +
+ found : null (NullType) + required: @Initialized @NonNull Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java + return + incompatible types in return. + return Arrays.copyOf(array, length); +
+ type of expression: T[ extends @Initialized @Nullable Object super @Initialized @Nullable Void] @Initialized @NonNull [] + method return type: T[ extends @Initialized @Nullable Object super @Initialized @NonNull Void] @Initialized @NonNull [] +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java + type.arguments.not.inferred + Could not infer type arguments for Map.copyOf + return Map.copyOf(map); +
+ unsatisfiable constraint: K extends @Initialized @Nullable Object <: @Initialized @NonNull Object V extends @Initialized @Nullable Object <: @Initialized @NonNull Object +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.java + type.arguments.not.inferred + Could not infer type arguments for Stream.collect + .collect(Collectors.toUnmodifiableList()); +
+ unsatisfiable constraint: T extends @Initialized @PolyNull Object <: T extends @Initialized @Nullable Object +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java argument - incompatible argument for parameter name of AttributeNode. + incompatible argument for parameter name of AttributeNode constructor. private static final AttributeNode ATTRIBUTE_NODE_UNINITIALIZED = new AttributeNode(null, null);
found : null (NullType) @@ -6412,7 +6689,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java argument - incompatible argument for parameter nodes of OfNodes. + incompatible argument for parameter nodes of OfNodes constructor. getChildren().toArray(EMPTY_ABSTRACT_NODE_ARRAY));
found : @Initialized @Nullable AbstractNode @Initialized @NonNull [] @@ -6423,7 +6700,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java argument - incompatible argument for parameter nodes of OfNodes. + incompatible argument for parameter nodes of OfNodes constructor. getFollowingSiblings().toArray(EMPTY_ABSTRACT_NODE_ARRAY));
found : @Initialized @Nullable AbstractNode @Initialized @NonNull [] @@ -6434,7 +6711,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java argument - incompatible argument for parameter value of AttributeNode. + incompatible argument for parameter value of AttributeNode constructor. private static final AttributeNode ATTRIBUTE_NODE_UNINITIALIZED = new AttributeNode(null, null);
found : null (NullType) @@ -6442,6 +6719,13 @@
+ + src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java + introduce.eliminate + It is bad style to create an Optional just to chain methods to get a non-optional value. + .orElse(null); + + src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.java not.interned @@ -6505,7 +6789,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AbstractRootNode.java argument - incompatible argument for parameter nodes of OfNodes. + incompatible argument for parameter nodes of OfNodes constructor. getChildren().toArray(EMPTY_ABSTRACT_NODE_ARRAY));
found : @Initialized @Nullable AbstractNode @Initialized @NonNull [] @@ -6534,7 +6818,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/AttributeNode.java argument - incompatible argument for parameter treeInfo of AbstractNode. + incompatible argument for parameter treeInfo of AbstractNode constructor. super(null);
found : null (NullType) @@ -6556,7 +6840,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java argument - incompatible argument for parameter root of getXpathQuery. + incompatible argument for parameter root of XpathQueryGenerator.getXpathQuery. final StringBuilder xpathQueryBuilder = new StringBuilder(getXpathQuery(null, ast));
found : null (NullType) @@ -6592,17 +6876,6 @@ while (cur != root) { - - src/main/java/com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.java - return - incompatible types in return. - XpathUtil::supportsTextAttribute).orElse(null); -
- type of expression: @Initialized @Nullable DetailAST - method return type: @Initialized @NonNull DetailAST -
-
- src/main/java/com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.java assignment diff --git a/config/checker-framework-suppressions/checker-purity-value-returns-suppressions.xml b/config/checker-framework-suppressions/checker-purity-value-returns-suppressions.xml index 8a5aa865b9a..f12b4fbd5af 100644 --- a/config/checker-framework-suppressions/checker-purity-value-returns-suppressions.xml +++ b/config/checker-framework-suppressions/checker-purity-value-returns-suppressions.xml @@ -3,7 +3,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseInt. + incompatible argument for parameter radix of Integer.parseInt. result = Integer.parseInt(txt, radix);
found : int @@ -14,8 +14,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseLong. - result = Long.parseLong(txt, radix); + incompatible argument for parameter radix of Integer.parseUnsignedInt. + result = Integer.parseUnsignedInt(txt, radix);
found : int required: @IntRange(from=2, to=36) int @@ -25,8 +25,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseUnsignedInt. - result = Integer.parseUnsignedInt(txt, radix); + incompatible argument for parameter radix of Long.parseLong. + result = Long.parseLong(txt, radix);
found : int required: @IntRange(from=2, to=36) int @@ -36,7 +36,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CheckUtil.java argument - incompatible argument for parameter radix of parseUnsignedLong. + incompatible argument for parameter radix of Long.parseUnsignedLong. result = Long.parseUnsignedLong(txt, radix);
found : int diff --git a/config/checker-framework-suppressions/checker-regex-property-key-compiler-message-suppressions.xml b/config/checker-framework-suppressions/checker-regex-property-key-compiler-message-suppressions.xml index 4e8fe29e475..17ef65c9950 100644 --- a/config/checker-framework-suppressions/checker-regex-property-key-compiler-message-suppressions.xml +++ b/config/checker-framework-suppressions/checker-regex-property-key-compiler-message-suppressions.xml @@ -3,7 +3,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java argument - incompatible argument for parameter key of getString. + incompatible argument for parameter key of ResourceBundle.getString. final String pattern = resourceBundle.getString(key);
found : @UnknownPropertyKey String @@ -12,20 +12,24 @@ - src/main/java/com/puppycrawl/tools/checkstyle/Main.java - argument - incompatible argument for parameter regex of compile. - .map(pattern -> Pattern.compile("^" + pattern + "$")) + src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java + methodref.param + Incompatible parameter type for key + Collectors.toUnmodifiableMap(Function.identity(), properties::getProperty));
- found : String - required: @Regex String + found : @PropertyKey String + required: @UnknownPropertyKey String + Consequence: method in @UnknownPropertyKey Properties + @UnknownPropertyKey String getProperty(@UnknownPropertyKey Properties this, @PropertyKey String p0) + is not a valid method reference for method in @UnknownPropertyKey Function<@UnknownPropertyKey String, @UnknownPropertyKey String> + @UnknownPropertyKey String apply(@UnknownPropertyKey Function<@UnknownPropertyKey String, @UnknownPropertyKey String> this, @UnknownPropertyKey String p0)
src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. final String cachedConfigHash = details.getProperty(CONFIG_HASH_KEY);
found : @UnknownPropertyKey String @@ -36,7 +40,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. final String cachedHashSum = details.getProperty(location);
found : @UnknownPropertyKey String @@ -47,7 +51,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. final String cachedHashSum = details.getProperty(resource.location);
found : @UnknownPropertyKey String @@ -58,7 +62,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. final String lastChecked = details.getProperty(uncheckedFileName);
found : @UnknownPropertyKey String @@ -69,7 +73,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. return details.getProperty(name);
found : @UnknownPropertyKey String @@ -80,7 +84,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of setProperty. + incompatible argument for parameter key of Properties.setProperty. .forEach(resource -> details.setProperty(resource.location, resource.contentHashSum));
found : @UnknownPropertyKey String @@ -91,7 +95,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of setProperty. + incompatible argument for parameter key of Properties.setProperty. details.setProperty(CONFIG_HASH_KEY, configHash);
found : @UnknownPropertyKey String @@ -102,7 +106,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java argument - incompatible argument for parameter key of setProperty. + incompatible argument for parameter key of Properties.setProperty. details.setProperty(checkedFileName, Long.toString(timestamp));
found : @UnknownPropertyKey String @@ -113,7 +117,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java argument - incompatible argument for parameter key of setProperty. + incompatible argument for parameter key of Properties.setProperty. returnValue.setProperty(entry.getKey(), value);
found : @UnknownPropertyKey String @@ -124,7 +128,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java argument - incompatible argument for parameter key of setProperty. + incompatible argument for parameter key of Properties.setProperty. returnValue.setProperty(p.getKey(), p.getValue());
found : @UnknownPropertyKey String @@ -135,7 +139,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. + "|\""
found : String @@ -146,7 +150,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(keyPatternString);
found : String @@ -157,7 +161,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter regex of matches. + incompatible argument for parameter regex of Pattern.matches. if (Pattern.matches(fileNameRegexp, currentFile.getName())) {
found : String @@ -168,7 +172,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java argument - incompatible argument for parameter regex of replaceAll. + incompatible argument for parameter regex of String.replaceAll. return fileName.replaceAll(removePattern, "");
found : String @@ -179,7 +183,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(keyPatternString);
found : String @@ -190,7 +194,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. private Pattern extendedClassNameFormat = Pattern.compile(DEFAULT_FORMAT);
found : String @@ -201,7 +205,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. headerRegexps.add(Pattern.compile(line));
found : String @@ -212,7 +216,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.java argument - incompatible argument for parameter regex of matches. + incompatible argument for parameter regex of String.matches. classMatch = forImport.matches(className);
found : String @@ -223,7 +227,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(expression);
found : String @@ -234,7 +238,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. grp = Pattern.compile(pkg);
found : String @@ -245,7 +249,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(expression + "(?:\\..*)?");
found : String @@ -256,7 +260,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(expression);
found : String @@ -267,7 +271,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.java argument - incompatible argument for parameter regex of matches. + incompatible argument for parameter regex of String.matches. pkgMatch = !forImport.matches(pkgName + "\\..*\\..*");
found : String @@ -278,7 +282,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.java argument - incompatible argument for parameter regex of matches. + incompatible argument for parameter regex of String.matches. pkgMatch = forImport.matches(pkgName + "\\..*");
found : String @@ -332,7 +336,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java group.count invalid groups parameter 1. Only 0 groups are guaranteed to exist for noargCurlyMatcher. - tags.add(new JavadocTag(currentLine, col, noargCurlyMatcher.group(1))); + tags.add(new JavadocTag(currentLine, 0, noargCurlyMatcher.group(1))); @@ -363,6 +367,21 @@ javadocArgMissingDescriptionMatcher.group(2))); + + src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java + methodref.receiver.bound + Incompatible receiver type + .map(INLINE_RETURN_TAG_PATTERN::matcher) +
+ found : @Regex Pattern + required: @PolyRegex Pattern + Consequence: method + @Regex Pattern + is not a valid method reference for method in @Regex Pattern + @PolyRegex Matcher matcher(@PolyRegex Pattern this, CharSequence p0) +
+
+ src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.java group.count @@ -373,7 +392,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(formatValue, options);
found : String @@ -384,7 +403,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. checkRegexp = Pattern.compile(checks);
found : String @@ -395,7 +414,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. fileRegexp = Pattern.compile(files);
found : String @@ -406,7 +425,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. messageRegexp = Pattern.compile(message);
found : String @@ -417,7 +436,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. private Pattern commentFormat = Pattern.compile(DEFAULT_COMMENT_FORMAT);
found : String @@ -428,7 +447,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. tagCheckRegexp = Pattern.compile(format);
found : String @@ -439,7 +458,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. tagIdRegexp = Pattern.compile(format);
found : String @@ -450,7 +469,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. tagMessageRegexp = Pattern.compile(format);
found : String @@ -461,7 +480,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. eventIdRegexp = Pattern.compile(format);
found : String @@ -472,7 +491,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. eventMessageRegexp = Pattern.compile(format);
found : String @@ -483,7 +502,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. eventSourceRegexp = Pattern.compile(format);
found : String @@ -494,7 +513,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. private Pattern nearbyTextPattern = Pattern.compile(DEFAULT_NEARBY_TEXT_PATTERN);
found : String @@ -505,7 +524,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. eventIdRegexp = Pattern.compile(format);
found : String @@ -516,7 +535,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. eventMessageRegexp = Pattern.compile(format);
found : String @@ -527,7 +546,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. eventSourceRegexp = Pattern.compile(format);
found : String @@ -538,7 +557,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. private Pattern offCommentFormat = Pattern.compile(DEFAULT_OFF_FORMAT);
found : String @@ -549,7 +568,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. private Pattern onCommentFormat = Pattern.compile(DEFAULT_ON_FORMAT);
found : String @@ -560,7 +579,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. tagCheckRegexp = Pattern.compile(format);
found : String @@ -571,7 +590,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. tagIdRegexp = Pattern.compile(format);
found : String @@ -582,7 +601,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. tagMessageRegexp = Pattern.compile(format);
found : String @@ -593,7 +612,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionSingleFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. this.checks = Pattern.compile(checks);
found : String @@ -604,7 +623,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. this.checks = Pattern.compile(checks);
found : String @@ -615,7 +634,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. this.files = Pattern.compile(files);
found : String @@ -626,7 +645,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilter.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. this.message = Pattern.compile(message);
found : String @@ -665,9 +684,24 @@ - src/main/java/com/puppycrawl/tools/checkstyle/site/ParentModuleMacro.java + src/main/java/com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.java + methodref.receiver.bound + Incompatible receiver type + .map(pattern::matcher) +
+ found : Pattern + required: @PolyRegex Pattern + Consequence: method + Pattern + is not a valid method reference for method in Pattern + @PolyRegex Matcher matcher(@PolyRegex Pattern this, CharSequence p0) +
+
+ + + src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java argument - incompatible argument for parameter regex of matches. + incompatible argument for parameter regex of String.matches. .filter(path -> path.toString().matches(fileNamePattern))
found : String @@ -678,7 +712,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. String propertyValue = properties.getProperty(propertyName);
found : @UnknownPropertyKey String @@ -689,7 +723,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.java argument - incompatible argument for parameter key of getProperty. + incompatible argument for parameter key of Properties.getProperty. properties.getProperty(unresolvedPropertyName);
found : @UnknownPropertyKey String @@ -700,7 +734,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.java argument - incompatible argument for parameter key of setProperty. + incompatible argument for parameter key of Properties.setProperty. properties.setProperty(propertyName, propertyValue);
found : @UnknownPropertyKey String @@ -711,7 +745,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. Pattern.compile(pattern);
found : String @@ -722,7 +756,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter regex of compile. + incompatible argument for parameter regex of Pattern.compile. return Pattern.compile(pattern, flags);
found : String @@ -733,7 +767,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/CommonUtil.java argument - incompatible argument for parameter regex of replaceAll. + incompatible argument for parameter regex of String.replaceAll. result = result.replaceAll("\\$" + i, matcher.group(i));
found : String @@ -751,7 +785,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/utils/TokenUtil.java argument - incompatible argument for parameter key of getString. + incompatible argument for parameter key of ResourceBundle.getString. return bundle.getString(name);
found : @UnknownPropertyKey String diff --git a/config/checker-framework-suppressions/checker-signature-gui-units-init-suppressions.xml b/config/checker-framework-suppressions/checker-signature-gui-units-init-suppressions.xml index be21f291ec1..7f6f0874525 100644 --- a/config/checker-framework-suppressions/checker-signature-gui-units-init-suppressions.xml +++ b/config/checker-framework-suppressions/checker-signature-gui-units-init-suppressions.xml @@ -3,8 +3,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java argument - incompatible argument for parameter baseName of getBundle. - return ResourceBundle.getBundle(bundle, sLocale, sourceClass.getClassLoader(), + incompatible argument for parameter baseName of Control.toBundleName. + final String bundleName = toBundleName(baseName, locale);
found : @SignatureUnknown String required: @BinaryName String @@ -14,8 +14,8 @@ src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java argument - incompatible argument for parameter baseName of toBundleName. - final String bundleName = toBundleName(baseName, locale); + incompatible argument for parameter baseName of ResourceBundle.getBundle. + return ResourceBundle.getBundle(bundle, sLocale, sourceClass.getClassLoader(),
found : @SignatureUnknown String required: @BinaryName String @@ -25,7 +25,7 @@ src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java argument - incompatible argument for parameter name of forName. + incompatible argument for parameter name of Class.forName. clazz = Class.forName(className, true, moduleClassLoader);
found : @SignatureUnknown String diff --git a/config/checkstyle-checks.xml b/config/checkstyle-checks.xml index 8c6fceefe4a..3fc65efe940 100644 --- a/config/checkstyle-checks.xml +++ b/config/checkstyle-checks.xml @@ -189,6 +189,13 @@ + + + + + + @@ -330,6 +337,7 @@ + @@ -354,6 +362,7 @@ + @@ -367,6 +376,7 @@ + @@ -514,6 +524,14 @@ --> + + + + @@ -564,8 +582,31 @@ + + + + + + + + + + + + @@ -674,6 +715,7 @@ + @@ -784,7 +826,9 @@ - + + + diff --git a/config/checkstyle-examples-checks.xml b/config/checkstyle-examples-checks.xml index 706cfda3aae..6c21c9259c2 100644 --- a/config/checkstyle-examples-checks.xml +++ b/config/checkstyle-examples-checks.xml @@ -80,6 +80,12 @@ + + + + + + @@ -99,6 +105,8 @@ + + diff --git a/config/checkstyle-examples-suppressions.xml b/config/checkstyle-examples-suppressions.xml index ab1070b94cb..bef713e2ffa 100644 --- a/config/checkstyle-examples-suppressions.xml +++ b/config/checkstyle-examples-suppressions.xml @@ -6,6 +6,12 @@ + + + + @@ -18,9 +24,16 @@ + + + + + + + + + + + + diff --git a/config/checkstyle-input-suppressions.xml b/config/checkstyle-input-suppressions.xml index 373c3ce1459..31ec1a72fe4 100644 --- a/config/checkstyle-input-suppressions.xml +++ b/config/checkstyle-input-suppressions.xml @@ -5,114 +5,57 @@ "https://checkstyle.org/dtds/suppressions_1_1.dtd"> - - - - - - - - - - - - - - - - - + + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperAbstractSuperCheck.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperAnnotationUseStyleCheck.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperAtclauseOrderCheck.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperBeforeExecutionExclusionFileFilter.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperNoCodeInFileCheck.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperRightCurlyCheck.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperSummaryJavadocCheck.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperSuppressWarningsFilter.java"/> + files="[\\/]meta[\\/]javadocmetadatascraper[\\/]InputJavadocMetadataScraperWriteTagCheck.java"/> + files="[\\/]checks[\\/]imports[\\/]redundantimport[\\/]InputRedundantImportWithoutPackage.java"/> + files="[\\/]checks[\\/]coding[\\/]illegaltype[\\/]InputIllegalTypeSameFileNameFalsePositive.java"/> + files="[\\/]checks[\\/]coding[\\/]illegaltype[\\/]InputIllegalTypeTestSameFileNameGeneral.java"/> + files="[\\/]checks[\\/]metrics[\\/]classfanoutcomplexity[\\/]InputClassFanOutComplexityExcludedPackagesAllIgnored.java"/> + files="[\\/]checks[\\/]metrics[\\/]classfanoutcomplexity[\\/]InputClassFanOutComplexityExcludedPackagesCommonPackage.java"/> + files="[\\/]checks[\\/]metrics[\\/]classfanoutcomplexity[\\/]InputClassFanOutComplexityExcludedPackagesDirectPackages.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderThirdPartyAndSpecial.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderThirdPartyAndSpecial2.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderDefault4.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderDefault6.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderSingleLine.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderSingleLineList.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrderSpanMultipleLines.java"/> + files="[\\/]checks[\\/]imports[\\/]customimportorder[\\/]InputCustomImportOrder_OverlappingPatterns.java"/> + files="[\\/]checks[\\/]imports[\\/]unusedimports[\\/]InputUnusedImportsShadowed.java"/> - - - - - - - - - - - - - + files="[\\/]checks[\\/]imports[\\/]redundantimport[\\/]InputRedundantImportWithChecker.java"/> - - - + files="[\\/]packageobjectfactory[\\/]abc[\\/]FooCheck.java"/> - - - - + files="[\\/]packageobjectfactory[\\/]zoo[\\/]FooCheck.java"/> + + files="checks[\\/]coding[\\/]packagedeclaration[\\/]InputPackageDeclarationPlain.java"/> + files="checks[\\/]coding[\\/]packagedeclaration[\\/]InputPackageDeclarationWithCommentOnly.java"/> + files="checks[\\/]coding[\\/]unnecessarysemicolonaftertypememberdeclaration[\\/]InputUnnecessarySemicolonAfterTypeMemberDeclarationNullAst.java"/> + files="checks[\\/]indentation[\\/]commentsindentation[\\/]InputCommentsIndentationCommentsAfterMethodCall.java"/> + files="checks[\\/]indentation[\\/]commentsindentation[\\/]InputCommentsIndentationCommentsAfterMethodCall.java"/> + files="checks[\\/]indentation[\\/]commentsindentation[\\/]InputCommentsIndentationCommentsAfterMethodCall.java"/> + files="checks[\\/]indentation[\\/]commentsindentation[\\/]InputCommentsIndentationWithInMethodCallWithSameIndent.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocCustomTag.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocCustomTag.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocJavadocTagsWithoutArgs.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocNonTightHtmlTags2.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocNonTightHtmlTags2.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocNonTightHtmlTags2.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocNonTightHtmlTags2.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocNonTightHtmlTags2.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocNonTightHtmlTags2.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocPositionOnlyComments.java"/> + files="checks[\\/]javadoc[\\/]abstractjavadoc[\\/]InputAbstractJavadocTokensPass.java"/> + files="checks[\\/]javadoc[\\/]javadocblocktaglocation[\\/]InputJavadocBlockTagLocationCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocblocktaglocation[\\/]InputJavadocBlockTagLocationMultilineCodeBlock.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationDefault.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationFirstLine.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationFirstLine.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationFirstLine.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationFirstLine.java"/> + files="checks[\\/]javadoc[\\/]javadoccontentlocation[\\/]InputJavadocContentLocationTrimOptionProperty.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethod3.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodConstructor.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodConstructor.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodConstructor.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodConstructor.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodConstructor.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodDefaultAccessModifier.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodDefaultAccessModifier.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodEnum.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodExtendAnnotation.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodExtendAnnotation.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodExtendAnnotation.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodExtendAnnotation.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodGenerics.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodGenerics.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodGenerics.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodGenerics.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodIgnoreThrows.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodIgnoreThrows.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodInheritDoc.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodInheritDoc.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodInheritDoc.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodJavadocInMethod.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodLoadErrors.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocNoMissingTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocTagsDefault.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodMissingJavadocTagsDefault.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodNoJavadocOnlyPrivateScope.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodNoJavadocProtectedScope.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodNoJavadocProtectedScope.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodPublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodReceiverParameter.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodReceiverParameter.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodSurroundingAccessModifier.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodSurroundingAccessModifier.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodSurroundingAccessModifier.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodSurroundingAccessModifier.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodThrowsDetection.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTypeParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTypeParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTypeParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodTypeParamsTags.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethod_1379666.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethod_1379666.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethod_1379666.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethod_1379666.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethod_1379666.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodsNotSkipWritten.java"/> + files="checks[\\/]javadoc[\\/]javadocmethod[\\/]InputJavadocMethodsNotSkipWritten.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadocmissingleadingasterisk[\\/]InputJavadocMissingLeadingAsteriskCorrect.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentation.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationBlockTag.java"/> + files="checks[\\/]javadoc[\\/]javadoctagcontinuationindentation[\\/]InputJavadocTagContinuationIndentationGuavaFalsePositive.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodAllowedAnnotations.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodEnumCtorScopeIsPrivate.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodIgnoreNameRegex.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodIgnoreNameRegex.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodIgnoreNameRegex.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodInterfacePrivateMethod.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodMissingJavadocTags.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodPublicOnly3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodReceiverParameter.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodScopeAnonInner2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodSetterGetter2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodSetterGetter2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodSetterGetter2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethod_01.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethod_02.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocmethod[\\/]InputMissingJavadocMethodsNotSkipWritten.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocpackage[\\/]InputMissingJavadocPackageNotPackageInfo-package-info.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocpackage[\\/]annotation[\\/]package-info.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocpackage[\\/]blank[\\/]package-info.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocpackage[\\/]header[\\/]package-info.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocpackage[\\/]package-info.java"/> + files="checks[\\/]javadoc[\\/]missingjavadocpackage[\\/]singleline[\\/]package-info.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeMultipleQualifiedAnnotation.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeMultipleQualifiedAnnotation.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeMultipleQualifiedAnnotation.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeNoJavadoc3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypePublicOnly1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypePublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypePublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypePublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypePublicOnly2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotation2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotation3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotation4.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotation5.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotation5.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotation5.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotationWithParameters.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotationWithParameters.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeQualifiedAnnotationWithParameters.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerClasses2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeScopeInnerInterfaces2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations1.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations2.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations3.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations4.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations4.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations4.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations4.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeSkipAnnotations4.java"/> + files="checks[\\/]javadoc[\\/]missingjavadoctype[\\/]InputMissingJavadocTypeUnusedParamInJavadocForClass.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocEmptyPeriod.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocHtmlFormat.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocHtmlFormat.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocHtmlFormat.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocHtmlFormat.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocHtmlFormat.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocHtmlFormat.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineCorrect.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineDefault.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineForbidden.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineForbidden.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineForbidden.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineForbidden.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineForbidden.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineForbidden.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineReturn.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineReturn.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineReturn.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineReturn.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocInlineReturn.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocNoPeriod.java"/> + files="checks[\\/]javadoc[\\/]summaryjavadoc[\\/]InputSummaryJavadocTestForbiddenFragments2.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagDefault.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagDefault.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagDefault.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagDoubleTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagDoubleTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagDoubleTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagEmptyTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagEmptyTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagEmptyTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagExpressionError.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagExpressionError.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagExpressionError.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIgnore.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIgnore.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIgnore.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIgnore.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIncomplete.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIncomplete.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagIncomplete.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMethod.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMissingFormat.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMissingFormat.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMissingFormat.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMissingTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMissingTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagMissingTag.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagRegularExpression.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagRegularExpression.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagRegularExpression.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagRegularExpression.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagSeverity.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagSeverity.java"/> + files="checks[\\/]javadoc[\\/]writetag[\\/]InputWriteTagSeverity.java"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + value="^(?!(.*value=.*|.*href=|.*http(s)?:|import |(.* )?package |.* files=|.*\.dtd| \* \{@code| \* com\.)).{101,}$"/> @@ -127,4 +127,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle-non-main-files-suppressions.xml b/config/checkstyle-non-main-files-suppressions.xml index 315e719da7d..9cca8048152 100644 --- a/config/checkstyle-non-main-files-suppressions.xml +++ b/config/checkstyle-non-main-files-suppressions.xml @@ -59,7 +59,16 @@ + files="src[\\/]it[\\/]resources[\\/].*[\\/]InputColumnLimit\.java"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/checkstyle-resources-suppressions.xml b/config/checkstyle-resources-suppressions.xml index 445c2a18937..acceaa4836e 100644 --- a/config/checkstyle-resources-suppressions.xml +++ b/config/checkstyle-resources-suppressions.xml @@ -81,11 +81,13 @@ + files="rule522classnames[\\/]InputClassNames\.java"/> + files="src[\\/]it[\\/]resources[\\/].*[\\/]InputXpathOuterTypeFilename.*\.java"/> + + + + - - - - - - + files="[\\/]it[\\/]resources[\\/]com[\\/]google[\\/]checkstyle[\\/]test[\\/].*[\\/].*[\\/].*\.java"/> - + files="[\\/]it[\\/]resources-noncompilable[\\/]com[\\/]google[\\/]checkstyle[\\/]test[\\/].*[\\/].*[\\/].*\.java"/> + + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/config/error-prone-suppressions/compile-phase-suppressions.xml b/config/error-prone-suppressions/compile-phase-suppressions.xml index 0ce589422fe..c6d5e1a92aa 100644 --- a/config/error-prone-suppressions/compile-phase-suppressions.xml +++ b/config/error-prone-suppressions/compile-phase-suppressions.xml @@ -6,4 +6,18 @@ hashcode method on array does not hash array contents + ", children=" + Objects.hashCode(children) + + + PropertiesMacro.java + CollectorMutability + Avoid `Collectors.to{List,Map,Set}` in favor of collectors that emphasize (im)mutability + }).collect(Collectors.toSet())); + + + + SarifLogger.java + IdentityConversion + This method invocation appears redundant; remove it or suppress this warning and add a comment explaining its purpose + .replace(VERSION_PLACEHOLDER, String.valueOf(version)) + diff --git a/config/error-prone-suppressions/test-compile-phase-suppressions.xml b/config/error-prone-suppressions/test-compile-phase-suppressions.xml index 41bafdafad8..6e9af9e9c15 100644 --- a/config/error-prone-suppressions/test-compile-phase-suppressions.xml +++ b/config/error-prone-suppressions/test-compile-phase-suppressions.xml @@ -6,11 +6,4 @@ Return value of 'findFirst' must be used .findFirst(); - - - PropertyCacheFileTest.java - CheckReturnValue - The result of `toByteArray(...)` must be used - byteStream.when(() -> ByteStreams.toByteArray(any(BufferedInputStream.class))) - diff --git a/config/import-control-test.xml b/config/import-control-test.xml index 601cd9da58d..e4250df0dde 100644 --- a/config/import-control-test.xml +++ b/config/import-control-test.xml @@ -20,13 +20,16 @@ - + + + + @@ -40,6 +43,7 @@ + diff --git a/config/import-control.xml b/config/import-control.xml index 1c2d1093a1c..222543be061 100644 --- a/config/import-control.xml +++ b/config/import-control.xml @@ -19,6 +19,7 @@ + @@ -73,15 +74,31 @@ + + + + + + + + + + + + + + + + @@ -276,6 +293,7 @@ + @@ -289,6 +307,10 @@ + + + + diff --git a/config/intellij-idea-inspections.xml b/config/intellij-idea-inspections.xml index f7736bcb9ed..85a62454019 100644 --- a/config/intellij-idea-inspections.xml +++ b/config/intellij-idea-inspections.xml @@ -4106,6 +4106,9 @@ enabled_by_default="false"/> + + AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -../ConfigurationLoader.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -../ConfigurationLoader.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -../DefaultConfiguration.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. -../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. -../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. -../../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(org.antlr.v4.runtime.CommonTokenStream): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,java.lang.String,java.lang.Object...): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#insertChildrenNodes(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl%5B%5D,org.antlr.v4.runtime.tree.ParseTree): doesn't exist. -../../../JavadocDetailNodeParser.html#insertChildrenNodes(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl%5B%5D,org.antlr.v4.runtime.tree.ParseTree): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.Class,java.lang.String,java.lang.Object...): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -../MetadataGeneratorLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.ClassLoader): doesn't exist. -#%3Cinit%3E(java.util.Set,java.lang.ClassLoader): doesn't exist. -#%3Cinit%3E(java.util.Set,java.lang.ClassLoader,com.puppycrawl.tools.checkstyle.PackageObjectFactory.ModuleLoadOption): doesn't exist. -../PackageObjectFactory.html#%3Cinit%3E(java.util.Set,java.lang.ClassLoader,com.puppycrawl.tools.checkstyle.PackageObjectFactory.ModuleLoadOption): doesn't exist. -#%3Cinit%3E(java.util.Properties): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.Configuration,java.lang.String): doesn't exist. -../../PropertyCacheFile.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.Configuration,java.lang.String): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -../SarifLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -../XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. -../../XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.util.Map): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -../XpathFileGeneratorAuditListener.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#beginTreecom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#finishTreecom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#getAcceptableTokens--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#getDefaultTokens--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#getRequiredTokens--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#isCommentNodesRequired--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#leaveTokencom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#setTokens-java.lang.String...-: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#visitToken-com.puppycrawl.tools.checkstyle.api.DetailAST-: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#visitTokencom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.html#processFiltered-java.io.File-com.puppycrawl.tools.checkstyle.api.FileText-: doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.Object): doesn't exist. -#%3Cinit%3E(java.lang.Object,java.lang.String): doesn't exist. -#%3Cinit%3E(java.lang.Object,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation): doesn't exist. -../AuditEvent.html#%3Cinit%3E(java.lang.Object,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.Throwable): doesn't exist. -#%3Cinit%3E(java.lang.String%5B%5D,int,int,int): doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.html#getExternalResourceLocations--: doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. -../FileContents.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. -../FileText.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. -#%3Cinit%3E(java.io.File,java.lang.String): doesn't exist. -#%3Cinit%3E(java.io.File,java.util.List): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.SeverityLevel): doesn't exist. -../SeverityLevelCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.SeverityLevel): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -../Violation.html#%3Cinit%3E(int,int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -#%3Cinit%3E(int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -../Violation.html#%3Cinit%3E(int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -../Violation.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -../Violation.html#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,int,int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,boolean): doesn't exist. -../../checks/blocks/RightCurlyCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,boolean): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/AbstractSuperCheck.MethodNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame): doesn't exist. -../EqualsAvoidNullCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/FinalLocalVariableCheck.FinalVariableCandidate.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame,boolean,java.lang.String): doesn't exist. -../HiddenFieldCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame,boolean,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#isInContext(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D%5B%5D,java.util.BitSet): doesn't exist. -../../checks/coding/InnerAssignmentCheck.html#isInContext(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D%5B%5D,java.util.BitSet): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.AbstractFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.AbstractFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,java.lang.String): doesn't exist. -../RequireThisCheck.AnonymousClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,java.lang.String): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.BlockFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.BlockFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.CatchFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.CatchFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.ClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.ClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.ConstructorFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.ConstructorFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.ForFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.ForFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.MethodFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.MethodFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/RequireThisCheck.TryWithResourcesFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../RequireThisCheck.TryWithResourcesFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(boolean): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/UnusedLocalVariableCheck.TypeDeclDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/design/FinalClassCheck.ClassDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/design/FinalClassCheck.TypeDeclarationDescription.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/design/HideUtilityClassConstructorCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -../AbstractImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -../AbstractImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -#%3Cinit%3E(boolean,boolean,boolean): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(boolean,boolean,java.lang.String,boolean): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/imports/CustomImportOrderCheck.ImportDetails.html#%3Cinit%3E(java.lang.String,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(java.lang.String,int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean): doesn't exist. -../FileImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#getGroupNumber(java.util.regex.Pattern%5B%5D,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -../PkgImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -../PkgImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -#%3Cinit%3E(java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -../PkgImportControl.html#%3Cinit%3E(java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -#%3Cinit%3E(boolean,boolean,java.lang.String,boolean,boolean): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame): doesn't exist. -../UnusedImportsCheck.Frame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -../../checks/indentation/AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -../AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -../DetailAstSet.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,int...): doesn't exist. -../IndentLevel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,int...): doesn't exist. -#%3Cinit%3E(int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -../LineWrappingHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -../PrimordialHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../../checks/indentation/YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -../YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getAcceptableJavadocTokens--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getBlockCommentAst--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getDefaultJavadocTokens--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getRequiredJavadocTokens--: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#setJavadocTokens-java.lang.String...-: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#visitJavadocToken-com.puppycrawl.tools.checkstyle.api.DetailNode-: doesn't exist. -apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#visitToken-com.puppycrawl.tools.checkstyle.api.DetailAST-: doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,int,boolean,boolean,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.Token): doesn't exist. -../JavadocMethodCheck.ClassInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.Token): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. -../../checks/javadoc/JavadocMethodCheck.ExceptionInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. -../JavadocMethodCheck.ExceptionInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FullIdent): doesn't exist. -../../checks/javadoc/JavadocMethodCheck.Token.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FullIdent): doesn't exist. -#%3Cinit%3E(java.lang.String,int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#getMultilineNoArgTags(java.util.regex.Matcher,java.lang.String%5B%5D,int,int): doesn't exist. -../JavadocMethodCheck.html#getMultilineNoArgTags(java.util.regex.Matcher,java.lang.String%5B%5D,int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int,java.lang.String): doesn't exist. -#%3Cinit%3E(int,int,java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo.Type): doesn't exist. -../JavadocTagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo.Type): doesn't exist. -#%3Cinit%3E(java.util.Collection,java.util.Collection): doesn't exist. -../JavadocTags.html#%3Cinit%3E(java.util.Collection,java.util.Collection): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int): doesn't exist. -#%3Cinit%3E(java.lang.String%5B%5D,int): doesn't exist. -#findChar(java.lang.String%5B%5D,char,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#findChar(java.lang.String%5B%5D,char,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#getNextPoint(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#getNextPoint(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#getTagId(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#getTagId(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#isCommentTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#isCommentTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#isTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#isTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#parseTag(java.lang.String%5B%5D,int,int,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#parseTag(java.lang.String%5B%5D,int,int,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#parseTags(java.lang.String%5B%5D,int): doesn't exist. -#skipHtmlComment(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -../TagParser.html#skipHtmlComment(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.api.LineColumn): doesn't exist. -../../checks/javadoc/utils/TagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.api.LineColumn): doesn't exist. -#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/metrics/AbstractClassCouplingCheck.ClassContext.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(int): doesn't exist. -#%3Cinit%3E(boolean): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.math.BigInteger,java.math.BigInteger): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents): doesn't exist. -../../checks/regexp/CommentSuppressor.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. -../MultilineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. -../SinglelineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/sizes/ExecutableStatementCountCheck.Context.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../checks/sizes/MethodCountCheck.MethodCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#processNestedGenerics(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. -../../checks/whitespace/GenericWhitespaceCheck.html#processNestedGenerics(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. -#processSingleGeneric(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. -../../checks/whitespace/GenericWhitespaceCheck.html#processSingleGeneric(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#isBlockCommentEnd(int%5B%5D,int): doesn't exist. -#isFirstInLine(int%5B%5D,int): doesn't exist. -#isSingleSpace(int%5B%5D,int): doesn't exist. -#isSpace(int%5B%5D,int): doesn't exist. -#isTextSeparatedCorrectlyFromPrevious(int%5B%5D,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(int): doesn't exist. -#%3Cinit%3E(int,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter): doesn't exist. -../SuppressWithNearbyCommentFilter.Tag.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter): doesn't exist. -../SuppressWithNearbyTextFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,int,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. -../SuppressWithPlainTextCommentFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. -../SuppressWithPlainTextCommentFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. -../SuppressionCommentFilter.Tag.html#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. -../SuppressionCommentFilter.Tag.html#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(org.antlr.v4.runtime.Lexer,org.antlr.v4.runtime.atn.ATN,org.antlr.v4.runtime.dfa.DFA%5B%5D,org.antlr.v4.runtime.atn.PredictionContextCache): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.Object,javax.swing.JTextArea,java.util.Collection): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,java.util.List): doesn't exist. -../../gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,java.util.List): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailNode,java.util.List): doesn't exist. -../../gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailNode,java.util.List): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable): doesn't exist. -../ListToTreeSelectionModelWrapper.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../gui/ParseTreeTableModel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#fireTreeStructureChanged(java.lang.Object,java.lang.Object%5B%5D,int%5B%5D,java.lang.Object...): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../gui/ParseTreeTablePresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel): doesn't exist. -../TreeTable.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable,javax.swing.tree.TreeModel): doesn't exist. -../TreeTableCellRenderer.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable,javax.swing.tree.TreeModel): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel,javax.swing.JTree): doesn't exist. -../TreeTableModelAdapter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel,javax.swing.JTree): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.io.Writer,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#endsWith(int%5B%5D,java.lang.String): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#isCodePointWhitespace(int%5B%5D,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,int,int): doesn't exist. -../AbstractElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,int,int): doesn't exist. -#%3Cinit%3E(net.sf.saxon.om.TreeInfo): doesn't exist. -#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. -../../xpath/ElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. -../ElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -../../xpath/RootNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent,int): doesn't exist. -../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent,int): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -#%3Cinit%3E(): doesn't exist. -#%3Cinit%3E(net.sf.saxon.om.NodeInfo,com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator.StartWith): doesn't exist. -../DescendantIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo,com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator.StartWith): doesn't exist. -#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. -#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. -#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. -#%3Cinit%3E(java.util.Collection): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.OutputStreamOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.PatternConverter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.RelaxedAccessModifierArrayConverter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.RelaxedStringArrayConverter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.ScopeConverter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.SeverityLevelConverter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.UriConverter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/Checker.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ConfigurationLoader.IgnoredModulesOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ConfigurationLoader.InternalLoader.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ConfigurationLoader.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultConfiguration.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultConfiguration.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultContext.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. -com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/Definitions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/DetailAstImpl.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavaAstVisitor.DetailAstPair.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavaAstVisitor.html#%3Cinit%3E(org.antlr.v4.runtime.CommonTokenStream): doesn't exist. -com/puppycrawl/tools/checkstyle/JavaParser.CheckstyleErrorListener.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavaParser.Options.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavaParser.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.DescriptiveErrorListener.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.ParseErrorMessage.html#%3Cinit%3E(int,java.lang.String,java.lang.Object...): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.ParseStatus.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.html#insertChildrenNodes(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl%5B%5D,org.antlr.v4.runtime.tree.ParseTree): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.CliOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/LocalizedMessage.Utf8Control.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/LocalizedMessage.html#%3Cinit%3E(java.lang.String,java.lang.Class,java.lang.String,java.lang.Object...): doesn't exist. -com/puppycrawl/tools/checkstyle/Main.CliOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/Main.OnlyCheckstyleLoggersFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/Main.OutputFormat.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/Main.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/PackageNamesLoader.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/PackageObjectFactory.ModuleLoadOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/PackageObjectFactory.html#%3Cinit%3E(java.lang.String,java.lang.ClassLoader): doesn't exist. -com/puppycrawl/tools/checkstyle/PackageObjectFactory.html#%3Cinit%3E(java.util.Set,java.lang.ClassLoader): doesn't exist. -com/puppycrawl/tools/checkstyle/PackageObjectFactory.html#%3Cinit%3E(java.util.Set,java.lang.ClassLoader,com.puppycrawl.tools.checkstyle.PackageObjectFactory.ModuleLoadOption): doesn't exist. -com/puppycrawl/tools/checkstyle/PropertiesExpander.html#%3Cinit%3E(java.util.Properties): doesn't exist. -com/puppycrawl/tools/checkstyle/PropertyCacheFile.ExternalResource.html#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/PropertyCacheFile.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.Configuration,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/PropertyType.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/SarifLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ThreadModeSettings.html#%3Cinit%3E(int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/TreeWalker.AstState.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/TreeWalker.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/XMLLogger.FileMessages.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/XmlLoader.LoadExternalDtdFeatureProvider.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/XmlLoader.html#%3Cinit%3E(java.util.Map): doesn't exist. -com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.Formatter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.FormatterType.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.Property.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AbstractCheck.FileContext.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.FileContext.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AbstractViolationReporter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AuditEvent.html#%3Cinit%3E(java.lang.Object): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AuditEvent.html#%3Cinit%3E(java.lang.Object,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AuditEvent.html#%3Cinit%3E(java.lang.Object,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AutomaticBean.OutputStreamOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/AutomaticBean.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/CheckstyleException.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/CheckstyleException.html#%3Cinit%3E(java.lang.String,java.lang.Throwable): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Comment.html#%3Cinit%3E(java.lang.String%5B%5D,int,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/api/FileContents.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. -com/puppycrawl/tools/checkstyle/api/FileText.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. -com/puppycrawl/tools/checkstyle/api/FileText.html#%3Cinit%3E(java.io.File,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/FileText.html#%3Cinit%3E(java.io.File,java.util.List): doesn't exist. -com/puppycrawl/tools/checkstyle/api/FilterSet.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/FullIdent.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/LineColumn.html#%3Cinit%3E(int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Scope.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/SeverityLevel.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.SeverityLevel): doesn't exist. -com/puppycrawl/tools/checkstyle/api/TokenTypes.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.SequencedProperties.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.Entry.html#%3Cinit%3E(java.lang.String,int,int,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/TranslationCheck.ResourceBundle.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/TranslationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.UniqueProperties.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.ClosingParensOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.ElementStyleOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.TrailingArrayCommaOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/BlockOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.MethodNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.ScopeState.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.FinalVariableCandidate.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.ScopeData.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame,boolean,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.html#isInContext(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D%5B%5D,java.util.BitSet): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.AbstractFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.AnonymousClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.BlockFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.CatchFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.ClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.ConstructorFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.ForFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.FrameType.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.MethodFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.TryWithResourcesFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.Context.html#%3Cinit%3E(boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.TypeDeclDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.ClassDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.TypeDeclarationDescription.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportRule.html#%3Cinit%3E(boolean,boolean,boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/AccessResult.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.html#%3Cinit%3E(boolean,boolean,java.lang.String,boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.ImportDetails.html#%3Cinit%3E(java.lang.String,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.RuleMatchForImport.html#%3Cinit%3E(java.lang.String,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.html#getGroupNumber(java.util.regex.Pattern%5B%5D,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/MismatchStrategy.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.html#%3Cinit%3E(java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.html#%3Cinit%3E(boolean,boolean,java.lang.String,boolean,boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.Frame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/DetailAstSet.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,int...): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.html#%3Cinit%3E(int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.LineWrappingOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/indentation/YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.FileContext.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.html#%3Cinit%3E(java.lang.String,int,int,boolean,boolean,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocTag.html#%3Cinit%3E(int,int,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.ClassInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.Token): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.ExceptionInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.Token.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FullIdent): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.Token.html#%3Cinit%3E(java.lang.String,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.html#getMultilineNoArgTags(java.util.regex.Matcher,java.lang.String%5B%5D,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.html#%3Cinit%3E(int,int,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.Type.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo.Type): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTags.html#%3Cinit%3E(java.util.Collection,java.util.Collection): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocPackageCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/NonEmptyAtclauseDescriptionCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/RequireEmptyLineBeforeBlockTagGroupCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/SingleLineJavadocCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.Point.html#%3Cinit%3E(int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#%3Cinit%3E(java.lang.String%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#findChar(java.lang.String%5B%5D,char,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#getNextPoint(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#getTagId(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#isCommentTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#isTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#parseTag(java.lang.String%5B%5D,int,int,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#parseTags(java.lang.String%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#skipHtmlComment(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/utils/BlockTagUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/javadoc/utils/TagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.api.LineColumn): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.ClassContext.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.html#%3Cinit%3E(int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheck.Context.html#%3Cinit%3E(boolean): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.Counter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.TokenEnd.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.Values.html#%3Cinit%3E(java.math.BigInteger,java.math.BigInteger): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/modifier/InterfaceMemberImpliedModifierCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/AbstractAccessControlNameCheck.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/AbstractNameCheck.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/AccessModifierOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/IllegalIdentifierNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/MethodTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/RecordComponentNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/RecordTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/CommentSuppressor.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.Builder.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/MultilineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/NeverSuppress.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/regexp/SinglelineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.Context.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.MethodCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/AbstractParenPadCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.html#processNestedGenerics(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.html#processSingleGeneric(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCaseDefaultColonCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/PadOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isBlockCommentEnd(int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isFirstInLine(int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isSingleSpace(int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isSpace(int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isTextSeparatedCorrectlyFromPrevious(int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/checks/whitespace/WrapOption.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filefilters/BeforeExecutionExclusionFileFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/CsvFilterElement.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/IntMatchFilterElement.html#%3Cinit%3E(int): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/IntRangeFilterElement.html#%3Cinit%3E(int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.html#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.Tag.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.SuppressionType.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.Tag.html#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.TagType.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionSingleFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/SuppressionsLoader.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.html#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/grammar/CrAwareLexerSimulator.html#%3Cinit%3E(org.antlr.v4.runtime.Lexer,org.antlr.v4.runtime.atn.ATN,org.antlr.v4.runtime.dfa.DFA%5B%5D,org.antlr.v4.runtime.atn.PredictionContextCache): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/BaseCellEditor.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/CodeSelector.html#%3Cinit%3E(java.lang.Object,javax.swing.JTextArea,java.util.Collection): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,java.util.List): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailNode,java.util.List): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/ListToTreeSelectionModelWrapper.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/Main.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrame.ExpandCollapseAction.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrame.FileSelectionAction.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrame.FindNodeByXpathAction.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrame.JavaFileFilter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrame.ReloadAction.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrame.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrameModel.ParseMode.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/MainFrameModel.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/ParseTreeTableModel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/ParseTreeTableModel.html#fireTreeStructureChanged(java.lang.Object,java.lang.Object%5B%5D,int%5B%5D,java.lang.Object...): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/ParseTreeTablePresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/TreeTable.TreeTableCellEditor.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/TreeTable.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/TreeTableCellRenderer.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable,javax.swing.tree.TreeModel): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.UpdatingTreeExpansionListener.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.UpdatingTreeModelListener.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel,javax.swing.JTree): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/MetadataGenerationException.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/ModuleDetails.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/ModulePropertyDetails.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/ModuleType.html#%3Cinit%3E(java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/meta/XmlMetaWriter.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/site/ExampleMacro.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/site/ParentModuleMacro.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/site/SiteUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/site/ViolationMessagesMacro.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.html#%3Cinit%3E(java.io.Writer,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/site/XdocsTemplateSinkFactory.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/BlockCommentPosition.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/CheckUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/CodePointUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/CodePointUtil.html#endsWith(int%5B%5D,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/CommonUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/CommonUtil.html#isCodePointWhitespace(int%5B%5D,int): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/FilterUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/JavadocUtil.JavadocTagType.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/JavadocUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/ModuleReflectionUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/ParserUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/ScopeUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/TokenUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/utils/XpathUtil.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/AbstractNode.html#%3Cinit%3E(net.sf.saxon.om.TreeInfo): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/AbstractRootNode.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/AttributeNode.html#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/ElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/RootNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent,int): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.StartWith.html#%3Cinit%3E(): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo,com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator.StartWith): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseDescendantIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. -com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseListIterator.html#%3Cinit%3E(java.util.Collection): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +../ConfigurationLoader.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +../ConfigurationLoader.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +../DefaultConfiguration.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. +../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. +../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. +../../DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(org.antlr.v4.runtime.CommonTokenStream): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,java.lang.String,java.lang.Object...): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#insertChildrenNodes(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl%5B%5D,org.antlr.v4.runtime.tree.ParseTree): doesn't exist. +../../../JavadocDetailNodeParser.html#insertChildrenNodes(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl%5B%5D,org.antlr.v4.runtime.tree.ParseTree): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.Class,java.lang.String,java.lang.Object...): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +../MetadataGeneratorLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.ClassLoader): doesn't exist. +#%3Cinit%3E(java.util.Set,java.lang.ClassLoader): doesn't exist. +#%3Cinit%3E(java.util.Set,java.lang.ClassLoader,com.puppycrawl.tools.checkstyle.PackageObjectFactory.ModuleLoadOption): doesn't exist. +../PackageObjectFactory.html#%3Cinit%3E(java.util.Set,java.lang.ClassLoader,com.puppycrawl.tools.checkstyle.PackageObjectFactory.ModuleLoadOption): doesn't exist. +#%3Cinit%3E(java.util.Properties): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.Configuration,java.lang.String): doesn't exist. +../../PropertyCacheFile.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.Configuration,java.lang.String): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +../SarifLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +../XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. +../../XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.util.Map): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +../XpathFileGeneratorAuditListener.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#beginTreecom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#finishTreecom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#getAcceptableTokens--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#getDefaultTokens--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#getRequiredTokens--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#isCommentNodesRequired--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#leaveTokencom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#setTokens-java.lang.String...-: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#visitToken-com.puppycrawl.tools.checkstyle.api.DetailAST-: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#visitTokencom.puppycrawl.tools.checkstyle.api.DetailAST: doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.html#processFiltered-java.io.File-com.puppycrawl.tools.checkstyle.api.FileText-: doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.Object): doesn't exist. +#%3Cinit%3E(java.lang.Object,java.lang.String): doesn't exist. +#%3Cinit%3E(java.lang.Object,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation): doesn't exist. +../AuditEvent.html#%3Cinit%3E(java.lang.Object,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.Throwable): doesn't exist. +#%3Cinit%3E(java.lang.String%5B%5D,int,int,int): doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.html#getExternalResourceLocations--: doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. +../FileContents.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. +../FileText.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. +#%3Cinit%3E(java.io.File,java.lang.String): doesn't exist. +#%3Cinit%3E(java.io.File,java.util.List): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.SeverityLevel): doesn't exist. +../SeverityLevelCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.SeverityLevel): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +../Violation.html#%3Cinit%3E(int,int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +#%3Cinit%3E(int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +../Violation.html#%3Cinit%3E(int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +../Violation.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +../Violation.html#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,int,int,int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,boolean): doesn't exist. +../../checks/blocks/RightCurlyCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/AbstractSuperCheck.MethodNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame): doesn't exist. +../EqualsAvoidNullCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/FinalLocalVariableCheck.FinalVariableCandidate.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame,boolean,java.lang.String): doesn't exist. +../HiddenFieldCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame,boolean,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#isInContext(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D%5B%5D,java.util.BitSet): doesn't exist. +../../checks/coding/InnerAssignmentCheck.html#isInContext(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D%5B%5D,java.util.BitSet): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.AbstractFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.AbstractFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,java.lang.String): doesn't exist. +../RequireThisCheck.AnonymousClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,java.lang.String): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.BlockFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.BlockFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.CatchFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.CatchFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.ClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.ClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.ConstructorFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.ConstructorFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.ForFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.ForFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.MethodFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.MethodFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/RequireThisCheck.TryWithResourcesFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../RequireThisCheck.TryWithResourcesFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.LambdaParameterDetails.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/UnusedLocalVariableCheck.TypeDeclDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/design/FinalClassCheck.ClassDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/design/FinalClassCheck.TypeDeclarationDescription.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/design/HideUtilityClassConstructorCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +../AbstractImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +../AbstractImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +#%3Cinit%3E(boolean,boolean,boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(boolean,boolean,java.lang.String,boolean): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/imports/CustomImportOrderCheck.ImportDetails.html#%3Cinit%3E(java.lang.String,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(java.lang.String,int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean): doesn't exist. +../FileImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#getGroupNumber(java.util.regex.Pattern%5B%5D,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +../PkgImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +../PkgImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +#%3Cinit%3E(java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +../PkgImportControl.html#%3Cinit%3E(java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +#%3Cinit%3E(boolean,boolean,java.lang.String,boolean,boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame): doesn't exist. +../UnusedImportsCheck.Frame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +../../checks/indentation/AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +../AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +../DetailAstSet.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,int...): doesn't exist. +../IndentLevel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,int...): doesn't exist. +#%3Cinit%3E(int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +../LineWrappingHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +../PrimordialHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../../checks/indentation/YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +../YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getAcceptableJavadocTokens--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getBlockCommentAst--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getDefaultJavadocTokens--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#getRequiredJavadocTokens--: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#setJavadocTokens-java.lang.String...-: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#visitJavadocToken-com.puppycrawl.tools.checkstyle.api.DetailNode-: doesn't exist. +apidocs/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#visitToken-com.puppycrawl.tools.checkstyle.api.DetailAST-: doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,int,int,boolean,boolean,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.Token): doesn't exist. +../JavadocMethodCheck.ClassInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.Token): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. +../../checks/javadoc/JavadocMethodCheck.ExceptionInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. +../JavadocMethodCheck.ExceptionInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FullIdent): doesn't exist. +../../checks/javadoc/JavadocMethodCheck.Token.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FullIdent): doesn't exist. +#%3Cinit%3E(java.lang.String,int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#getMultilineNoArgTags(java.util.regex.Matcher,java.lang.String%5B%5D,int,int): doesn't exist. +../JavadocMethodCheck.html#getMultilineNoArgTags(java.util.regex.Matcher,java.lang.String%5B%5D,int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int,java.lang.String): doesn't exist. +#%3Cinit%3E(int,int,java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo.Type): doesn't exist. +../JavadocTagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo.Type): doesn't exist. +#%3Cinit%3E(java.util.Collection,java.util.Collection): doesn't exist. +../JavadocTags.html#%3Cinit%3E(java.util.Collection,java.util.Collection): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int): doesn't exist. +#%3Cinit%3E(java.lang.String%5B%5D,int): doesn't exist. +#findChar(java.lang.String%5B%5D,char,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#findChar(java.lang.String%5B%5D,char,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#getNextPoint(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#getNextPoint(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#getTagId(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#getTagId(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#isCommentTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#isCommentTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#isTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#isTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#parseTag(java.lang.String%5B%5D,int,int,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#parseTag(java.lang.String%5B%5D,int,int,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#parseTags(java.lang.String%5B%5D,int): doesn't exist. +#skipHtmlComment(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +../TagParser.html#skipHtmlComment(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.api.LineColumn): doesn't exist. +../../checks/javadoc/utils/TagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.api.LineColumn): doesn't exist. +#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/metrics/AbstractClassCouplingCheck.ClassContext.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(int): doesn't exist. +#%3Cinit%3E(boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.math.BigInteger,java.math.BigInteger): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents): doesn't exist. +../../checks/regexp/CommentSuppressor.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. +../MultilineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. +../SinglelineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/sizes/ExecutableStatementCountCheck.Context.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../checks/sizes/MethodCountCheck.MethodCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#processNestedGenerics(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. +../../checks/whitespace/GenericWhitespaceCheck.html#processNestedGenerics(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. +#processSingleGeneric(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. +../../checks/whitespace/GenericWhitespaceCheck.html#processSingleGeneric(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#isBlockCommentEnd(int%5B%5D,int): doesn't exist. +#isFirstInLine(int%5B%5D,int): doesn't exist. +#isSingleSpace(int%5B%5D,int): doesn't exist. +#isSpace(int%5B%5D,int): doesn't exist. +#isTextSeparatedCorrectlyFromPrevious(int%5B%5D,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(int): doesn't exist. +#%3Cinit%3E(int,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter): doesn't exist. +../SuppressWithNearbyCommentFilter.Tag.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter): doesn't exist. +../SuppressWithNearbyTextFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. +../SuppressWithPlainTextCommentFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. +../SuppressWithPlainTextCommentFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. +../SuppressionCommentFilter.Tag.html#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. +../SuppressionCommentFilter.Tag.html#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(org.antlr.v4.runtime.Lexer,org.antlr.v4.runtime.atn.ATN,org.antlr.v4.runtime.dfa.DFA%5B%5D,org.antlr.v4.runtime.atn.PredictionContextCache): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.Object,javax.swing.JTextArea,java.util.Collection): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,java.util.List): doesn't exist. +../../gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,java.util.List): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailNode,java.util.List): doesn't exist. +../../gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailNode,java.util.List): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable): doesn't exist. +../ListToTreeSelectionModelWrapper.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../gui/ParseTreeTableModel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#fireTreeStructureChanged(java.lang.Object,java.lang.Object%5B%5D,int%5B%5D,java.lang.Object...): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../gui/ParseTreeTablePresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel): doesn't exist. +../TreeTable.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable,javax.swing.tree.TreeModel): doesn't exist. +../TreeTableCellRenderer.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable,javax.swing.tree.TreeModel): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel,javax.swing.JTree): doesn't exist. +../TreeTableModelAdapter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel,javax.swing.JTree): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#getDifference(int%5B%5D,int...): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.io.Writer,java.lang.String): doesn't exist. +#tableRows(int%5B%5D,boolean): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#endsWith(int%5B%5D,java.lang.String): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#isCodePointWhitespace(int%5B%5D,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#copyOfArray(T%5B%5D,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,int,int): doesn't exist. +../AbstractElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,int,int): doesn't exist. +#%3Cinit%3E(net.sf.saxon.om.TreeInfo): doesn't exist. +#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. +../../xpath/ElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. +../ElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +../../xpath/RootNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent,int): doesn't exist. +../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent,int): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +../../xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +#%3Cinit%3E(): doesn't exist. +#%3Cinit%3E(net.sf.saxon.om.NodeInfo,com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator.StartWith): doesn't exist. +../DescendantIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo,com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator.StartWith): doesn't exist. +#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. +#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. +#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. +#%3Cinit%3E(java.util.Collection): doesn't exist. +#%3Cinit%3E(java.io.Writer): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.OutputStreamOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.PatternArrayConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.PatternConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.RelaxedAccessModifierArrayConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.RelaxedStringArrayConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.ScopeConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.SeverityLevelConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.UriConverter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/Checker.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ConfigurationLoader.IgnoredModulesOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ConfigurationLoader.InternalLoader.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ConfigurationLoader.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.PropertyResolver,boolean,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultConfiguration.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultConfiguration.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.ThreadModeSettings): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultContext.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions,com.puppycrawl.tools.checkstyle.AuditEventFormatter): doesn't exist. +com/puppycrawl/tools/checkstyle/DefaultLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/Definitions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/DetailAstImpl.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavaAstVisitor.DetailAstPair.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavaAstVisitor.html#%3Cinit%3E(org.antlr.v4.runtime.CommonTokenStream): doesn't exist. +com/puppycrawl/tools/checkstyle/JavaParser.CheckstyleErrorListener.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavaParser.Options.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavaParser.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.DescriptiveErrorListener.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.ParseErrorMessage.html#%3Cinit%3E(int,java.lang.String,java.lang.Object...): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.ParseStatus.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.html#insertChildrenNodes(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl%5B%5D,org.antlr.v4.runtime.tree.ParseTree): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.CliOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/LocalizedMessage.Utf8Control.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/LocalizedMessage.html#%3Cinit%3E(java.lang.String,java.lang.Class,java.lang.String,java.lang.Object...): doesn't exist. +com/puppycrawl/tools/checkstyle/Main.CliOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/Main.OnlyCheckstyleLoggersFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/Main.OutputFormat.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/Main.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/OsSpecificUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/PackageNamesLoader.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/PackageObjectFactory.ModuleLoadOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/PackageObjectFactory.html#%3Cinit%3E(java.lang.String,java.lang.ClassLoader): doesn't exist. +com/puppycrawl/tools/checkstyle/PackageObjectFactory.html#%3Cinit%3E(java.util.Set,java.lang.ClassLoader): doesn't exist. +com/puppycrawl/tools/checkstyle/PackageObjectFactory.html#%3Cinit%3E(java.util.Set,java.lang.ClassLoader,com.puppycrawl.tools.checkstyle.PackageObjectFactory.ModuleLoadOption): doesn't exist. +com/puppycrawl/tools/checkstyle/PropertiesExpander.html#%3Cinit%3E(java.util.Properties): doesn't exist. +com/puppycrawl/tools/checkstyle/PropertyCacheFile.ExternalResource.html#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/PropertyCacheFile.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.Configuration,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/PropertyType.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/SarifLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ThreadModeSettings.html#%3Cinit%3E(int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/TreeWalker.AstState.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/TreeWalker.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/TreeWalkerAuditEvent.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/XMLLogger.FileMessages.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/XMLLogger.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.api.AutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/XmlLoader.LoadExternalDtdFeatureProvider.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/XmlLoader.html#%3Cinit%3E(java.util.Map): doesn't exist. +com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.html#%3Cinit%3E(java.io.OutputStream,com.puppycrawl.tools.checkstyle.AbstractAutomaticBean.OutputStreamOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.Formatter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.FormatterType.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.Property.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AbstractCheck.FileContext.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AbstractCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.FileContext.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AbstractViolationReporter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AuditEvent.html#%3Cinit%3E(java.lang.Object): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AuditEvent.html#%3Cinit%3E(java.lang.Object,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AuditEvent.html#%3Cinit%3E(java.lang.Object,java.lang.String,com.puppycrawl.tools.checkstyle.api.Violation): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AutomaticBean.OutputStreamOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/AutomaticBean.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/CheckstyleException.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/CheckstyleException.html#%3Cinit%3E(java.lang.String,java.lang.Throwable): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Comment.html#%3Cinit%3E(java.lang.String%5B%5D,int,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/api/FileContents.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. +com/puppycrawl/tools/checkstyle/api/FileText.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileText): doesn't exist. +com/puppycrawl/tools/checkstyle/api/FileText.html#%3Cinit%3E(java.io.File,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/FileText.html#%3Cinit%3E(java.io.File,java.util.List): doesn't exist. +com/puppycrawl/tools/checkstyle/api/FilterSet.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/FullIdent.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/LineColumn.html#%3Cinit%3E(int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Scope.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/SeverityLevel.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.SeverityLevel): doesn't exist. +com/puppycrawl/tools/checkstyle/api/TokenTypes.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,com.puppycrawl.tools.checkstyle.api.SeverityLevel,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/api/Violation.html#%3Cinit%3E(int,java.lang.String,java.lang.String,java.lang.Object%5B%5D,java.lang.String,java.lang.Class,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/WhenShouldBeUsedCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.SequencedProperties.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.Entry.html#%3Cinit%3E(java.lang.String,int,int,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/TranslationCheck.ResourceBundle.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/TranslationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.UniqueProperties.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.ClosingParensOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.ElementStyleOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.TrailingArrayCommaOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/BlockOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.MethodNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ConstructorsDeclarationGroupingCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.ScopeState.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck.FieldFrame): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.FinalVariableCandidate.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.ScopeData.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.FieldFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.HiddenFieldCheck.FieldFrame,boolean,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.html#isInContext(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D%5B%5D,java.util.BitSet): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MissingNullCaseInSwitchCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.AbstractFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.AnonymousClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.BlockFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.CatchFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.ClassFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.ConstructorFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.ForFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.FrameType.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.MethodFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.TryWithResourcesFrame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck.AbstractFrame,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.Context.html#%3Cinit%3E(boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedCatchParameterShouldBeUnnamedCheck.CatchParameterDetails.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedCatchParameterShouldBeUnnamedCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.LambdaParameterDetails.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.TypeDeclDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.VariableDesc.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.ClassDesc.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.TypeDeclarationDescription.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.Details.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/SealedShouldHavePermitsListCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.AbstractImportControl,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportRule.html#%3Cinit%3E(boolean,boolean,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/AccessResult.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.html#%3Cinit%3E(boolean,boolean,java.lang.String,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.ImportDetails.html#%3Cinit%3E(java.lang.String,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.RuleMatchForImport.html#%3Cinit%3E(java.lang.String,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.html#getGroupNumber(java.util.regex.Pattern%5B%5D,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/MismatchStrategy.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl,java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.html#%3Cinit%3E(java.lang.String,boolean,com.puppycrawl.tools.checkstyle.checks.imports.MismatchStrategy): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.html#%3Cinit%3E(boolean,boolean,java.lang.String,boolean,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.Frame.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck.Frame): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.html#checkChildren(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,boolean,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/DetailAstSet.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentLevel,int...): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.html#%3Cinit%3E(int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.LineWrappingOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/SwitchRuleHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/SynchronizedHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/indentation/YieldHandler.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck,com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.indentation.AbstractExpressionHandler): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.FileContext.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.html#%3Cinit%3E(java.lang.String,int,int,boolean,boolean,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocTag.html#%3Cinit%3E(int,int,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.ClassInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.Token): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.ExceptionInfo.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.ClassInfo): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.Token.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FullIdent): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.Token.html#%3Cinit%3E(java.lang.String,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.html#getMultilineNoArgTags(java.util.regex.Matcher,java.lang.String%5B%5D,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.html#%3Cinit%3E(int,int,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTag.html#%3Cinit%3E(int,int,java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagContinuationIndentationCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.Type.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo.Type): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTags.html#%3Cinit%3E(java.util.Collection,java.util.Collection): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocMethodCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocPackageCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/MissingJavadocTypeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/NonEmptyAtclauseDescriptionCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/RequireEmptyLineBeforeBlockTagGroupCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/SingleLineJavadocCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.Point.html#%3Cinit%3E(int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#%3Cinit%3E(java.lang.String%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#findChar(java.lang.String%5B%5D,char,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#getNextPoint(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#getTagId(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#isCommentTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#isTag(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#parseTag(java.lang.String%5B%5D,int,int,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#parseTags(java.lang.String%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser.html#skipHtmlComment(java.lang.String%5B%5D,com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser.Point): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/WriteTagCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/utils/BlockTagUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/utils/InlineTagUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/javadoc/utils/TagInfo.html#%3Cinit%3E(java.lang.String,java.lang.String,com.puppycrawl.tools.checkstyle.api.LineColumn): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.ClassContext.html#%3Cinit%3E(java.lang.String,com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/AbstractClassCouplingCheck.html#%3Cinit%3E(int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheck.Context.html#%3Cinit%3E(boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/BooleanExpressionComplexityCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/ClassDataAbstractionCouplingCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/ClassFanOutComplexityCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.Counter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/JavaNCSSCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.TokenEnd.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.Values.html#%3Cinit%3E(java.math.BigInteger,java.math.BigInteger): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/modifier/ClassMemberImpliedModifierCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/modifier/InterfaceMemberImpliedModifierCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/modifier/ModifierOrderCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/modifier/RedundantModifierCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/AbbreviationAsWordInNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/AbstractAccessControlNameCheck.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/AbstractClassNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/AbstractNameCheck.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/AccessModifierOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/CatchParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/ClassTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/IllegalIdentifierNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/InterfaceTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/LambdaParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/MethodTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/PackageNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/ParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/PatternVariableNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/RecordComponentNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/RecordTypeParameterNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/naming/TypeNameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/CommentSuppressor.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.FileContents): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.Builder.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/DetectorOptions.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/MultilineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/NeverSuppress.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/RegexpCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/RegexpMultilineCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/RegexpOnFilenameCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/RegexpSinglelineJavaCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/regexp/SinglelineDetector.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.checks.regexp.DetectorOptions): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/AnonInnerLengthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.Context.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/ExecutableStatementCountCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/FileLengthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/LambdaBodyLengthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/LineLengthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.MethodCounter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/MethodLengthCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/OuterTypeNumberCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/sizes/RecordComponentNumberCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/AbstractParenPadCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForInitializerPadCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyForIteratorPadCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/EmptyLineSeparatorCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/FileTabCharacterCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.html#processNestedGenerics(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/GenericWhitespaceCheck.html#processSingleGeneric(com.puppycrawl.tools.checkstyle.api.DetailAST,int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/MethodParamPadCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/NoLineWrapCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceAfterCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCaseDefaultColonCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/NoWhitespaceBeforeCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/OperatorWrapCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/PadOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/ParenPadCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SeparatorWrapCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isBlockCommentEnd(int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isFirstInLine(int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isSingleSpace(int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isSpace(int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/SingleSpaceSeparatorCheck.html#isTextSeparatedCorrectlyFromPrevious(int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/TypecastParenPadCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAfterCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheck.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/checks/whitespace/WrapOption.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filefilters/BeforeExecutionExclusionFileFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/CsvFilterElement.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/IntMatchFilterElement.html#%3Cinit%3E(int): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/IntRangeFilterElement.html#%3Cinit%3E(int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SeverityMatchFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressFilterElement.html#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWarningsFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.Tag.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyCommentFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithNearbyTextFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.Suppression.html#%3Cinit%3E(java.lang.String,int,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter.SuppressionType,com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.SuppressionType.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressWithPlainTextCommentFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.Tag.html#%3Cinit%3E(int,int,java.lang.String,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter.TagType,com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.TagType.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionSingleFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionXpathFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionXpathSingleFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/SuppressionsLoader.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.html#%3Cinit%3E(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/filters/XpathFilterElement.html#%3Cinit%3E(java.util.regex.Pattern,java.util.regex.Pattern,java.util.regex.Pattern,java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/grammar/CrAwareLexerSimulator.html#%3Cinit%3E(org.antlr.v4.runtime.Lexer,org.antlr.v4.runtime.atn.ATN,org.antlr.v4.runtime.dfa.DFA%5B%5D,org.antlr.v4.runtime.atn.PredictionContextCache): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/BaseCellEditor.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/CodeSelector.html#%3Cinit%3E(java.lang.Object,javax.swing.JTextArea,java.util.Collection): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,java.util.List): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/CodeSelectorPresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailNode,java.util.List): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/ListToTreeSelectionModelWrapper.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/Main.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrame.ExpandCollapseAction.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrame.FileSelectionAction.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrame.FindNodeByXpathAction.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrame.JavaFileFilter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrame.ReloadAction.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrame.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrameModel.ParseMode.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/MainFrameModel.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/ParseTreeTableModel.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/ParseTreeTableModel.html#fireTreeStructureChanged(java.lang.Object,java.lang.Object%5B%5D,int%5B%5D,java.lang.Object...): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/ParseTreeTablePresentation.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/TreeTable.TreeTableCellEditor.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/TreeTable.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/TreeTableCellRenderer.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.TreeTable,javax.swing.tree.TreeModel): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.UpdatingTreeExpansionListener.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.UpdatingTreeModelListener.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/gui/TreeTableModelAdapter.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.gui.ParseTreeTableModel,javax.swing.JTree): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/JavadocMetadataScraper.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/MetadataGenerationException.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/MetadataGeneratorUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/ModuleDetails.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/ModulePropertyDetails.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/ModuleType.html#%3Cinit%3E(java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/XmlMetaReader.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/meta/XmlMetaWriter.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/ClassAndPropertiesSettersJavadocScraper.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/ExampleMacro.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/ParentModuleMacro.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/PropertiesMacro.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/SiteUtil.DescriptionExtractor.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/SiteUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/SiteUtil.html#getDifference(int%5B%5D,int...): doesn't exist. +com/puppycrawl/tools/checkstyle/site/ViolationMessagesMacro.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/XdocsTemplateParser.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.html#%3Cinit%3E(java.io.Writer,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.html#tableRows(int%5B%5D,boolean): doesn't exist. +com/puppycrawl/tools/checkstyle/site/XdocsTemplateSinkFactory.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/AnnotationUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/BlockCommentPosition.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/ChainedPropertyUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/CheckUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/CodePointUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/CodePointUtil.html#endsWith(int%5B%5D,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/CommonUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/CommonUtil.html#isCodePointWhitespace(int%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/FilterUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/JavadocUtil.JavadocTagType.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/JavadocUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/ModuleReflectionUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/ParserUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/ScopeUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/TokenUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/XpathUtil.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/AbstractElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/AbstractNode.html#%3Cinit%3E(net.sf.saxon.om.TreeInfo): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/AbstractNode.html#getDeclaredNamespaces(net.sf.saxon.om.NamespaceBinding%5B%5D): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/AbstractRootNode.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/AttributeNode.html#%3Cinit%3E(java.lang.String,java.lang.String): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/ElementNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.xpath.AbstractNode,com.puppycrawl.tools.checkstyle.api.DetailAST,int,int): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/RootNode.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent,int): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/XpathQueryGenerator.html#%3Cinit%3E(com.puppycrawl.tools.checkstyle.api.DetailAST,int,int,int,com.puppycrawl.tools.checkstyle.api.FileText,int): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.StartWith.html#%3Cinit%3E(): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/iterators/DescendantIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo,com.puppycrawl.tools.checkstyle.xpath.iterators.DescendantIterator.StartWith): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/iterators/FollowingIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/iterators/PrecedingIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseDescendantIterator.html#%3Cinit%3E(net.sf.saxon.om.NodeInfo): doesn't exist. +com/puppycrawl/tools/checkstyle/xpath/iterators/ReverseListIterator.html#%3Cinit%3E(java.util.Collection): doesn't exist. +com/puppycrawl/tools/checkstyle/utils/UnmodifiableCollectionUtil.html#copyOfArray(T%5B%5D,int): doesn't exist. +com/puppycrawl/tools/checkstyle/site/XdocsTemplateSink.CustomPrintWriter.html#%3Cinit%3E(java.io.Writer): doesn't exist. diff --git a/config/pitest-suppressions/pitest-api-suppressions.xml b/config/pitest-suppressions/pitest-api-suppressions.xml index b00396e26a9..ee8189065be 100644 --- a/config/pitest-suppressions/pitest-api-suppressions.xml +++ b/config/pitest-suppressions/pitest-api-suppressions.xml @@ -9,51 +9,6 @@ charset = null; - - FileText.java - com.puppycrawl.tools.checkstyle.api.FileText - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/nio/charset/CharsetDecoder::onMalformedInput - decoder.onMalformedInput(CodingErrorAction.REPLACE); - - - - FileText.java - com.puppycrawl.tools.checkstyle.api.FileText - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/nio/charset/CharsetDecoder::onMalformedInput with receiver - decoder.onMalformedInput(CodingErrorAction.REPLACE); - - - - FileText.java - com.puppycrawl.tools.checkstyle.api.FileText - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/nio/charset/CharsetDecoder::onUnmappableCharacter - decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); - - - - FileText.java - com.puppycrawl.tools.checkstyle.api.FileText - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/nio/charset/CharsetDecoder::onUnmappableCharacter with receiver - decoder.onUnmappableCharacter(CodingErrorAction.REPLACE); - - - - Violation.java - com.puppycrawl.tools.checkstyle.api.Violation - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Arrays::copyOf with argument - this.args = Arrays.copyOf(args, args.length); - - Violation.java com.puppycrawl.tools.checkstyle.api.Violation @@ -62,13 +17,4 @@ Removed assignment to member variable args this.args = null; - - - Violation.java - com.puppycrawl.tools.checkstyle.api.Violation - compareTo - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/String::compareTo - result = getViolation().compareTo(other.getViolation()); - diff --git a/config/pitest-suppressions/pitest-coding-1-suppressions.xml b/config/pitest-suppressions/pitest-coding-1-suppressions.xml new file mode 100644 index 00000000000..564e522b55e --- /dev/null +++ b/config/pitest-suppressions/pitest-coding-1-suppressions.xml @@ -0,0 +1,47 @@ + + + + VariableDeclarationUsageDistanceCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck + getDistToVariableUsageInChildNode + org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator + replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::getFirstChild with receiver + examineNode = examineNode.getFirstChild().getNextSibling(); + + + + VariableDeclarationUsageDistanceCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck + getDistToVariableUsageInChildNode + org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator + replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::getNextSibling with receiver + examineNode = examineNode.getFirstChild().getNextSibling(); + + + + VariableDeclarationUsageDistanceCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck + getDistToVariableUsageInChildNode + org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator + removed call to com/puppycrawl/tools/checkstyle/api/DetailAST::getType + if (examineNode.getType() == TokenTypes.LABELED_STAT) { + + + + VariableDeclarationUsageDistanceCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck + getDistToVariableUsageInChildNode + org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE + removed conditional - replaced equality check with false + if (examineNode.getType() == TokenTypes.LABELED_STAT) { + + + + VariableDeclarationUsageDistanceCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck + getDistToVariableUsageInChildNode + org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_4 + RemoveSwitch 4 (case value 89) + switch (examineNode.getType()) { + + diff --git a/config/pitest-suppressions/pitest-coding-2-suppressions.xml b/config/pitest-suppressions/pitest-coding-2-suppressions.xml index d47cdd11c82..894830e692b 100644 --- a/config/pitest-suppressions/pitest-coding-2-suppressions.xml +++ b/config/pitest-suppressions/pitest-coding-2-suppressions.xml @@ -1,67 +1,39 @@ + - FallThroughCheck.java - com.puppycrawl.tools.checkstyle.checks.coding.FallThroughCheck - matchesComment - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Matcher::start - lineNo, matcher.start(), lineNo, matcher.end()); - - - - FinalLocalVariableCheck.java - com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck - leaveToken - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/Deque::pop - prevScopeUninitializedVariables.pop(); + UnusedLocalVariableCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck + getBlockContainingLocalAnonInnerClass + org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator + negated conditional + if (currentAst.getType() == TokenTypes.LAMBDA) { - - - - - - - - - - - MatchXpathCheck.java - com.puppycrawl.tools.checkstyle.checks.coding.MatchXpathCheck - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable query - private String query = ""; + UnusedLocalVariableCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck + getBlockContainingLocalAnonInnerClass + org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF + removed conditional - replaced equality check with true + if (currentAst.getType() == TokenTypes.LAMBDA) { - MatchXpathCheck.java - com.puppycrawl.tools.checkstyle.checks.coding.MatchXpathCheck - setQuery - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable query - this.query = query; + UnusedLocalVariableCheck.java + com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck + isInsideLocalAnonInnerClass + org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator + negated conditional + if (currentAst.getType() == TokenTypes.SLIST) { - - - - - - - - - UnusedLocalVariableCheck.java - com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck$TypeDeclDesc - getUpdatedCopyOfVarStack - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::getLastChild with receiver - final DetailAST updatedScope = literalNewAst.getLastChild(); + com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheck + isInsideLocalAnonInnerClass + org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF + removed conditional - replaced equality check with true + if (currentAst.getType() == TokenTypes.SLIST) { - diff --git a/config/pitest-suppressions/pitest-common-2-suppressions.xml b/config/pitest-suppressions/pitest-common-2-suppressions.xml deleted file mode 100644 index 3945d750166..00000000000 --- a/config/pitest-suppressions/pitest-common-2-suppressions.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable childCount - private int childCount = NOT_INITIALIZED; - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - addChild - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/DetailAstImpl::getLastChild - astImpl.previousSibling = (DetailAstImpl) getLastChild(); - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - addChild - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable previousSibling - astImpl.previousSibling = (DetailAstImpl) getLastChild(); - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - addNextSibling - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable previousSibling - astImpl.previousSibling = this; - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - addNextSibling - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable previousSibling - sibling.previousSibling = astImpl; - - - - - - - - - - - - - - - - - - - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - removeChildren - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable firstChild - firstChild = null; - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - toString - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/DetailAstImpl::getColumnNo - return text + "[" + getLineNo() + "x" + getColumnNo() + "]"; - - - - DetailAstImpl.java - com.puppycrawl.tools.checkstyle.DetailAstImpl - toString - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/DetailAstImpl::getLineNo - return text + "[" + getLineNo() + "x" + getColumnNo() + "]"; - - - - JavaParser.java - com.puppycrawl.tools.checkstyle.JavaParser - appendHiddenCommentNodes - org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator - replaced return value with null for com/puppycrawl/tools/checkstyle/JavaParser::appendHiddenCommentNodes - return root; - - - - JavaParser.java - com.puppycrawl.tools.checkstyle.JavaParser - parseFile - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/io/File::getAbsoluteFile with receiver - final FileText text = new FileText(file.getAbsoluteFile(), - - - - JavadocPropertiesGenerator.java - com.puppycrawl.tools.checkstyle.JavadocPropertiesGenerator - getFirstJavadocSentence - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/api/DetailAST::getNextSibling - child = child.getNextSibling()) { - - - - JavadocPropertiesGenerator.java - com.puppycrawl.tools.checkstyle.JavadocPropertiesGenerator - main - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to picocli/CommandLine::setUsageHelpWidth with receiver - final CommandLine cmd = new CommandLine(cliOptions).setUsageHelpWidth(USAGE_HELP_WIDTH); - - - - XmlLoader.java - com.puppycrawl.tools.checkstyle.XmlLoader - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Map::copyOf with argument - this.publicIdToResourceNameMap = Map.copyOf(publicIdToResourceNameMap); - - - - XmlLoader.java - com.puppycrawl.tools.checkstyle.XmlLoader - resolveEntity - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to org/xml/sax/helpers/DefaultHandler::resolveEntity - inputSource = super.resolveEntity(publicId, systemId); - - - - - JavaParser.java - com.puppycrawl.tools.checkstyle.JavaParser - parse - org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/grammar/java/JavaLanguageLexer::removeErrorListeners - lexer.removeErrorListeners(); - - diff --git a/config/pitest-suppressions/pitest-common-suppressions.xml b/config/pitest-suppressions/pitest-common-suppressions.xml index 1ed5890ad56..5d3e15ec845 100644 --- a/config/pitest-suppressions/pitest-common-suppressions.xml +++ b/config/pitest-suppressions/pitest-common-suppressions.xml @@ -1,183 +1,12 @@ - - AuditEventDefaultFormatter.java - com.puppycrawl.tools.checkstyle.AuditEventDefaultFormatter - format - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter::calculateBufferLength - final int bufLen = calculateBufferLength(event, severityLevelName.length()); - - - - AuditEventDefaultFormatter.java - com.puppycrawl.tools.checkstyle.AuditEventDefaultFormatter - format - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/String::length - final int bufLen = calculateBufferLength(event, severityLevelName.length()); - - - - AuditEventDefaultFormatter.java - com.puppycrawl.tools.checkstyle.AuditEventDefaultFormatter - format - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter::calculateBufferLength with argument - final int bufLen = calculateBufferLength(event, severityLevelName.length()); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable fileExtensions - private String[] fileExtensions = CommonUtil.EMPTY_STRING_ARRAY; - - Checker.java com.puppycrawl.tools.checkstyle.Checker acceptFileStarted org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/CommonUtil::relativizeAndNormalizePath with argument - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - fireErrors - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/CommonUtil::relativizeAndNormalizePath with argument - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - fireFileFinished - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/CommonUtil::relativizeAndNormalizePath with argument - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - fireFileStarted - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/CommonUtil::relativizeAndNormalizePath with argument - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - getExternalResourceLocations - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/stream/Stream::map with receiver - .map(ExternalResourceHolder.class::cast) - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - processFile - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/io/IOException::getMessage - new String[] {ioe.getMessage()}, null, getClass(), null)); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - processFiles - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/io/File::getPath - throw new Error("Error was thrown while processing " + file.getPath(), error); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - setCharset - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable charset - this.charset = charset; - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - setFileExtensions - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable fileExtensions - fileExtensions = null; - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - setSeverity - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/api/SeverityLevel::getInstance - this.severity = SeverityLevel.getInstance(severity); - - - - Checker.java - com.puppycrawl.tools.checkstyle.Checker - setSeverity - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable severity - this.severity = SeverityLevel.getInstance(severity); - - - - ConfigurationLoader.java - com.puppycrawl.tools.checkstyle.ConfigurationLoader - replaceProperties - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/StringBuilder::length - sb.replace(0, sb.length(), defaultValue); - - - - ConfigurationLoader.java - com.puppycrawl.tools.checkstyle.ConfigurationLoader$InternalLoader - startElement - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to org/xml/sax/Attributes::getValue - final String value = attributes.getValue(VALUE); - - - - ConfigurationLoader.java - com.puppycrawl.tools.checkstyle.ConfigurationLoader$InternalLoader - startElement - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to org/xml/sax/Attributes::getValue with argument - final String value = attributes.getValue(VALUE); - - - - ConfigurationLoader.java - com.puppycrawl.tools.checkstyle.ConfigurationLoader$InternalLoader - startElement - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to org/xml/sax/Attributes::getValue - overridePropsResolver, attributes.getValue(DEFAULT)); - - - - LocalizedMessage.java - com.puppycrawl.tools.checkstyle.LocalizedMessage - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Arrays::copyOf with argument - this.args = Arrays.copyOf(args, args.length); + replaced call to com/puppycrawl/tools/checkstyle/utils/CommonUtil::relativizePath with argument + final String stripped = CommonUtil.relativizePath(basedir, fileName); @@ -189,42 +18,6 @@ this.args = null; - - PackageObjectFactory.java - com.puppycrawl.tools.checkstyle.PackageObjectFactory - createModule - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/String::contains - if (!name.contains(PACKAGE_SEPARATOR)) { - - - - PackageObjectFactory.java - com.puppycrawl.tools.checkstyle.PackageObjectFactory - createModule - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (!name.contains(PACKAGE_SEPARATOR)) { - - - - PackageObjectFactory.java - com.puppycrawl.tools.checkstyle.PackageObjectFactory - createModule - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (thirdPartyNameToFullModuleNames == null) { - - - - PackageObjectFactory.java - com.puppycrawl.tools.checkstyle.PackageObjectFactory - createObjectFromFullModuleNames - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/stream/Stream::sorted with receiver - .sorted() - - SarifLogger.java com.puppycrawl.tools.checkstyle.SarifLogger @@ -332,22 +125,4 @@ replaced call to java/util/Collections::synchronizedList with argument private final List<Throwable> exceptions = Collections.synchronizedList(new ArrayList<>()); - - - XMLLogger.java - com.puppycrawl.tools.checkstyle.XMLLogger$FileMessages - getErrors - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Collections::unmodifiableList with argument - return Collections.unmodifiableList(errors); - - - - XMLLogger.java - com.puppycrawl.tools.checkstyle.XMLLogger$FileMessages - getExceptions - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Collections::unmodifiableList with argument - return Collections.unmodifiableList(exceptions); - diff --git a/config/pitest-suppressions/pitest-filters-suppressions.xml b/config/pitest-suppressions/pitest-filters-suppressions.xml index 550fd4f59a3..f81ddc63f23 100644 --- a/config/pitest-suppressions/pitest-filters-suppressions.xml +++ b/config/pitest-suppressions/pitest-filters-suppressions.xml @@ -1,32 +1,5 @@ - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Pattern::pattern - checkPattern = checks.pattern(); - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable checkPattern - checkPattern = checks.pattern(); - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable checkPattern - checkPattern = null; - - SuppressFilterElement.java com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement @@ -63,42 +36,6 @@ columnsCsv = null; - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Pattern::pattern - filePattern = files.pattern(); - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filePattern - filePattern = files.pattern(); - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filePattern - filePattern = files; - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filePattern - filePattern = null; - - SuppressFilterElement.java com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement @@ -135,42 +72,6 @@ linesCsv = null; - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Pattern::pattern - messagePattern = message.pattern(); - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable messagePattern - messagePattern = message.pattern(); - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable messagePattern - messagePattern = message; - - - - SuppressFilterElement.java - com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable messagePattern - messagePattern = null; - - SuppressFilterElement.java com.puppycrawl.tools.checkstyle.filters.SuppressFilterElement @@ -225,24 +126,6 @@ if (!cachedFileAbsolutePath.equals(eventFileTextAbsolutePath)) { - - SuppressWithPlainTextCommentFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter - getSuppression - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Matcher::start - lineNo + 1, offCommentMatcher.start(), SuppressionType.OFF, this); - - - - SuppressWithPlainTextCommentFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter - getSuppression - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Matcher::start - lineNo + 1, onCommentMatcher.start(), SuppressionType.ON, this); - - SuppressWithPlainTextCommentFilter.java com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter$Suppression @@ -261,33 +144,6 @@ eventMessageRegexp = null; - - SuppressWithPlainTextCommentFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter$Suppression - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable columnNo - this.columnNo = columnNo; - - - - SuppressWithPlainTextCommentFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilter$Suppression - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable text - this.text = text; - - - - SuppressionCommentFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter - accept - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/filters/SuppressionCommentFilter::getFileContents - if (getFileContents() != currentContents) { - - SuppressionCommentFilter.java com.puppycrawl.tools.checkstyle.filters.SuppressionCommentFilter$Tag @@ -306,42 +162,6 @@ tagMessageRegexp = null; - - SuppressionFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressionFilter - finishLocalSetup - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filters - filters = SuppressionsLoader.loadSuppressions(file); - - - - SuppressionFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressionFilter - finishLocalSetup - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filters - filters = new FilterSet(); - - - - SuppressionFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressionFilter - getExternalResourceLocations - org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator - replaced return value with Collections.emptySet for com/puppycrawl/tools/checkstyle/filters/SuppressionFilter::getExternalResourceLocations - return Collections.singleton(file); - - - - SuppressionXpathFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressionXpathFilter - finishLocalSetup - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/Set::addAll - filters.addAll(SuppressionsLoader.loadXpathSuppressions(file)); - - SuppressionXpathSingleFilter.java com.puppycrawl.tools.checkstyle.filters.SuppressionXpathSingleFilter @@ -351,15 +171,6 @@ this.checks = null; - - SuppressionXpathSingleFilter.java - com.puppycrawl.tools.checkstyle.filters.SuppressionXpathSingleFilter - setFiles - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable files - this.files = null; - - SuppressionXpathSingleFilter.java com.puppycrawl.tools.checkstyle.filters.SuppressionXpathSingleFilter @@ -387,114 +198,6 @@ Optional.ofNullable(checks).map(CommonUtil::createPattern).orElse(null), - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Pattern::pattern - checkPattern = checks.pattern(); - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable checkPattern - checkPattern = checks.pattern(); - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable checkPattern - checkPattern = null; - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable checkRegexp - checkRegexp = null; - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Pattern::pattern - filePattern = files.pattern(); - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filePattern - filePattern = files.pattern(); - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable filePattern - filePattern = null; - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable fileRegexp - fileRegexp = null; - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Pattern::pattern - messagePattern = message.pattern(); - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable messagePattern - messagePattern = message.pattern(); - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable messagePattern - messagePattern = null; - - - - XpathFilterElement.java - com.puppycrawl.tools.checkstyle.filters.XpathFilterElement - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable messageRegexp - messageRegexp = null; - - XpathFilterElement.java com.puppycrawl.tools.checkstyle.filters.XpathFilterElement @@ -510,6 +213,6 @@ isXpathQueryMatching org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator replaced call to java/util/stream/Stream::map with receiver - .stream().map(AbstractNode.class::cast).collect(Collectors.toList()); + .stream().map(AbstractNode.class::cast) diff --git a/config/pitest-suppressions/pitest-imports-suppressions.xml b/config/pitest-suppressions/pitest-imports-suppressions.xml index a0613f147de..1737714a513 100644 --- a/config/pitest-suppressions/pitest-imports-suppressions.xml +++ b/config/pitest-suppressions/pitest-imports-suppressions.xml @@ -1,77 +1,5 @@ - - FileImportControl.java - com.puppycrawl.tools.checkstyle.checks.imports.FileImportControl - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator - Removed assignment to member variable patternForExactMatch - patternForExactMatch = null; - - - - FileImportControl.java - com.puppycrawl.tools.checkstyle.checks.imports.FileImportControl - <init> - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl::encloseInGroup with argument - this.name = encloseInGroup(name); - - - - ImportControlLoader.java - com.puppycrawl.tools.checkstyle.checks.imports.ImportControlLoader - load - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/Exception::getMessage - + " - " + ex.getMessage(), ex); - - - - ImportControlLoader.java - com.puppycrawl.tools.checkstyle.checks.imports.ImportControlLoader - startElement - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader::containsRegexAttribute - final boolean regex = containsRegexAttribute(attributes); - - - - - - - - - - - - - - - - - - - - - - ImportOrderCheck.java - com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck - getGroupNumber - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Matcher::end - bestEnd = matcher.end(); - - - - ImportOrderCheck.java - com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck - getGroupNumber - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/util/regex/Matcher::start - if (matcher.start() < bestPos) { - - PkgImportControl.java com.puppycrawl.tools.checkstyle.checks.imports.PkgImportControl @@ -98,5 +26,4 @@ Removed assignment to member variable regex this.regex = false; - diff --git a/config/pitest-suppressions/pitest-javadoc-suppressions.xml b/config/pitest-suppressions/pitest-javadoc-suppressions.xml index f9989dd9a31..1a0f9d24968 100644 --- a/config/pitest-suppressions/pitest-javadoc-suppressions.xml +++ b/config/pitest-suppressions/pitest-javadoc-suppressions.xml @@ -1,32 +1,5 @@ - - AbstractJavadocCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck - init - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/Class::getName - JavadocUtil.getTokenName(javadocTokenId), getClass().getName()); - - - - AbstractJavadocCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck - validateDefaultJavadocTokens - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (getRequiredJavadocTokens().length != 0) { - - - - AbstractJavadocCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck - validateDefaultJavadocTokens - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/Class::getName - javadocToken, getClass().getName()); - - AbstractJavadocCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck @@ -45,15 +18,6 @@ if (curNode != null) { - - AbstractJavadocCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck - walk - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (toVisit == null) { - - AbstractJavadocCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.AbstractJavadocCheck @@ -63,33 +27,6 @@ waitsForProcessing = shouldBeProcessed(curNode); - - - - - - - - - - - - - - - - - - - - - - - - - - - JavadocMethodCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck @@ -117,33 +54,6 @@ final Token token = new Token(tag.getFirstArg(), tag.getLineNo(), tag - - JavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck - getMethodTags - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck::calculateTagColumn - final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber); - - - - JavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck - getMethodTags - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck::calculateTagColumn with argument - final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber); - - - - JavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck - getParameters - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (child.getType() == TokenTypes.PARAMETER_DEF) { - - JavadocMethodCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck @@ -171,24 +81,6 @@ if (class1.contains(separator) || class2.contains(separator)) { - - JavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck - isInIgnoreBlock - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::getParent with receiver - DetailAST ancestor = throwAst.getParent(); - - - - JavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck - isInIgnoreBlock - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (ancestor.getType() == TokenTypes.LITERAL_TRY - - JavadocMethodCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck @@ -207,15 +99,6 @@ foundThrows.add(documentedClassInfo.getName().getText()); - - JavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck - setAccessModifiers - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Arrays::copyOf with argument - Arrays.copyOf(accessModifiers, accessModifiers.length); - - JavadocMethodCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck @@ -261,42 +144,6 @@ lineNo = fullIdent.getLineNo(); - - JavadocMissingLeadingAsteriskCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMissingLeadingAsteriskCheck - isLastLine - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (detailNode.getType() == JavadocTokenTypes.TEXT - - - - JavadocNodeImpl.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl - getChildren - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/Optional::map with receiver - .map(array -> Arrays.copyOf(array, array.length)) - - - - JavadocNodeImpl.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl - lambda$getChildren$0 - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Arrays::copyOf with argument - .map(array -> Arrays.copyOf(array, array.length)) - - - - JavadocNodeImpl.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl - setChildren - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Arrays::copyOf with argument - this.children = Arrays.copyOf(children, children.length); - - JavadocNodeImpl.java com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl @@ -305,132 +152,6 @@ removed call to java/util/Objects::hashCode + ", children=" + Objects.hashCode(children) - - - JavadocParagraphCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck - getNearestEmptyLine - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/JavadocUtil::getPreviousSibling with argument - DetailNode newLine = JavadocUtil.getPreviousSibling(node); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JavadocStyleCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck - findTextStart - org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveIncrementsMutator - Removed increment 2 - index += 2; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JavadocStyleCheck.java @@ -450,15 +171,6 @@ builder.deleteCharAt(index); - - - - - - - - - JavadocStyleCheck.java com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheck @@ -486,68 +198,14 @@ if (Character.isWhitespace(builder.charAt(index))) { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JavadocTagInfo.java - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo$11 - isValidOn - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - return astType == TokenTypes.METHOD_DEF - + + JavadocTagInfo.java + com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagInfo$11 + isValidOn + org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF + removed conditional - replaced equality check with true + return astType == TokenTypes.METHOD_DEF + JavadocTagInfo.java @@ -576,354 +234,6 @@ return astType == TokenTypes.VARIABLE_DEF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MissingJavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck - isContentsAllowMissingJavadoc - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE - removed conditional - replaced equality check with false - return (ast.getType() == TokenTypes.METHOD_DEF - - - - MissingJavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck - isContentsAllowMissingJavadoc - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - || ast.getType() == TokenTypes.COMPACT_CTOR_DEF) - - - - MissingJavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck - isContentsAllowMissingJavadoc - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE - removed conditional - replaced equality check with false - || ast.getType() == TokenTypes.CTOR_DEF - - - - MissingJavadocMethodCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck - shouldCheck - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - return (excludeScope == null - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SummaryJavadocCheck.java - com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck - startsWithInheritDoc - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - for (int i = 0; !found; i++) { - - - - - - - - - - - - - - - - - - - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - getTagId - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/Character::isJavaIdentifierStart - && (Character.isJavaIdentifierStart(text.charAt(position)) - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - getTagId - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/String::charAt - && (Character.isJavaIdentifierStart(text.charAt(position)) - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - getTagId - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - && (Character.isJavaIdentifierStart(text.charAt(position)) - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - getTagId - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/lang/String::trim with receiver - text = text.substring(column).trim(); - - - - - - - - - - - - - - - - - - - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - parseTag - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE - removed conditional - replaced equality check with false - if (incompleteTag) { - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - parseTags - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser::findChar with argument - Point position = findChar(text, '<', new Point(0, 0)); - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - skipHtmlComment - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE - removed conditional - replaced equality check with false - .substring(0, toPoint.getColumnNo() + 1).endsWith("-->")) { - - TagParser.java com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser @@ -932,22 +242,4 @@ replaced call to com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser::findChar with argument toPoint = findChar(text, '>', getNextPoint(text, toPoint)); - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - skipHtmlComment - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/checks/javadoc/TagParser::findChar with argument - toPoint = findChar(text, '>', toPoint); - - - - TagParser.java - com.puppycrawl.tools.checkstyle.checks.javadoc.TagParser - skipHtmlComment - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_ELSE - removed conditional - replaced comparison check with false - while (toPoint.getLineNo() < text.length && !text[toPoint.getLineNo()] - diff --git a/config/pitest-suppressions/pitest-tree-walker-suppressions.xml b/config/pitest-suppressions/pitest-tree-walker-suppressions.xml index 187867d8dc0..5a2f72dc771 100644 --- a/config/pitest-suppressions/pitest-tree-walker-suppressions.xml +++ b/config/pitest-suppressions/pitest-tree-walker-suppressions.xml @@ -72,15 +72,6 @@ .thenComparing(AbstractCheck::getId, - - TreeWalker.java - com.puppycrawl.tools.checkstyle.TreeWalker - createNewCheckSortedSet - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/Comparator::thenComparing with receiver - .thenComparing(AbstractCheck::hashCode)); - - TreeWalker.java com.puppycrawl.tools.checkstyle.TreeWalker @@ -89,49 +80,4 @@ removed call to java/util/Comparator::naturalOrder Comparator.nullsLast(Comparator.naturalOrder())) - - - TreeWalker.java - com.puppycrawl.tools.checkstyle.TreeWalker - getExternalResourceLocations - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/stream/Stream::map with receiver - .map(ExternalResourceHolder.class::cast) - - - - TreeWalker.java - com.puppycrawl.tools.checkstyle.TreeWalker - lambda$createNewCheckSortedSet$3 - org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator - replaced return value with "" for com/puppycrawl/tools/checkstyle/TreeWalker::lambda$createNewCheckSortedSet$3 - Comparator.<AbstractCheck, String>comparing(check -> check.getClass().getName()) - - - - TreeWalker.java - com.puppycrawl.tools.checkstyle.TreeWalker - registerCheck - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/Class::getName - + "method to return 'true'", check.getClass().getName(), - - - - TreeWalker.java - com.puppycrawl.tools.checkstyle.TreeWalker - registerCheck - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/utils/TokenUtil::getTokenName - TokenUtil.getTokenName(tokenId)); - - - - TreeWalker.java - com.puppycrawl.tools.checkstyle.TreeWalker - registerCheck - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/lang/String::format with argument - final String message = String.format(Locale.ROOT, "Check '%s' waits for comment type " - diff --git a/config/pitest-suppressions/pitest-utils-suppressions.xml b/config/pitest-suppressions/pitest-utils-suppressions.xml index c060d902075..ee6b1ac7d44 100644 --- a/config/pitest-suppressions/pitest-utils-suppressions.xml +++ b/config/pitest-suppressions/pitest-utils-suppressions.xml @@ -1,311 +1,6 @@ - - - - - - - - - - - - - - - - - - - BlockCommentPosition.java - com.puppycrawl.tools.checkstyle.utils.BlockCommentPosition - isOnPlainClassMember - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - && parent.getParent().getType() == memberType - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CodePointUtil.java - com.puppycrawl.tools.checkstyle.utils.CodePointUtil - stripLeading - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/utils/CommonUtil::isCodePointWhitespace - && CommonUtil.isCodePointWhitespace(codePoints, startIndex)) { - - - - CodePointUtil.java - com.puppycrawl.tools.checkstyle.utils.CodePointUtil - stripLeading - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE - removed conditional - replaced equality check with false - && CommonUtil.isCodePointWhitespace(codePoints, startIndex)) { - - - - CodePointUtil.java - com.puppycrawl.tools.checkstyle.utils.CodePointUtil - stripLeading - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Arrays::copyOfRange with argument - return Arrays.copyOfRange(codePoints, startIndex, codePoints.length); - - - - CodePointUtil.java - com.puppycrawl.tools.checkstyle.utils.CodePointUtil - stripLeading - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_ELSE - removed conditional - replaced comparison check with false - while (startIndex < codePoints.length - - - - CodePointUtil.java - com.puppycrawl.tools.checkstyle.utils.CodePointUtil - trim - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/CodePointUtil::stripTrailing with argument - final int[] strippedCodePoints = stripTrailing(codePoints); - - - - CodePointUtil.java - com.puppycrawl.tools.checkstyle.utils.CodePointUtil - trim - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to com/puppycrawl/tools/checkstyle/utils/CodePointUtil::stripLeading with argument - return stripLeading(strippedCodePoints); - - - - CommonUtil.java - com.puppycrawl.tools.checkstyle.utils.CommonUtil - baseClassName - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE - removed conditional - replaced equality check with false - if (index == -1) { - - - - - - - - - - - - - - - - - - - - - - CommonUtil.java - com.puppycrawl.tools.checkstyle.utils.CommonUtil - matchesFileExtension - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - if (extension.startsWith(EXTENSION_SEPARATOR)) { - - - - CommonUtil.java - com.puppycrawl.tools.checkstyle.utils.CommonUtil - relativizeAndNormalizePath - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/nio/file/Path::normalize with receiver - final Path pathAbsolute = Paths.get(path).normalize(); - - - - CommonUtil.java - com.puppycrawl.tools.checkstyle.utils.CommonUtil - relativizeAndNormalizePath - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/nio/file/Path::normalize with receiver - final Path pathBase = Paths.get(baseDirectory).normalize(); - - - - ModuleReflectionUtil.java - com.puppycrawl.tools.checkstyle.utils.ModuleReflectionUtil - getCheckstyleModules - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/stream/Stream::filter with receiver - .filter(ModuleReflectionUtil::isCheckstyleModule) - - - - ScopeUtil.java - com.puppycrawl.tools.checkstyle.utils.ScopeUtil - getDeclaredScopeFromMods - org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF - removed conditional - replaced equality check with true - for (DetailAST token = aMods.getFirstChild(); token != null && result == null; - - - - ScopeUtil.java - com.puppycrawl.tools.checkstyle.utils.ScopeUtil - getSurroundingScope - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::getParent with receiver - for (DetailAST token = node.getParent(); - - ScopeUtil.java com.puppycrawl.tools.checkstyle.utils.ScopeUtil @@ -314,49 +9,4 @@ removed conditional - replaced equality check with true token != null && !returnValue; - - - - - - - - - - - - - - - - - - - - - ScopeUtil.java - com.puppycrawl.tools.checkstyle.utils.ScopeUtil - lambda$getScopeFromMods$1 - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to com/puppycrawl/tools/checkstyle/api/DetailAST::getParent with receiver - .orElseGet(() -> getDefaultScope(aMods.getParent())); - - - - TokenUtil.java - com.puppycrawl.tools.checkstyle.utils.TokenUtil - lambda$nameToValueMapFromPublicIntFields$1 - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to java/lang/reflect/Field::getName - Field::getName, fld -> getIntFromField(fld, fld.getName())) - - - - XpathUtil.java - com.puppycrawl.tools.checkstyle.utils.XpathUtil - getXpathItems - org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator - replaced call to java/util/stream/Stream::map with receiver - .map(NodeInfo.class::cast) - diff --git a/config/pitest-suppressions/pitest-xpath-suppressions.xml b/config/pitest-suppressions/pitest-xpath-suppressions.xml index c488fb43ded..ace4e55b78a 100644 --- a/config/pitest-suppressions/pitest-xpath-suppressions.xml +++ b/config/pitest-suppressions/pitest-xpath-suppressions.xml @@ -1,59 +1,5 @@ - - AbstractElementNode.java - com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode - getPrecedingSiblings - org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator - replaced call to java/util/Collections::unmodifiableList with argument - return Collections.unmodifiableList(siblings.subList(0, indexAmongSiblings)); - - - - AbstractElementNode.java - com.puppycrawl.tools.checkstyle.xpath.AbstractElementNode - iterateAxis - org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_8 - RemoveSwitch 8 (case value 8) - switch (axisNumber) { - - - - AbstractRootNode.java - com.puppycrawl.tools.checkstyle.xpath.AbstractRootNode - iterateAxis - org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_1 - RemoveSwitch 1 (case value 1) - switch (axisNumber) { - - - - AbstractRootNode.java - com.puppycrawl.tools.checkstyle.xpath.AbstractRootNode - iterateAxis - org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_2 - RemoveSwitch 2 (case value 2) - switch (axisNumber) { - - - - AbstractRootNode.java - com.puppycrawl.tools.checkstyle.xpath.AbstractRootNode - iterateAxis - org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_5 - RemoveSwitch 5 (case value 5) - switch (axisNumber) { - - - - AbstractRootNode.java - com.puppycrawl.tools.checkstyle.xpath.AbstractRootNode - iterateAxis - org.pitest.mutationtest.engine.gregor.mutators.experimental.RemoveSwitchMutator_8 - RemoveSwitch 8 (case value 8) - switch (axisNumber) { - - FollowingIterator.java com.puppycrawl.tools.checkstyle.xpath.iterators.FollowingIterator @@ -80,23 +26,4 @@ Removed assignment to member variable items this.items = null; - - - RootNode.java - com.puppycrawl.tools.checkstyle.xpath.RootNode - getColumnNumber - org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator - removed call to com/puppycrawl/tools/checkstyle/api/DetailAST::getColumnNo - return detailAst.getColumnNo(); - - - - RootNode.java - com.puppycrawl.tools.checkstyle.xpath.RootNode - getColumnNumber - org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator - replaced int return with 0 for com/puppycrawl/tools/checkstyle/xpath/RootNode::getColumnNumber - return detailAst.getColumnNo(); - - diff --git a/config/pmd-main.xml b/config/pmd-main.xml index f6d1079cdc4..7194e980949 100644 --- a/config/pmd-main.xml +++ b/config/pmd-main.xml @@ -18,29 +18,28 @@ we value full coverage more than final modifier. Picocli fields will have their value injected and should not be marked final. --> + | //ClassDeclaration[@SimpleName='CliOptions']"/> - + value="java.io.ByteArrayOutputStream,java.io.ByteArrayInputStream, + java.io.StringWriter,java.io.CharArrayWriter,java.io.StringReader"/> @@ -48,7 +47,23 @@ + value="//ClassDeclaration[@SimpleName='AutomaticBean']"/> + + + + + + diff --git a/config/pmd-test.xml b/config/pmd-test.xml index 7e834475eb7..e0d61b18740 100644 --- a/config/pmd-test.xml +++ b/config/pmd-test.xml @@ -40,9 +40,6 @@ - - + | //ClassDeclaration[@SimpleName='IndentationCheckTest']"/> @@ -98,29 +95,39 @@ assertion calls are not required as they are called by the library. In MainTest PMD does not find asserts in lambdas called in the method invokeAndWait. --> + @@ -129,7 +136,7 @@ + value="//ClassDeclaration[@SimpleName='CommitValidationTest']"/> @@ -140,15 +147,25 @@ as they check each token and each rule explicitly. JavadocTokenTypes.testTokenValues contains several asserts as it checks each token explicitly. --> + + | //ClassDeclaration[@SimpleName='ParseTreeTablePresentationTest'] + //MethodDeclaration[@Name='testGetValueAtDetailNode'] + | //ClassDeclaration[@SimpleName='ClassImportRuleTest'] + | //ClassDeclaration[@SimpleName='PkgImportRuleTest'] + | //ClassDeclaration[@SimpleName='PkgImportControlTest'] + //MethodDeclaration[ends-with(@Name, 'CheckAccess')] + | //ClassDeclaration[@SimpleName='JavadocTagInfoTest'] + //MethodDeclaration[@Name='testCoverage'] + | //ClassDeclaration[@SimpleName='AstRegressionTest'] + //MethodDeclaration[@Name='testCustomAstTree']"/> @@ -157,7 +174,7 @@ @@ -169,9 +186,9 @@ easy to maintain. The rule should also only check public methods but has a bug. Suppress the false-positives. --> @@ -179,17 +196,17 @@ @@ -201,9 +218,16 @@ + + value="//ClassDeclaration[@SimpleName='TestUtil'] + //MethodDeclaration[@Name='getResultWithLimitedResources'] + | //ClassDeclaration[@SimpleName='SuppressionFilterTest'] + //MethodDeclaration[@Name='isConnectionAvailableAndStable'] + | //ClassDeclaration[@SimpleName='SuppressionsLoaderTest'] + //MethodDeclaration[@Name='loadFilterSet']"/> diff --git a/config/pmd.xml b/config/pmd.xml index db04ea7ae13..83870e5e514 100644 --- a/config/pmd.xml +++ b/config/pmd.xml @@ -14,10 +14,32 @@ + + + + + + - @@ -26,7 +48,7 @@ @@ -34,11 +56,47 @@ + + + + + + + + + + + + + + + + + + + + value="//ClassDeclaration[@SimpleName='RequireThisCheck']"/> - - - - @@ -90,7 +143,7 @@ JavadocTokenTypes and TokenTypes aren't utility classes. They are token definition classes. Also, they are part of the API. --> @@ -122,11 +175,11 @@ AbstractRootNode is what a root node is. --> @@ -148,7 +201,7 @@ + value="//ClassDeclaration[@SimpleName='Main' or @SimpleName='Tag']"/> @@ -156,6 +209,18 @@ + + + + + + + + @@ -166,8 +231,6 @@ - - + value="//ClassDeclaration[@SimpleName='SarifLogger']"/> @@ -199,8 +262,20 @@ + + value="//ClassDeclaration[@SimpleName='ExitHelper'] + | //ClassDeclaration[@SimpleName='MainTest'] + //MethodDeclaration[@Name='assertMainReturnCode'] "/> + + + + + + @@ -228,11 +303,11 @@ a runtime exception. JavadocMethodCheck: Exception type is not predictable. --> @@ -242,7 +317,7 @@ requires some extra IFs. --> @@ -251,20 +326,27 @@ - + + + value="//ClassDeclaration[@SimpleName='HandlerFactory' + or @SimpleName='SiteUtil' or @SimpleName='Checker' or @SimpleName='JavaAstVisitor' + or @SimpleName='Main' or @SimpleName='TreeWalker' or @SimpleName='CheckstyleAntTask' + or @SimpleName='TranslationCheck' or @SimpleName='JavadocMethodCheck']"/> + + SuppressFilterElement is a single constructor and can't be split easily + Splitting PropertiesMacro.getDefaultValue will damage readability + Splitting SiteUtil.getDefaultValue would not make it more readable --> + + | //ClassDeclaration[@SimpleName='PropertiesMacro'] + //MethodDeclaration[@Name='getDefaultValue'] + | //ClassDeclaration[@SimpleName='SiteUtil'] + //MethodDeclaration[@Name='getDefaultValue'] + | //ClassDeclaration[@SimpleName='DescriptionExtractor'] + //MethodDeclaration[@Name='getDescriptionFromJavadoc'] + | //ClassDeclaration[@SimpleName='JavadocTokenTypes' + or @SimpleName='TokenTypes' or @SimpleName='RequireThisCheck' + or @SimpleName='JavadocMethodCheck' or @SimpleName='JavaAstVisitor' + or @SimpleName='SiteUtil']"/> @@ -305,8 +403,9 @@ + value="//ClassDeclaration[@SimpleName='Checker'] + | //ClassDeclaration[@SimpleName='Main'] + | //ClassDeclaration[@SimpleName='ImportOrderCheck']"/> @@ -315,25 +414,14 @@ - - - - - - + value="//ClassDeclaration[@SimpleName='JavaAstVisitor']"/> + value="//ClassDeclaration[@SimpleName='Violation']"/> @@ -342,21 +430,35 @@ Checker collects external resource locations and sets up the configuration. CheckstyleAntTask integrates Checkstyle with Ant. TranslationCheck uses a lot of imports for it's logic and custom violations. + SiteUtil uses a lot of imports to provide logic for generating documentation --> + or @SimpleName='AbstractAutomaticBean' + or @SimpleName='SiteUtil']"/> - + + + + + + + + value="//ClassDeclaration[@SimpleName='AbstractInvalidClass']"/> @@ -370,7 +472,7 @@ overloads a synchronized method, so it should have synchronized modifier. --> @@ -382,10 +484,42 @@ + + + + + + + + + + + + + + value="//ClassDeclaration[@SimpleName='JavaAstVisitor']"/> + + + + + + diff --git a/config/projects-to-test/openjdk-21-projects-to-test-on.config b/config/projects-to-test/openjdk-21-projects-to-test-on.config new file mode 100644 index 00000000000..74c3d8d5bb3 --- /dev/null +++ b/config/projects-to-test/openjdk-21-projects-to-test-on.config @@ -0,0 +1,8 @@ +# List of GIT repositories to clone / pull for checking with Checkstyle +# File format: REPO_NAME|[local|git|hg]|URL|[COMMIT_ID]|[EXCLUDE FOLDERS] +# Please note that bash comments works in this file +# +# This file has been created to alleviate confusion in the contribution +# repository's projects-to-test-on.properties file; these projects +# must be used with special configurations. +openjdk21|git|https://github.com/openjdk/jdk21u.git|master|| diff --git a/config/projects-to-test/openjdk17-excluded.files b/config/projects-to-test/openjdk17-excluded.files index 0521da61f37..c6b1f249441 100644 --- a/config/projects-to-test/openjdk17-excluded.files +++ b/config/projects-to-test/openjdk17-excluded.files @@ -30,6 +30,9 @@ + + + @@ -498,3 +501,9 @@ + + + + + + diff --git a/config/projects-to-test/openjdk19-excluded.files b/config/projects-to-test/openjdk19-excluded.files index 0a1c56e3d17..06a99e78a18 100644 --- a/config/projects-to-test/openjdk19-excluded.files +++ b/config/projects-to-test/openjdk19-excluded.files @@ -30,6 +30,9 @@ + + + @@ -548,3 +551,9 @@ + + + + + + diff --git a/config/projects-to-test/openjdk20-excluded.files b/config/projects-to-test/openjdk20-excluded.files index af32c19c861..f15a4180622 100644 --- a/config/projects-to-test/openjdk20-excluded.files +++ b/config/projects-to-test/openjdk20-excluded.files @@ -30,6 +30,9 @@ + + + @@ -527,4 +530,9 @@ - + + + + + + diff --git a/config/projects-to-test/openjdk21-excluded.files b/config/projects-to-test/openjdk21-excluded.files new file mode 100644 index 00000000000..9154a37513e --- /dev/null +++ b/config/projects-to-test/openjdk21-excluded.files @@ -0,0 +1,620 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/sevntu-suppressions.xml b/config/sevntu-suppressions.xml index ab08ab33fda..0bc54919887 100644 --- a/config/sevntu-suppressions.xml +++ b/config/sevntu-suppressions.xml @@ -39,6 +39,8 @@ + + @@ -46,4 +48,8 @@ + + + + diff --git a/config/signatures-test.txt b/config/signatures-test.txt index ace91fffab5..0ed9e670775 100644 --- a/config/signatures-test.txt +++ b/config/signatures-test.txt @@ -1 +1,5 @@ com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport#verify(com.puppycrawl.tools.checkstyle.api.Configuration, java.lang.String, java.lang.String[]) @ Use inline config parser instead. +java.nio.file.Files#createTempFile(java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute[]) @ Use of this method is forbidden, please use @TempDir for better temporary directory control +java.io.File#createTempFile(java.lang.String,java.lang.String,java.io.File) @ Use of this method is forbidden, please use @TempDir for better temporary directory control +java.nio.file.Files#createTempDirectory(java.lang.String,java.nio.file.attribute.FileAttribute[]) @ Use of this method is forbidden, please use @TempDir for better temporary directory control +java.nio.file.Files#createTempFile(java.nio.file.Path,java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute[]) @ Use of this method is forbidden, please use @TempDir for better temporary directory control diff --git a/config/signatures.txt b/config/signatures.txt index 2163c21c859..95071d4d798 100644 --- a/config/signatures.txt +++ b/config/signatures.txt @@ -3,3 +3,4 @@ com.puppycrawl.tools.checkstyle.DefaultConfiguration#getAttribute(java.lang.Stri com.puppycrawl.tools.checkstyle.DefaultConfiguration#addAttribute(java.lang.String,java.lang.String) @ Usage of deprecated API is forbidden. Please use DefaultConfiguration.addProperty(String name, String value) instead. com.puppycrawl.tools.checkstyle.api.AbstractCheck#log(int,int,java.lang.String,java.lang.Object[]) @ Use of this log method is forbidden, please use AbstractCheck#log(DetailAST ast, String key, Object... args) com.puppycrawl.tools.checkstyle.api.AbstractCheck#log(int,java.lang.String,java.lang.Object[]) @ Use of this log method is forbidden, please use AbstractCheck#log(DetailAST ast, String key, Object... args) +java.net.URI#toString() @ This method can return garbage for non-ascii data, please use URI#toASCIIString() diff --git a/config/spotbugs-exclude.xml b/config/spotbugs-exclude.xml index d2e871c93b3..955c295a8b2 100644 --- a/config/spotbugs-exclude.xml +++ b/config/spotbugs-exclude.xml @@ -106,6 +106,8 @@ + @@ -164,7 +166,7 @@ + Suppressed until https://github.com/mebigfatguy/fb-contrib/issues/453 --> @@ -288,4 +290,38 @@ name="com.puppycrawl.tools.checkstyle.checks.header.AbstractHeaderCheck"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/config/suppressions.xml b/config/suppressions.xml index 95cc26601f2..564a522ba6e 100644 --- a/config/suppressions.xml +++ b/config/suppressions.xml @@ -12,7 +12,7 @@ @@ -60,6 +60,8 @@ + + @@ -75,7 +77,7 @@ files="(CheckerTest|AbstractModuleTestSupport|AbstractItModuleTestSupport| |CheckstyleAntTaskTest| |TranslationCheckTest|LocalizedMessageTest|AbstractFileSetCheckTest| - |AbstractCheckTest)\.java"/> + |AbstractCheckTest|InlineConfigParser)\.java"/> @@ -192,4 +194,8 @@ + + + diff --git a/docs/NEW_LANGUAGE_FEATURE_INTEGRATION_PROCESS.md b/docs/NEW_LANGUAGE_FEATURE_INTEGRATION_PROCESS.md new file mode 100644 index 00000000000..c5cceae3747 --- /dev/null +++ b/docs/NEW_LANGUAGE_FEATURE_INTEGRATION_PROCESS.md @@ -0,0 +1,144 @@ +# New Language Feature Check Integration Process [WIP] + +The ability to parse new language features must be implemented and +merged before following this document. This document outlines the procedures +for integrating new language features into Checkstyle, +by updating existing checks and creating new ones. + +## Check Update Procedure + +Updating check modules to support new language features aligns Checkstyle +with current best practices in the Java community +and contributes to the project's ongoing evolution. + +### Java Enhancement Proposals (JEPS) + +Review Java Enhancement Proposals (JEPS) related to the new feature. +JEPS provide detailed information about the goals +and motivations behind new language features. +This information can help us understand the feature better and figure out +which checks are most likely to be impacted. + +**Examples**: + +- For unnamed variables (`_`), the JEP guides us to recognize the new role of the + underscore for unnamed variables and avoid flagging the non-use of such variables. + Consequently, we should update `UnusedLocalVariableCheck` to ensure it does not + incorrectly violate unnamed variables. + +### Consider Similar and Related Tokens + +Identify existing tokens that are similar to the new language feature tokens. +This comparison helps to determine which existing checks may be relevant +and require updates to support the new token. Additionally, +we should consider the impact that a new child token may have +on existing checks. + +**Examples**: + +- When the `RECORD_DEF` token was introduced, it was reasonable to look at all checks + that had `CLASS_DEF` in their acceptable tokens. + +- When the `TEXT_BLOCK_CONTENT` token was introduced, it was reasonable to look at all checks + that had `STRING_LITERAL` in their acceptable tokens. + +- When switch expressions were introduced, it was reasonable to look at all checks + that deals with expressions because `LITERAL_SWITCH` may now fall under `EXPR` token. + This requires analyzing the impact of this new child token on existing checks, + such as `InnerAssignmentCheck` + +### Frequently Impacted Checks + +Certain checks are most likely to be impacted by new language features. +We should analyze the impact on the following frequently affected checks: + +- [IllegalToken](https://checkstyle.org/checks/coding/illegaltoken.html) +- [IllegalTokenText](https://checkstyle.org/checks/coding/illegaltokentext.html) +- [Indentation](https://checkstyle.org/checks/misc/indentation.html#Indentation) +- [Whitespace](https://checkstyle.org/checks/whitespace/index.html) + +### Review Other Static Analysis Tools + +Examining how other static analysis tools handle new language features +can provide valuable insights into best practices and potential pitfalls. +A list to a few of the popular ones: + +- [IntelliJ Inspections](https://www.jetbrains.com/help/idea/code-inspection.html) +- [PMD](https://pmd.github.io/) +- [SonarQube](https://www.sonarqube.org/) + +**Examples**: + +- IntelliJ IDEA introduced an inspection rule for Java 17 or higher to detect + redundant `strictfp` modifiers. This resulted in the analysis of `RedundantModifierCheck` + to verify if we needed to update it. + +### Real Usage Examples in Large Projects + +Review real usage examples of the new language feature in large projects. +This helps to identify potential issues and ensures that the checks +are aligned with practical use cases. +A list of representative projects can be found +[here](https://github.com/checkstyle/contribution/blob/master/checkstyle-tester/github-action-projects1.properties). + +## New Check Procedure + +Creating new checks for new language features helps us establish +best practices within the community, ensuring that developers +utilize these features effectively. + +### Good Source of Best Practices + +Identify a reliable source of best practices related to the new language feature. +This could include official language documentation and community-driven style guides +such as: + +- [Oracle Java Magazine](https://blogs.oracle.com/javamagazine/) +- [JetBrains blogs](https://blog.jetbrains.com/) +- [Stackoverflow](https://stackoverflow.com/) + +### Review Associated JEP's Recommendations + +Refer to the associated JEPs for the new language feature. +JEPs provide detailed insights into the design decisions, +motivations and intended usage of the feature. +Oftentimes, JEPs may solve a particular problem in the language, +and we can create checks to suggest the use of these new features. +Pay close attention to any recommendations provided in the JEPs +as they can inform the development of effective new checks. + +**Examples**: + +- Pattern Matching for instanceof, where the newer pattern matching feature provides + a more concise and type-safe alternative to traditional casting. + Ideally, we would consider creating a check + to suggest the use of this new feature if we see the typical `if X instanceof Y`, + then typecasting pattern. + +### Discover Similar Checks + +Look for existing checks that address concepts +similar to those introduced by the new language feature. +These checks serve as references for designing and implementing new checks. + +**Examples**: + +- **Identifiers and Naming Conventions**: If the new feature introduces + new tokens involving identifiers, explore existing checks related to naming conventions. + We can create a new similar check to enforce naming conventions for the new feature. + +## How to Create Tracker Issue + +The tracker issue should document and share the results of the analysis +conducted according to the outlined procedures in this document. +It should include sections for each step of the analysis with the result +of all of our actions. These tracker issues should be created for each +new language feature, demonstrating our due diligence +in integrating the feature into Checkstyle. + +## How to Open Child Issues + +Using your findings from the tracker issue, open child issues for each check that needs +to be updated or for a new check related to the new language feature. +This issue should be linked to the tracker issue of this feature. +It is good to follow the bug report template to aid in demonstrating the need for check updates. diff --git a/pom.xml b/pom.xml index 023214e1f6a..cd6437626da 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ com.puppycrawl.tools checkstyle - 10.12.3 + 10.18.0 jar checkstyle @@ -24,8 +24,8 @@ 2001 - LGPL-2.1+ - http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt + LGPL-2.1-or-later + https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt @@ -59,7 +59,7 @@ - nick-mancuso + nrmancuso Nick Mancuso developer @@ -206,43 +206,77 @@ UTF-8 ${project.version} - 4.11.1 + 4.13.2 3.12.1 - 4.7.3.0 - 3.21.0 - 6.54.0 - 0.8.8 + 4.8.6.2 + 3.24.0 + 7.4.0 + 0.8.12 5.2.0 - 12.3 + 12.5 3.2.0 1.44.1 10.4 - 2.14.2 - 3.11.0 + 2.17.1 + 3.13.0 11 - 1.14.1 + ${java.version} + 1.16.1 10 HTML,XML 50000 4 - 1.1.2 + 1.2.1 1.0.6 **/test/resources/**/*,**/it/resources/**/* - 5.9.2 - 3.4 + 5.11.0 + 3.7 1.2.0 - 2.18.0 - 3.27.0 + 3.46.0 + 2.30.0 + 0.15.0 1.12.0 + + -Xep:AmbiguousJsonCreator:ERROR + -Xep:AssertJIsNull:ERROR + -Xep:AutowiredConstructor:ERROR + -Xep:CanonicalAnnotationSyntax:ERROR + -Xep:CollectorMutability:ERROR + -Xep:DirectReturn:ERROR + -Xep:EmptyMethod:ERROR + -Xep:ExplicitEnumOrdering:ERROR + -Xep:FormatStringConcatenation:ERROR + -Xep:IdentityConversion:ERROR + -Xep:ImmutablesSortedSetComparator:ERROR + -Xep:IsInstanceLambdaUsage:ERROR + -Xep:MockitoMockClassReference:ERROR + -Xep:MockitoStubbing:ERROR + -Xep:NestedOptionals:ERROR + -Xep:PrimitiveComparison:ERROR + -Xep:RedundantStringConversion:ERROR + -Xep:Slf4jLogStatement:ERROR + -Xep:StringJoin:ERROR + -Xep:TimeZoneUsage:ERROR + + -Xep:JUnitClassModifiers:OFF + + -Xep:JUnitMethodDeclaration:OFF + + -Xep:JUnitValueSource:OFF + + -Xep:LexicographicalAnnotationListing:OFF + + -Xep:StaticImport:OFF + info.picocli picocli - 4.7.4 + 4.7.6 org.antlr @@ -257,7 +291,7 @@ com.google.guava guava - 32.0.1-jre + 33.3.0-jre org.checkerframework @@ -299,13 +333,13 @@ org.junit-pioneer junit-pioneer - 2.0.0 + 2.2.0 test com.tngtech.archunit archunit-junit5 - 1.0.1 + 1.3.0 test @@ -331,13 +365,13 @@ com.google.truth truth - 1.1.3 + 1.4.4 test nl.jqno.equalsverifier equalsverifier - 3.15.1 + 3.16.2 test @@ -349,19 +383,19 @@ commons-io commons-io - 2.13.0 + 2.16.1 test org.eclipse.jgit org.eclipse.jgit - 6.6.0.202305301015-r + 6.10.0.202406032230-r test org.slf4j slf4j-simple - 2.0.7 + 2.0.16 test @@ -412,12 +446,22 @@ commons-codec commons-codec + + com.google.collections + google-collections + org.apache.maven.doxia doxia-module-xdoc ${doxia.version} + + + com.google.collections + google-collections + + @@ -443,11 +487,11 @@ maven-assembly-plugin - 3.6.0 + 3.7.1 maven-dependency-plugin - 3.6.0 + 3.8.0 maven-release-plugin @@ -459,7 +503,7 @@ org.codehaus.mojo exec-maven-plugin - 3.1.0 + 3.4.1 org.codehaus.mojo @@ -469,7 +513,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.5.0 + 3.6.0 org.pitest @@ -491,7 +535,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.5.0 + 3.8.0 @@ -577,7 +621,7 @@ com.mebigfatguy.sb-contrib sb-contrib - 7.6.0 + 7.6.4 @@ -656,7 +700,7 @@ org.apache.maven.plugins maven-source-plugin - 3.3.0 + 3.3.1 attach-sources @@ -674,7 +718,7 @@ org.codehaus.plexus plexus-component-metadata - 2.1.1 + 2.2.0 @@ -686,7 +730,7 @@ org.gaul modernizer-maven-plugin - 2.5.0 + 2.9.0 ${java.version} false @@ -705,13 +749,13 @@ org.apache.maven.plugins maven-clean-plugin - 3.3.1 + 3.4.0 org.codehaus.mojo tidy-maven-plugin - 1.2.0 + 1.3.0 validate @@ -762,8 +806,6 @@ maven-compiler-plugin ${maven.compiler.plugin.version} - ${java.version} - ${java.version} -Xpkginfo:always @@ -773,7 +815,7 @@ org.apache.maven.plugins maven-install-plugin - 3.1.1 + 3.1.3 @@ -805,7 +847,7 @@ org.apache.maven.plugins maven-deploy-plugin - 3.1.1 + 3.1.3 org.codehaus.mojo @@ -902,6 +944,8 @@ com.puppycrawl.tools.checkstyle.meta.ModuleDetails* com.puppycrawl.tools.checkstyle.meta.JavadocMetadataScraper* com.puppycrawl.tools.checkstyle.meta.XmlMeta* + + com.puppycrawl.tools.checkstyle.utils.OsSpecificUtil @@ -1095,7 +1139,7 @@ LINE COVEREDRATIO - 0.82 + 0.80 BRANCH @@ -1113,12 +1157,12 @@ LINE COVEREDRATIO - 0.81 + 0.80 BRANCH COVEREDRATIO - 0.79 + 0.75 @@ -1291,7 +1335,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.13 + 1.7.0 true @@ -1390,7 +1434,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.3.0 + 3.6.0 add-source @@ -1470,7 +1514,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.1.2 + 3.4.0 com/google/**/*.java @@ -1497,9 +1541,9 @@ org.apache.maven.plugins maven-surefire-plugin - 3.1.2 + 3.4.0 - -Dfile.encoding=UTF-8 @{surefire.options} + -Dfile.encoding=UTF-8 ${surefire.options} ${project.build.directory}/jacoco.exec @@ -1534,6 +1578,7 @@ + @@ -1545,13 +1590,16 @@ org.apache.maven.plugins maven-jar-plugin - 3.3.0 + 3.4.2 true true + + ${project.groupId}.${project.artifactId} + **/Input*.* @@ -1748,6 +1796,7 @@ **/AbstractJavadocCheck.class **/AtclauseOrderCheck.class **/JavadocBlockTagLocationCheck.class + **/JavadocLeadingAsteriskAlignCheck.class **/JavadocMethodCheck.class **/JavadocMissingLeadingAsteriskCheck.class **/JavadocMissingWhitespaceAfterAsteriskCheck.class @@ -1812,22 +1861,8 @@ **/OneStatementPerLineCheckTest.class - - - - **/FileSetCheckTest.class - **/AbstractFileSetCheckTest.class - - **/DetailAstImplTest.class - - **/TreeWalkerTest.class - - **/CheckerTest.class - - **/AllBlockCommentsTest.class - - - **/SuppressionCommentFilterTest.class + + **/AbstractModuleTestSupport.class **/EmptyLineSeparatorCheckTest.class @@ -1837,17 +1872,8 @@ **/RegexpHeaderCheckTest.class - - **/AbstractCheckTest.class - - - **/SuppressWithNearbyCommentFilterTest.class - - - **/AbstractModuleTestSupport.class - - - **/AbstractJavadocCheckTest.class + + **/CheckerTest.class @@ -1856,7 +1882,7 @@ edu.illinois nondex-maven-plugin - 2.1.1 + 2.1.7 @@ -1875,7 +1901,7 @@ ${basedir}/src/test/resources/com/puppycrawl/tools/checkstyle/sariflogger - https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Documents/CommitteeSpecifications/2.1.0/sarif-schema-2.1.0.json + https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json **/*.sarif @@ -1890,7 +1916,7 @@ maven-project-info-reports-plugin - 3.4.5 + 3.7.0 @@ -1917,7 +1943,7 @@ org.apache.maven.plugins maven-surefire-report-plugin - 3.1.2 + 3.4.0 @@ -1930,7 +1956,7 @@ org.apache.maven.plugins maven-jxr-plugin - 3.3.0 + 3.5.0 @@ -1942,7 +1968,7 @@ org.codehaus.mojo taglist-maven-plugin - 3.0.0 + 3.1.0 **/*/checks/TodoCommentCheck.java @@ -2119,9 +2145,6 @@ https://www.w3.org/TR/* https://maven.apache.org/* - - https://www.bountysource.com/* - https://api.bountysource.com/* https://bitbucket.org/atlassian/bamboo-checkstyle-plugin @@ -2148,6 +2171,7 @@ https://www.ej-technologies.com/* https://travis-ci.com/ + https://stackoverflow.com/questions/* https://docs.github.com/en/rest/checks https://www.ietf.org/rfc/rfc4627.txt @@ -2391,13 +2415,11 @@ false - ${java.version} - ${java.version} -Xpkginfo:always -XDcompilePolicy=simple - -Xplugin:ErrorProne + -Xplugin:ErrorProne ${error-prone.configuration-args} @@ -2406,6 +2428,11 @@ error_prone_core ${error-prone.version} + + tech.picnic.error-prone-support + error-prone-contrib + ${error-prone-support.version} + @@ -2443,14 +2470,13 @@ false - ${java.version} - ${java.version} -Xpkginfo:always -XDcompilePolicy=simple -Xplugin:ErrorProne \ - -XepExcludedPaths:.*[\\/]resources[\\/].* + -XepExcludedPaths:.*[\\/]resources[\\/].* \ + ${error-prone.configuration-args} @@ -2459,6 +2485,11 @@ error_prone_core ${error-prone.version} + + tech.picnic.error-prone-support + error-prone-contrib + ${error-prone-support.version} + @@ -2476,7 +2507,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.1.0 + 3.2.5 --pinentry-mode @@ -2499,9 +2530,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2558,9 +2589,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2617,9 +2648,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2675,9 +2706,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2732,9 +2763,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2790,9 +2821,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2850,9 +2881,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -2909,9 +2940,9 @@ true - false + true 1024m - 4048m + 8192m 10000 10000 @@ -3045,6 +3076,9 @@ com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil org.apache.commons.logging + + +funmodifiablecollection + com.puppycrawl.tools.checkstyle.meta.JavadocMetadataScraperTest + + com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil + *.Input* @@ -4321,6 +4375,7 @@ com.puppycrawl.tools.checkstyle.Checker* com.puppycrawl.tools.checkstyle.ThreadModeSettings* com.puppycrawl.tools.checkstyle.grammar.CrAwareLexerSimulator* + com.puppycrawl.tools.checkstyle.grammar.CompositeLexerContextCache* com.puppycrawl.tools.checkstyle.AuditEventFormatter* com.puppycrawl.tools.checkstyle.XdocsPropertyType* @@ -4352,15 +4407,33 @@ com.puppycrawl.tools.checkstyle.ThreadModeSettingsTest com.puppycrawl.tools.checkstyle.grammar.CrAwareLexerSimulatorTest com.puppycrawl.tools.checkstyle.grammar.javadoc.JavadocParseTreeTest + + com.puppycrawl.tools.checkstyle.grammar.java21.Java21AstRegressionTest com.puppycrawl.tools.checkstyle.filefilters.BeforeExecutionExclusionFileFilterTest + com.puppycrawl.tools.checkstyle.checks.TranslationCheckTest com.puppycrawl.tools.checkstyle.meta.MetadataGeneratorUtilTest com.puppycrawl.tools.checkstyle.checks.naming.ParameterNameCheckTest com.puppycrawl.tools.checkstyle.checks.coding.IllegalTypeCheckTest + + com.sun.checkstyle.test.chapter5comments.rule52documentationcomments.InvalidJavadocPositionTest + + org.apache.commons.logging + com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil + + + + lazyLoad + + initStringBuilderWithOptimalBuffer + + + +funmodifiablecollection + 100 96 ${pitest.plugin.timeout.factor} @@ -4434,6 +4507,9 @@ setFeaturesBySystemProperty + + +funmodifiablecollection + @@ -4501,7 +4577,7 @@ com.puppycrawl.tools.checkstyle.MainTest - 100 + 99 99 ${pitest.plugin.timeout.factor} ${pitest.plugin.timeout.constant} @@ -4672,6 +4748,8 @@ com.puppycrawl.tools.checkstyle.checks.coding.UnusedLocalVariableCheckTest com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheckTest + com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheckTest + com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheckTest org.checkstyle.suppressionxpathfilter.XpathRegressionUnusedLocalVariableTest com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheckTest org.checkstyle.suppressionxpathfilter.XpathRegressionJavadocMethodTest @@ -4679,7 +4757,11 @@ com.puppycrawl.tools.checkstyle.filters.SuppressWithPlainTextCommentFilterTest com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheckTest com.puppycrawl.tools.checkstyle.checks.NewlineAtEndOfFileCheckTest + com.puppycrawl.tools.checkstyle.checks.modifier.InterfaceMemberImpliedModifierCheckTest + + com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil + *.Input* @@ -4755,6 +4837,9 @@ com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil + + +funmodifiablecollection + *.Input* @@ -4818,6 +4903,7 @@ isFileExists + com.puppycrawl.tools.checkstyle.utils.OsSpecificUtil com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil @@ -4842,10 +4928,6 @@ com.puppycrawl.tools.checkstyle.checks.whitespace.SingleSpaceSeparatorCheckTest - - - com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheckTest - com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocStyleCheckTest @@ -4910,6 +4992,9 @@ com.puppycrawl.tools.checkstyle.checks.FinalParametersCheckTest + + com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil + *.Input* @@ -4974,7 +5059,7 @@ org.eclipse.jdt org.eclipse.jdt.annotation - 2.2.700 + 2.3.0 @@ -5044,7 +5129,14 @@ com.puppycrawl.tools.checkstyle.xpath.* com.puppycrawl.tools.checkstyle.XpathFileGeneratorAuditListenerTest com.puppycrawl.tools.checkstyle.XpathFileGeneratorAstFilterTest + com.puppycrawl.tools.checkstyle.filters.* + + com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil + + + +funmodifiablecollection + *.Input* diff --git a/src/it/java/com/google/checkstyle/test/base/AbstractGoogleModuleTestSupport.java b/src/it/java/com/google/checkstyle/test/base/AbstractGoogleModuleTestSupport.java index 83bf78b4f1f..bf2a6d61641 100644 --- a/src/it/java/com/google/checkstyle/test/base/AbstractGoogleModuleTestSupport.java +++ b/src/it/java/com/google/checkstyle/test/base/AbstractGoogleModuleTestSupport.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ package com.google.checkstyle.test.base; import java.io.IOException; -import java.util.List; +import java.util.Properties; import java.util.Set; import org.checkstyle.base.AbstractItModuleTestSupport; @@ -42,8 +42,11 @@ public abstract class AbstractGoogleModuleTestSupport extends AbstractItModuleTe static { try { + final Properties properties = new Properties(); + properties.put("org.checkstyle.google.severity", "error"); + final PropertiesExpander expander = new PropertiesExpander(properties); CONFIGURATION = ConfigurationLoader.loadConfiguration(XML_NAME, - new PropertiesExpander(System.getProperties())); + expander); } catch (CheckstyleException ex) { throw new IllegalStateException(ex); @@ -75,39 +78,12 @@ protected ModuleCreationOption findModuleCreationOption(String moduleName) { } /** - * Returns {@link Configuration} instance for the given module name. - * This implementation uses {@link #getModuleConfig(String, String)} method inside. + * Performs verification of the file with the given file path against the whole config. * - * @param moduleName module name. - * @return {@link Configuration} instance for the given module name. + * @param filePath file path to verify. + * @throws Exception if exception occurs during verification process. */ - protected static Configuration getModuleConfig(String moduleName) { - return getModuleConfig(moduleName, null); + protected void verifyWithWholeConfig(String filePath) throws Exception { + verifyWithItConfig(CONFIGURATION, filePath); } - - /** - * Returns {@link Configuration} instance for the given module name. - * This implementation uses {@link #getModuleConfig(String)} method inside. - * - * @param moduleName module name. - * @param moduleId module id. - * @return {@link Configuration} instance for the given module name. - * @throws IllegalStateException if there is a problem retrieving the module or config. - */ - protected static Configuration getModuleConfig(String moduleName, String moduleId) { - return getModuleConfig(CONFIGURATION, moduleName, moduleId); - } - - /** - * Returns a list of all {@link Configuration} instances for the given module IDs. - * - * @param moduleIds module IDs. - * @return List of {@link Configuration} instances. - * @throws CheckstyleException if there is an error with the config. - */ - protected static List getModuleConfigsByIds(String... moduleIds) - throws CheckstyleException { - return getModuleConfigsByIds(CONFIGURATION, moduleIds); - } - } diff --git a/src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java b/src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java index 614c4f19e5f..a645b71a952 100644 --- a/src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java +++ b/src/it/java/com/google/checkstyle/test/base/AbstractIndentationTestSupport.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java new file mode 100644 index 00000000000..6346ceda39b --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/FileNameTest.java @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter2filebasic.rule21filename; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class FileNameTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule21filename"; + } + + @Test + public void testOuterTypeFilename1() throws Exception { + verifyWithWholeConfig(getPath("InputFileName1.java")); + } + + @Test + public void testOuterTypeFilename2() throws Exception { + verifyWithWholeConfig(getPath("InputFileName2.java")); + } + + @Test + public void testOuterTypeFilename3() throws Exception { + verifyWithWholeConfig(getPath("InputFileName3.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java deleted file mode 100644 index 56574c009ff..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule21filename/OuterTypeFilenameTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter2filebasic.rule21filename; - -import static com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck.MSG_KEY; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.OuterTypeFilenameCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class OuterTypeFilenameTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter2filebasic/rule21filename"; - } - - @Test - public void testOuterTypeFilename1() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("OuterTypeFilename"); - final String filePath = getPath("InputOuterTypeFilename1.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testOuterTypeFilename2() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("OuterTypeFilename"); - final String filePath = getPath("InputOuterTypeFilename2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testOuterTypeFilename3() throws Exception { - final String[] expected = { - "3:1: " + getCheckMessage(OuterTypeFilenameCheck.class, MSG_KEY), - }; - - final Configuration checkConfig = getModuleConfig("OuterTypeFilename"); - final String filePath = getPath("InputOuterTypeFilename3.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java deleted file mode 100644 index 7cf939ac9ab..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/FileTabCharacterTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter2filebasic.rule231filetab; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.FileTabCharacterCheck; - -public class FileTabCharacterTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter2filebasic/rule231filetab"; - } - - @Test - public void testFileTab() throws Exception { - final String[] expected = { - "8:25: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "51:5: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "121:35: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "122:64: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "130:9: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "131:10: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "132:1: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "133:3: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - "134:3: " + getCheckMessage(FileTabCharacterCheck.class, "containsTab"), - }; - - final Configuration checkConfig = getModuleConfig("FileTabCharacter"); - final String filePath = getPath("InputFileTabCharacter.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/WhitespaceCharactersTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/WhitespaceCharactersTest.java new file mode 100644 index 00000000000..bac7248578e --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule231filetab/WhitespaceCharactersTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter2filebasic.rule231filetab; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class WhitespaceCharactersTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule231filetab"; + } + + @Test + public void testFileTab() throws Exception { + verifyWithWholeConfig(getPath("InputWhitespaceCharacters.java")); + } + + @Test + public void testFileTabFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedWhitespaceCharacters.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java deleted file mode 100644 index 022da759ac0..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/IllegalTokenTextTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter2filebasic.rule232specialescape; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class IllegalTokenTextTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter2filebasic/rule232specialescape"; - } - - @Test - public void testIllegalTokens() throws Exception { - final String message = "Consider using special escape sequence instead of octal value or " - + "Unicode escaped value."; - - final String[] expected = { - "18:27: " + message, - "19:27: " + message, - "22:25: " + message, - "23:25: " + message, - "25:16: " + message, - "43:21: " + message, - "44:21: " + message, - "45:21: " + message, - "46:21: " + message, - "47:21: " + message, - "48:21: " + message, - "49:21: " + message, - "54:21: " + message, - "55:21: " + message, - "56:21: " + message, - "57:21: " + message, - "58:21: " + message, - "59:21: " + message, - "60:21: " + message, - "61:21: " + message, - "69:31: " + message, - "70:31: " + message, - "73:29: " + message, - "74:29: " + message, - "76:20: " + message, - "94:25: " + message, - "95:25: " + message, - "96:25: " + message, - "97:25: " + message, - "98:25: " + message, - "99:25: " + message, - "100:25: " + message, - "105:25: " + message, - "106:25: " + message, - "107:25: " + message, - "108:25: " + message, - "109:25: " + message, - "110:25: " + message, - "111:25: " + message, - "112:25: " + message, - "119:35: " + message, - "120:35: " + message, - "123:33: " + message, - "124:33: " + message, - "126:24: " + message, - "144:29: " + message, - "145:29: " + message, - "146:29: " + message, - "147:29: " + message, - "148:29: " + message, - "149:29: " + message, - "150:29: " + message, - "155:29: " + message, - "156:29: " + message, - "157:29: " + message, - "158:29: " + message, - "159:29: " + message, - "160:29: " + message, - "161:29: " + message, - "162:29: " + message, - }; - - final Configuration checkConfig = getModuleConfig("IllegalTokenText"); - final String filePath = getPath("InputIllegalTokenText.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/SpecialEscapeSequencesTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/SpecialEscapeSequencesTest.java new file mode 100644 index 00000000000..ed0d7af23e2 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/SpecialEscapeSequencesTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter2filebasic.rule232specialescape; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class SpecialEscapeSequencesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule232specialescape"; + } + + @Test + public void testIllegalTokens() throws Exception { + verifyWithWholeConfig(getPath("InputSpecialEscapeSequences.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java deleted file mode 100644 index b3a91c81bbe..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/AvoidEscapedUnicodeCharactersTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter2filebasic.rule233nonascii; - -import static com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck.MSG_KEY; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.AvoidEscapedUnicodeCharactersCheck; - -public class AvoidEscapedUnicodeCharactersTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter2filebasic/rule233nonascii"; - } - - @Test - public void testUnicodeEscapes() throws Exception { - final String[] expected = { - "5:42: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY), - "15:38: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY), - "25:36: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY), - "33:38: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY), - "35:38: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY), - "36:47: " + getCheckMessage(AvoidEscapedUnicodeCharactersCheck.class, MSG_KEY), - }; - - final Configuration checkConfig = getModuleConfig("AvoidEscapedUnicodeCharacters"); - final String filePath = getPath("InputAvoidEscapedUnicodeCharacters.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/NonAsciiCharactersTest.java b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/NonAsciiCharactersTest.java new file mode 100644 index 00000000000..72faf53e7c6 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter2filebasic/rule233nonascii/NonAsciiCharactersTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter2filebasic.rule233nonascii; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NonAsciiCharactersTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter2filebasic/rule233nonascii"; + } + + @Test + public void testUnicodeEscapes() throws Exception { + verifyWithWholeConfig(getPath("InputNonAsciiCharacters.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java deleted file mode 100644 index 41dd17fee20..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestate/LineLengthTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule32packagestate; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; - -public class LineLengthTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule32packagestate"; - } - - @Test - public void testLineLength() throws Exception { - final String[] expected = { - "5: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 112), - "29: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 183), - "46: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 131), - "47: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 124), - "48: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 113), - "50: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 116), - "53: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 131), - "57: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 116), - }; - - final Configuration checkConfig = getModuleConfig("LineLength"); - final String filePath = getPath("InputLineLength.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestatement/PackageStatementTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestatement/PackageStatementTest.java new file mode 100644 index 00000000000..21d1aef28b3 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule32packagestatement/PackageStatementTest.java @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule32packagestatement; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class PackageStatementTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule32packagestatement"; + } + + @Test + public void testPackageStatement() throws Exception { + verifyWithWholeConfig(getPath("InputPackageStatement.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java deleted file mode 100644 index f175afadc0d..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/AvoidStarImportTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule331nowildcard; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class AvoidStarImportTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule331nowildcard"; - } - - @Test - public void testStarImport() throws Exception { - final String[] expected = { - "3:15: Using the '.*' form of import should be avoided - java.io.*.", - "4:17: Using the '.*' form of import should be avoided - java.lang.*.", - "18:42: Using the '.*' form of import should be avoided - " - + "javax.swing.WindowConstants.*.", - "19:42: Using the '.*' form of import should be avoided - " - + "javax.swing.WindowConstants.*.", - }; - - final Configuration checkConfig = getModuleConfig("AvoidStarImport"); - final String filePath = getPath("InputAvoidStarImport.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/NoWildcardImportsTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/NoWildcardImportsTest.java new file mode 100644 index 00000000000..a08b52995c4 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/NoWildcardImportsTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule331nowildcard; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NoWildcardImportsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule331nowildcard"; + } + + @Test + public void testStarImport() throws Exception { + verifyWithWholeConfig(getPath("InputNoWildcardImports.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java deleted file mode 100644 index 849a45bcb09..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrapTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; -import com.puppycrawl.tools.checkstyle.checks.whitespace.NoLineWrapCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class NoLineWrapTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap"; - } - - @Test - public void testBadLineWrap() throws Exception { - final String[] expected = { - "1:1: " + getCheckMessage(NoLineWrapCheck.class, "no.line.wrap", "package"), - "6:1: " + getCheckMessage(NoLineWrapCheck.class, "no.line.wrap", "import"), - "10:1: " + getCheckMessage(NoLineWrapCheck.class, "no.line.wrap", "import"), - }; - - final Configuration checkConfig = getModuleConfig("NoLineWrap"); - final String filePath = getPath("InputNoLineWrapBad.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testGoodLineWrap() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("NoLineWrap"); - final String filePath = getPath("InputNoLineWrapGood.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void goodLineLength() throws Exception { - final int maxLineLength = 100; - final String[] expected = { - "5: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", maxLineLength, 112), - "29: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", maxLineLength, 113), - }; - - final Configuration checkConfig = getModuleConfig("LineLength"); - final String filePath = getPath("InputLineLength.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrappingTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrappingTest.java new file mode 100644 index 00000000000..4a0c2f2ce12 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/NoLineWrappingTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NoLineWrappingTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap"; + } + + @Test + public void testBadLineWrap() throws Exception { + verifyWithWholeConfig(getPath("InputNoLineWrapping.java")); + } + + @Test + public void testBadLineWrapFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedNoLineWrapping.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java deleted file mode 100644 index 34808921e68..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/CustomImportOrderTest.java +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class CustomImportOrderTest extends AbstractGoogleModuleTestSupport { - - /** Shortcuts to make code more compact. */ - private static final String MSG_LINE_SEPARATOR = CustomImportOrderCheck.MSG_LINE_SEPARATOR; - private static final String MSG_SEPARATED_IN_GROUP = - CustomImportOrderCheck.MSG_SEPARATED_IN_GROUP; - private static final String MSG_LEX = CustomImportOrderCheck.MSG_LEX; - private static final String MSG_NONGROUP_EXPECTED = - CustomImportOrderCheck.MSG_NONGROUP_EXPECTED; - - private static final String STATIC = CustomImportOrderCheck.STATIC_RULE_GROUP; - - private final Class clazz = CustomImportOrderCheck.class; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing"; - } - - @Test - public void testCustomImport1() throws Exception { - final String[] expected = { - "4:1: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT", - "java.io.File.createTempFile"), - "6:1: " + getCheckMessage(clazz, MSG_LINE_SEPARATOR, "java.awt.Button"), - "8:1: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Dialog", "java.awt.Frame"), - "12:1: " + getCheckMessage(clazz, MSG_LEX, "java.io.File", "javax.swing.JTable"), - "13:1: " + getCheckMessage(clazz, MSG_LEX, "java.io.IOException", "javax.swing.JTable"), - "14:1: " + getCheckMessage(clazz, MSG_LEX, "java.io.InputStream", "javax.swing.JTable"), - "15:1: " + getCheckMessage(clazz, MSG_LEX, "java.io.Reader", "javax.swing.JTable"), - "17:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "com.google.common.base.Ascii"), - "17:1: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.base.Ascii", - "javax.swing.JTable"), - }; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrder1.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCustomImport2() throws Exception { - final String[] expected = { - "4:1: " + getCheckMessage(clazz, MSG_LEX, "java.awt.Button.ABORT", - "java.io.File.createTempFile"), - "9:1: " + getCheckMessage(clazz, MSG_LEX, "java.util.*", "java.util.StringTokenizer"), - "11:1: " + getCheckMessage(clazz, MSG_LEX, "java.util.concurrent.*", - "java.util.concurrent.AbstractExecutorService"), - "13:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "com.google.checkstyle.test.chapter2filebasic.rule21filename.*"), - "13:1: " + getCheckMessage(clazz, MSG_LEX, - "com.google.checkstyle.test.chapter2filebasic.rule21filename.*", - "java.util.concurrent.AbstractExecutorService"), - "14:1: " + getCheckMessage(clazz, MSG_LEX, - "com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*", - "java.util.concurrent.AbstractExecutorService"), - "16:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "com.google.common.reflect.*"), - "16:1: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.reflect.*", - "java.util.concurrent.AbstractExecutorService"), - }; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrder2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCustomImport3() throws Exception { - final String[] expected = { - "4:1: " + getCheckMessage(clazz, MSG_LINE_SEPARATOR, "java.awt.Dialog"), - "5:1: " + getCheckMessage(clazz, MSG_NONGROUP_EXPECTED, STATIC, - "javax.swing.WindowConstants.*"), - "7:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "com.google.checkstyle.test.chapter2filebasic.rule21filename.*"), - "7:1: " + getCheckMessage(clazz, MSG_LEX, - "com.google.checkstyle.test.chapter2filebasic.rule21filename.*", "java.awt.Dialog"), - "8:1: " + getCheckMessage(clazz, MSG_LEX, "com.google.common.reflect.*", - "java.awt.Dialog"), - "9:1: " + getCheckMessage(clazz, MSG_LEX, - "com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*", - "java.awt.Dialog"), - "11:1: " + getCheckMessage(clazz, MSG_NONGROUP_EXPECTED, STATIC, - "java.io.File.createTempFile"), - "13:1: " + getCheckMessage(clazz, MSG_LEX, "java.util.*", "java.util.StringTokenizer"), - "15:1: " + getCheckMessage(clazz, MSG_LEX, "java.util.concurrent.*", - "java.util.concurrent.AbstractExecutorService"), - }; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrder3.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCustomImport4() throws Exception { - final String[] expected = { - "7:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "javax.swing.WindowConstants.*"), - "15:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "java.util.StringTokenizer"), - "17:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "java.util.concurrent.AbstractExecutorService"), - }; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrder4.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCustomImport5() throws Exception { - final String[] expected = { - "9:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "javax.swing.WindowConstants.*"), - "13:1: " + getCheckMessage(clazz, MSG_LINE_SEPARATOR, - "com.google.checkstyle.test.chapter2filebasic.rule21filename.*"), - "17:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "com.google.common.reflect.*"), - "21:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "java.util.StringTokenizer"), - "25:1: " + getCheckMessage(clazz, MSG_SEPARATED_IN_GROUP, - "java.util.concurrent.AbstractExecutorService"), - }; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrder5.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testValid() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrderValid.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testValid2() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrderValid2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testValidGoogleStyleOrderOfImports() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("CustomImportOrder"); - final String filePath = getPath("InputCustomImportOrderNoImports.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/OrderingAndSpacingTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/OrderingAndSpacingTest.java new file mode 100644 index 00000000000..8f8a6c27f0d --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/OrderingAndSpacingTest.java @@ -0,0 +1,72 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class OrderingAndSpacingTest extends AbstractGoogleModuleTestSupport { + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing"; + } + + @Test + public void testCustomImport1() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacing1.java")); + } + + @Test + public void testCustomImport2() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacing2.java")); + } + + @Test + public void testCustomImport3() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacing3.java")); + } + + @Test + public void testCustomImport4() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacing4.java")); + } + + @Test + public void testCustomImport5() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacing5.java")); + } + + @Test + public void testValid() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacingValid.java")); + } + + @Test + public void testValid2() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacingValid2.java")); + } + + @Test + public void testValidGoogleStyleOrderOfImports() throws Exception { + verifyWithWholeConfig(getPath("InputOrderingAndSpacingNoImports.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/ExactlyOneTopLevelClassDeclarationTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/ExactlyOneTopLevelClassDeclarationTest.java new file mode 100644 index 00000000000..58a17d97bac --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/ExactlyOneTopLevelClassDeclarationTest.java @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ExactlyOneTopLevelClassDeclarationTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel"; + } + + @Test + public void testBad() throws Exception { + verifyWithWholeConfig(getPath("InputOneTopLevelClassBasic.java")); + } + + @Test + public void testGood() throws Exception { + verifyWithWholeConfig(getPath("InputOneTopLevelClassGood.java")); + } + + @Test + public void testBad1() throws Exception { + verifyWithWholeConfig(getPath("InputOneTopLevelClassBad1.java")); + } + + @Test + public void testBad2() throws Exception { + verifyWithWholeConfig(getPath("InputOneTopLevelClassBad2.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java deleted file mode 100644 index 6513572e0e4..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/OneTopLevelClassTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.design.OneTopLevelClassCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class OneTopLevelClassTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel"; - } - - @Test - public void testBad() throws Exception { - final Class clazz = OneTopLevelClassCheck.class; - final String messageKey = "one.top.level.class"; - - final String[] expected = { - "25:1: " + getCheckMessage(clazz, messageKey, "NoSuperClone"), - "33:1: " + getCheckMessage(clazz, messageKey, "InnerClone"), - "50:1: " + getCheckMessage(clazz, messageKey, "CloneWithTypeArguments"), - "55:1: " + getCheckMessage(clazz, messageKey, "CloneWithTypeArgumentsAndNoSuper"), - "60:1: " + getCheckMessage(clazz, messageKey, "MyClassWithGenericSuperMethod"), - "77:1: " + getCheckMessage(clazz, messageKey, "AnotherClass"), - }; - - final Configuration checkConfig = getModuleConfig("OneTopLevelClass"); - final String filePath = getPath("InputOneTopLevelClassBasic.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testGood() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("OneTopLevelClass"); - final String filePath = getPath("InputOneTopLevelClassGood.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testBad1() throws Exception { - final Class clazz = OneTopLevelClassCheck.class; - final String messageKey = "one.top.level.class"; - - final String[] expected = { - "4:1: " + getCheckMessage(clazz, messageKey, "FooEnum"), - "5:1: " + getCheckMessage(clazz, messageKey, "FooAt"), - }; - - final Configuration checkConfig = getModuleConfig("OneTopLevelClass"); - final String filePath = getPath("InputOneTopLevelClassBad1.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testBad2() throws Exception { - final Class clazz = OneTopLevelClassCheck.class; - final String messageKey = "one.top.level.class"; - - final String[] expected = { - "5:1: " + getCheckMessage(clazz, messageKey, "FooIn"), - "7:1: " + getCheckMessage(clazz, messageKey, "FooClass"), - }; - - final Configuration checkConfig = getModuleConfig("OneTopLevelClass"); - final String filePath = getPath("InputOneTopLevelClassBad2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java deleted file mode 100644 index 68898174558..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadMethodsDeclarationOrderTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule3421overloadsplit; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.OverloadMethodsDeclarationOrderCheck; - -public class OverloadMethodsDeclarationOrderTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit"; - } - - @Test - public void testOverloadMethods() throws Exception { - final Class clazz = - OverloadMethodsDeclarationOrderCheck.class; - final String messageKey = "overload.methods.declaration"; - - final String[] expected = { - "26:5: " + getCheckMessage(clazz, messageKey, 15), - "54:9: " + getCheckMessage(clazz, messageKey, 43), - "66:5: " + getCheckMessage(clazz, messageKey, 64), - "109:5: " + getCheckMessage(clazz, messageKey, 98), - }; - - final Configuration checkConfig = getModuleConfig("OverloadMethodsDeclarationOrder"); - final String filePath = getPath("InputOverloadMethodsDeclarationOrder.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadsNeverSplitTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadsNeverSplitTest.java new file mode 100644 index 00000000000..29e5c960183 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/OverloadsNeverSplitTest.java @@ -0,0 +1,42 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule3421overloadsplit; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class OverloadsNeverSplitTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit"; + } + + @Test + public void testOverloadConstructors() throws Exception { + verifyWithWholeConfig(getPath("InputOverloadsNeverSplit.java")); + } + + @Test + public void testOverloadConstructorsRecords() throws Exception { + verifyWithWholeConfig(getNonCompilablePath("InputOverloadsNeverSplitRecords.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java deleted file mode 100644 index 34039889f20..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/EmptyLineSeparatorTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter3filestructure.rule3sourcefile; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck; - -public class EmptyLineSeparatorTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter3filestructure/rule3sourcefile"; - } - - @Test - public void testEmptyLineSeparator() throws Exception { - final Class clazz = EmptyLineSeparatorCheck.class; - final String messageKey = "empty.line.separator"; - - final String[] expected = { - "19:1: " + getCheckMessage(clazz, messageKey, "package"), - "20:1: " + getCheckMessage(clazz, messageKey, "import"), - "33:1: " + getCheckMessage(clazz, messageKey, "CLASS_DEF"), - "37:5: " + getCheckMessage(clazz, messageKey, "STATIC_INIT"), - "66:5: " + getCheckMessage(clazz, messageKey, "METHOD_DEF"), - "75:5: " + getCheckMessage(clazz, messageKey, "INTERFACE_DEF"), - "82:9: " + getCheckMessage(clazz, messageKey, "INSTANCE_INIT"), - "113:1: " + getCheckMessage(clazz, messageKey, "CLASS_DEF"), - "119:5: " + getCheckMessage(clazz, messageKey, "VARIABLE_DEF"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyLineSeparator"); - final String filePath = getPath("InputEmptyLineSeparator.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java new file mode 100644 index 00000000000..83959ced1e6 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/SourceFileStructureTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.rule3sourcefile; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class SourceFileStructureTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/rule3sourcefile"; + } + + @Test + public void testEmptyLineSeparator() throws Exception { + verifyWithWholeConfig(getPath("InputSourceFileStructure.java")); + } + + @Test + public void testEmptyLineSeparatorFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedSourceFileStructure.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java b/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java new file mode 100644 index 00000000000..15171e37307 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/PackageStatementTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class PackageStatementTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter3filestructure/" + + "toolongpackagetotestcoveragegooglesjavastylerule"; + } + + @Test + public void testPackageStatement() throws Exception { + verifyWithWholeConfig(getPath("InputPackageStatementLongName.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java deleted file mode 100644 index 504f04502fd..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/NeedBracesTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule411bracesareused; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.blocks.NeedBracesCheck; - -public class NeedBracesTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule411bracesareused"; - } - - @Test - public void testNeedBraces() throws Exception { - final Class clazz = NeedBracesCheck.class; - final String messageKey = "needBraces"; - - final String[] expected = { - "29:9: " + getCheckMessage(clazz, messageKey, "do"), - "41:9: " + getCheckMessage(clazz, messageKey, "while"), - "42:9: " + getCheckMessage(clazz, messageKey, "while"), - "44:9: " + getCheckMessage(clazz, messageKey, "while"), - "45:13: " + getCheckMessage(clazz, messageKey, "if"), - "58:9: " + getCheckMessage(clazz, messageKey, "for"), - "59:9: " + getCheckMessage(clazz, messageKey, "for"), - "61:9: " + getCheckMessage(clazz, messageKey, "for"), - "63:13: " + getCheckMessage(clazz, messageKey, "if"), - "82:9: " + getCheckMessage(clazz, messageKey, "if"), - "83:9: " + getCheckMessage(clazz, messageKey, "if"), - "85:9: " + getCheckMessage(clazz, messageKey, "if"), - "87:9: " + getCheckMessage(clazz, messageKey, "else"), - "89:9: " + getCheckMessage(clazz, messageKey, "if"), - "97:9: " + getCheckMessage(clazz, messageKey, "else"), - "99:9: " + getCheckMessage(clazz, messageKey, "if"), - "100:13: " + getCheckMessage(clazz, messageKey, "if"), - "126:9: " + getCheckMessage(clazz, messageKey, "while"), - "129:9: " + getCheckMessage(clazz, messageKey, "do"), - "135:9: " + getCheckMessage(clazz, messageKey, "if"), - "138:9: " + getCheckMessage(clazz, messageKey, "if"), - "139:9: " + getCheckMessage(clazz, messageKey, "else"), - "144:9: " + getCheckMessage(clazz, messageKey, "for"), - "147:9: " + getCheckMessage(clazz, messageKey, "for"), - "157:13: " + getCheckMessage(clazz, messageKey, "while"), - "160:13: " + getCheckMessage(clazz, messageKey, "do"), - "166:13: " + getCheckMessage(clazz, messageKey, "if"), - "169:13: " + getCheckMessage(clazz, messageKey, "if"), - "170:13: " + getCheckMessage(clazz, messageKey, "else"), - "175:13: " + getCheckMessage(clazz, messageKey, "for"), - "178:13: " + getCheckMessage(clazz, messageKey, "for"), - "189:13: " + getCheckMessage(clazz, messageKey, "while"), - "192:13: " + getCheckMessage(clazz, messageKey, "do"), - "198:13: " + getCheckMessage(clazz, messageKey, "if"), - "201:13: " + getCheckMessage(clazz, messageKey, "if"), - "202:13: " + getCheckMessage(clazz, messageKey, "else"), - "207:13: " + getCheckMessage(clazz, messageKey, "for"), - "210:13: " + getCheckMessage(clazz, messageKey, "for"), - }; - - final Configuration checkConfig = getModuleConfig("NeedBraces"); - final String filePath = getPath("InputNeedBraces.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage/UseOfOptionalBracesTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage/UseOfOptionalBracesTest.java new file mode 100644 index 00000000000..bc42357a2ce --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage/UseOfOptionalBracesTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule411optionalbracesusage; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class UseOfOptionalBracesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage"; + } + + @Test + public void testNeedBraces() throws Exception { + verifyWithWholeConfig(getPath("InputUseOfOptionalBraces.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java deleted file mode 100644 index 8ec50466459..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/LeftCurlyTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; - -import static com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck.MSG_KEY_LINE_PREVIOUS; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyCheck; - -public class LeftCurlyTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks"; - } - - @Test - public void testLeftCurlyBraces() throws Exception { - final String[] expected = { - "4:1: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 1), - "7:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "13:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "26:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "43:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "61:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "97:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - }; - - final Configuration checkConfig = getModuleConfig("LeftCurly"); - final String filePath = getPath("InputLeftCurlyBraces.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testLeftCurlyAnnotations() throws Exception { - final String[] expected = { - "10:1: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 1), - "14:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "21:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "27:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "50:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - }; - - final Configuration checkConfig = getModuleConfig("LeftCurly"); - final String filePath = getPath("InputLeftCurlyAnnotations.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testLeftCurlyMethods() throws Exception { - final String[] expected = { - "4:1: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 1), - "9:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "16:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "19:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "23:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "31:1: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 1), - "33:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "38:9: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 9), - "41:9: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 9), - "45:9: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 9), - "57:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "61:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "69:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "72:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - "76:5: " + getCheckMessage(LeftCurlyCheck.class, MSG_KEY_LINE_PREVIOUS, "{", 5), - }; - - final Configuration checkConfig = getModuleConfig("LeftCurly"); - final String filePath = getPath("InputLeftCurlyMethod.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/NonemptyBlocksKrStyleTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/NonemptyBlocksKrStyleTest.java new file mode 100644 index 00000000000..a9b30110e43 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/NonemptyBlocksKrStyleTest.java @@ -0,0 +1,123 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NonemptyBlocksKrStyleTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks"; + } + + @Test + public void testLeftAndRightCurlyBraces() throws Exception { + verifyWithWholeConfig(getPath("InputNonemptyBlocksLeftRightCurly.java")); + } + + @Test + public void testLeftAndRightCurlyBracesFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedNonemptyBlocksLeftRightCurly.java")); + } + + @Test + public void testLeftCurlyAnnotations() throws Exception { + verifyWithWholeConfig(getPath("InputLeftCurlyAnnotations.java")); + } + + @Test + public void testLeftCurlyAnnotationsFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedLeftCurlyAnnotations.java")); + } + + @Test + public void testLeftCurlyMethods() throws Exception { + verifyWithWholeConfig(getPath("InputLeftCurlyMethod.java")); + } + + @Test + public void testLeftCurlyMethodsFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedLeftCurlyMethod.java")); + } + + @Test + public void testRightCurly() throws Exception { + verifyWithWholeConfig(getPath("InputRightCurly.java")); + } + + @Test + public void testRightCurlyFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedRightCurly.java")); + } + + @Test + public void testRightCurlyLiteralDoDefault() throws Exception { + verifyWithWholeConfig(getPath("InputRightCurlyDoWhile.java")); + } + + @Test + public void testRightCurlyLiteralDoDefaultFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedRightCurlyDoWhile.java")); + } + + @Test + public void testRightCurlyOther() throws Exception { + verifyWithWholeConfig(getPath("InputRightCurlyOther.java")); + } + + @Test + public void testRightCurlyOtherFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedRightCurlyOther.java")); + } + + @Test + public void testRightCurlyLiteralDo() throws Exception { + verifyWithWholeConfig(getPath("InputRightCurlyDoWhile2.java")); + } + + @Test + public void testRightCurlyLiteralDoFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedRightCurlyDoWhile2.java")); + } + + @Test + public void testRightCurlySwitch() throws Exception { + verifyWithWholeConfig(getPath("InputRightCurlySwitchCase.java")); + } + + @Test + public void testRightCurlySwitchFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedRightCurlySwitchCase.java")); + } + + @Test + public void testRightCurlySwitchCases() throws Exception { + verifyWithWholeConfig(getPath("InputRightCurlySwitchCasesBlocks.java")); + } + + @Test + public void testRightCurlySwitchCasesFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedRightCurlySwitchCasesBlocks.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java deleted file mode 100644 index 09b95f90bcc..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/RightCurlyTest.java +++ /dev/null @@ -1,133 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; - -import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_ALONE; -import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_BREAK_BEFORE; -import static com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck.MSG_KEY_LINE_SAME; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.blocks.RightCurlyCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class RightCurlyTest extends AbstractGoogleModuleTestSupport { - - private static final String[] MODULES = { - "RightCurlySame", "RightCurlyAlone", - }; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks"; - } - - @Test - public void testRightCurly() throws Exception { - final String[] expected = { - "20:17: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 17), - "32:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13), - "79:27: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_BREAK_BEFORE, "}", 27), - "97:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5), - "108:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5), - }; - - final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); - final String filePath = getPath("InputRightCurlyOther.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testRightCurly2() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); - final String filePath = getPath("InputRightCurly2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testRightCurlyLiteralDoDefault() throws Exception { - final String[] expected = { - "62:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9), - "67:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13), - "83:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9), - }; - - final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); - final String filePath = getPath("InputRightCurlyDoWhile.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testRightCurlyOther() throws Exception { - final String[] expected = { - "20:17: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 17), - "32:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13), - "79:27: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_BREAK_BEFORE, "}", 27), - "97:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5), - "108:5: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 5), - }; - - final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); - final String filePath = getPath("InputRightCurlyOther2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testRightCurlyLiteralDo() throws Exception { - final String[] expected = { - "62:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9), - "67:13: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 13), - "83:9: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_SAME, "}", 9), - }; - - final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); - final String filePath = getPath("InputRightCurlyDoWhile2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testRightCurlySwitch() throws Exception { - final String[] expected = { - "12:24: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 24), - "19:27: " + getCheckMessage(RightCurlyCheck.class, MSG_KEY_LINE_ALONE, "}", 27), - - }; - - final Configuration checkConfig = createTreeWalkerConfig(getModuleConfigsByIds(MODULES)); - final String filePath = getPath("InputRightCurlySwitchCase.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java deleted file mode 100644 index 02f53beb249..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlockTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck; - -public class EmptyBlockTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule413emptyblocks"; - } - - @Test - public void testEmptyBlock() throws Exception { - final String[] expected = { - "19:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "22:34: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "26:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "28:20: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "switch"), - "68:25: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "71:38: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "75:25: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "77:24: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "switch"), - "98:29: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "101:42: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "105:29: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "107:28: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "switch"), - "126:16: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "172:28: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "173:14: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "175:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "179:14: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "181:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "182:26: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "195:20: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "241:32: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "242:18: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "244:25: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "248:18: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "250:25: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "251:30: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "264:24: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "310:36: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "311:22: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "313:29: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "317:22: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "else"), - "319:29: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - "320:34: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "if"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyBlock"); - final String filePath = getPath("InputEmptyBlockBasic.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testEmptyBlockCatch() throws Exception { - final String[] expected = { - "29:17: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "finally"), - "50:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "finally"), - "72:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "finally"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyBlock"); - final String filePath = getPath("InputEmptyBlock.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlocksMayBeConciseTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlocksMayBeConciseTest.java new file mode 100644 index 00000000000..a0f216ec39a --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyBlocksMayBeConciseTest.java @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class EmptyBlocksMayBeConciseTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule413emptyblocks"; + } + + @Test + public void testEmptyBlocksAndCatchBlocks() throws Exception { + verifyWithWholeConfig(getPath("InputEmptyBlocksAndCatchBlocks.java")); + } + + @Test + public void testEmptyFinallyBlocks() throws Exception { + verifyWithWholeConfig(getPath("InputEmptyFinallyBlocks.java")); + } + + @Test + public void testEmptyCatchBlockNoViolations() throws Exception { + verifyWithWholeConfig(getPath("InputEmptyBlocksAndCatchBlocksNoViolations.java")); + } + + @Test + public void testEmptyCatchBlockViolationsByComment() throws Exception { + verifyWithWholeConfig(getPath("InputEmptyCatchBlockViolationsByComment.java")); + } + + @Test + public void testEmptyCatchBlockViolationsByVariableName() throws Exception { + verifyWithWholeConfig(getPath("InputEmptyCatchBlockViolationsByVariableName.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java deleted file mode 100644 index 4bfa8a0fda0..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/EmptyCatchBlockTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.blocks.EmptyCatchBlockCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class EmptyCatchBlockTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule413emptyblocks"; - } - - @Test - public void testEmptyBlockCatch() throws Exception { - final String[] expected = { - "28:31: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "49:35: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "71:35: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "79:31: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "83:40: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyCatchBlock"); - final String filePath = getPath("InputEmptyBlockCatch.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testNoViolations() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("EmptyCatchBlock"); - final String filePath = getPath("InputEmptyCatchBlockNoViolations.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testViolationsByComment() throws Exception { - final String[] expected = { - "20:9: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "28:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyCatchBlock"); - final String filePath = getPath("InputEmptyCatchBlockViolationsByComment.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testViolationsByVariableName() throws Exception { - final String[] expected = { - "20:9: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "36:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "52:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - "59:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyCatchBlock"); - final String filePath = getPath("InputEmptyCatchBlockViolationsByVariableName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/BlockIndentation2SpacesTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/BlockIndentation2SpacesTest.java new file mode 100644 index 00000000000..9fdea74ad63 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/BlockIndentation2SpacesTest.java @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractIndentationTestSupport; + +public class BlockIndentation2SpacesTest extends AbstractIndentationTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule42blockindentation"; + } + + @Test + public void testCorrectClass() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectClass.java")); + } + + @Test + public void testCorrectField() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectFieldAndParameter.java")); + } + + @Test + public void testCorrectFor() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectForAndParameter.java")); + } + + @Test + public void testCorrectIf() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectIfAndParameter.java")); + } + + @Test + public void testCorrectNewKeyword() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectNewChildren.java")); + } + + @Test + public void testCorrect() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrect.java")); + } + + @Test + public void testCorrectReturn() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectReturnAndParameter.java")); + } + + @Test + public void testCorrectWhile() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectWhileDoWhileAndParameter.java")); + } + + @Test + public void testCorrectChained() throws Exception { + verifyWithWholeConfig(getPath("ClassWithChainedMethodsCorrect.java")); + } + + @Test + public void testWarnChained() throws Exception { + verifyWithWholeConfig(getPath("ClassWithChainedMethods.java")); + } + + @Test + public void testCorrectAnnotationArrayInit() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectAnnotationArrayInit.java")); + } + + @Test + public void testFastMatcher() throws Exception { + verifyWithWholeConfig(getPath("InputFastMatcher.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java index eab34f87772..e33f616b72b 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -22,8 +22,6 @@ import org.junit.jupiter.api.Test; import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck; public class OneStatementPerLineTest extends AbstractGoogleModuleTestSupport { @@ -34,59 +32,17 @@ protected String getPackageLocation() { @Test public void testOneStatement() throws Exception { - final String msg = getCheckMessage(OneStatementPerLineCheck.class, - "multiple.statements.line"); - - final String[] expected = { - "6:59: " + msg, - "50:21: " + msg, - "52:21: " + msg, - "54:42: " + msg, - "57:25: " + msg, - "58:35: " + msg, - "68:14: " + msg, - "95:25: " + msg, - "97:25: " + msg, - "99:46: " + msg, - "102:29: " + msg, - "103:39: " + msg, - "111:15: " + msg, - "123:23: " + msg, - "138:59: " + msg, - "170:19: " + msg, - "188:15: " + msg, - "196:15: " + msg, - "208:6: " + msg, - "217:22: " + msg, - "307:39: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("OneStatementPerLine"); - final String filePath = getPath("InputOneStatementPerLine.java"); + verifyWithWholeConfig(getPath("InputOneStatementPerLine.java")); + } - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + @Test + public void testOneStatementFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedOneStatementPerLine.java")); } @Test public void testOneStatementNonCompilableInput() throws Exception { - final String msg = getCheckMessage(OneStatementPerLineCheck.class, - "multiple.statements.line"); - - final String[] expected = { - "32:6: " + msg, - "37:58: " + msg, - "38:58: " + msg, - "38:74: " + msg, - "39:50: " + msg, - "43:85: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("OneStatementPerLine"); - final String filePath = getNonCompilablePath("InputOneStatementPerLine.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getNonCompilablePath("InputOneStatementPerLine.java")); } } diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/ColumnLimit100Test.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/ColumnLimit100Test.java new file mode 100644 index 00000000000..2ed838f71a0 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/ColumnLimit100Test.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule44columnlimit; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ColumnLimit100Test extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule44columnlimit"; + } + + @Test + public void testLineLength() throws Exception { + verifyWithWholeConfig(getPath("InputColumnLimit.java")); + } + + @Test + public void testLineLengthFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedColumnLimit.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java deleted file mode 100644 index 0eafab9589d..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/LineLengthTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule44columnlimit; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck; - -public class LineLengthTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule44columnlimit"; - } - - @Test - public void testLineLength() throws Exception { - final String[] expected = { - "5: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 112), - "29: " + getCheckMessage(LineLengthCheck.class, "maxLineLen", 100, 113), - }; - - final Configuration checkConfig = getModuleConfig("LineLength"); - final String filePath = getPath("InputLineLength.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java deleted file mode 100644 index 304d15475ed..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/MethodParamPadTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck; - -public class MethodParamPadTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; - } - - @Test - public void testOperatorWrap() throws Exception { - final Class clazz = MethodParamPadCheck.class; - final String messageKeyPrevious = "line.previous"; - final String messageKeyPreceded = "ws.preceded"; - - final String[] expected = { - "83:9: " + getCheckMessage(clazz, messageKeyPrevious, "("), - "128:13: " + getCheckMessage(clazz, messageKeyPrevious, "("), - "130:9: " + getCheckMessage(clazz, messageKeyPrevious, "("), - "353:15: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "358:13: " + getCheckMessage(clazz, messageKeyPrevious, "("), - }; - final Configuration checkConfig = getModuleConfig("MethodParamPad"); - final String filePath = getPath("InputMethodParamPad.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java deleted file mode 100644 index 0b5d52d6840..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/OperatorWrapTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.OperatorWrapCheck; - -public class OperatorWrapTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; - } - - @Test - public void testOperatorWrap() throws Exception { - final Class clazz = OperatorWrapCheck.class; - final String messageKey = "line.new"; - - final String[] expected = { - "11:27: " + getCheckMessage(clazz, messageKey, "+"), - "12:28: " + getCheckMessage(clazz, messageKey, "-"), - "20:27: " + getCheckMessage(clazz, messageKey, "&&"), - "28:33: " + getCheckMessage(clazz, messageKey, "::"), - "43:35: " + getCheckMessage(clazz, messageKey, "&"), - "62:42: " + getCheckMessage(clazz, messageKey, "?"), - "66:27: " + getCheckMessage(clazz, messageKey, "!="), - "72:30: " + getCheckMessage(clazz, messageKey, "=="), - "78:27: " + getCheckMessage(clazz, messageKey, ">"), - "84:35: " + getCheckMessage(clazz, messageKey, "||"), - "107:46: " + getCheckMessage(clazz, messageKey, "?"), - "111:31: " + getCheckMessage(clazz, messageKey, "!="), - "117:34: " + getCheckMessage(clazz, messageKey, "=="), - "123:31: " + getCheckMessage(clazz, messageKey, ">"), - "129:39: " + getCheckMessage(clazz, messageKey, "||"), - "153:46: " + getCheckMessage(clazz, messageKey, "?"), - "157:31: " + getCheckMessage(clazz, messageKey, "!="), - "163:34: " + getCheckMessage(clazz, messageKey, "=="), - "169:31: " + getCheckMessage(clazz, messageKey, ">"), - "175:39: " + getCheckMessage(clazz, messageKey, "||"), - "194:38: " + getCheckMessage(clazz, messageKey, "?"), - }; - - final Configuration checkConfig = getModuleConfig("OperatorWrap"); - final String filePath = getPath("InputOperatorWrap.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java deleted file mode 100644 index fdf0505a81c..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/SeparatorWrapTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; - -import static com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck.MSG_LINE_NEW; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.SeparatorWrapCheck; - -public class SeparatorWrapTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; - } - - @Test - public void testSeparatorWrapDot() throws Exception { - final String[] expected = { - "28:30: " + getCheckMessage(SeparatorWrapCheck.class, "line.new", "."), - }; - - final Configuration checkConfig = getModuleConfig("SeparatorWrap", "SeparatorWrapDot"); - final String filePath = getPath("InputSeparatorWrap.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testSeparatorWrapComma() throws Exception { - final String[] expected = { - "31:17: " + getCheckMessage(SeparatorWrapCheck.class, "line.previous", ","), - }; - - final Configuration checkConfig = getModuleConfig("SeparatorWrap", "SeparatorWrapComma"); - final String filePath = getPath("InputSeparatorWrapComma.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testSeparatorWrapMethodRef() throws Exception { - final String[] expected = { - "17:49: " + getCheckMessage(SeparatorWrapCheck.class, MSG_LINE_NEW, "::"), - }; - - final Configuration checkConfig = getModuleConfig("SeparatorWrap", - "SeparatorWrapMethodRef"); - final String filePath = getPath("InputSeparatorWrapMethodRef.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testEllipsis() throws Exception { - final String[] expected = { - "11:13: " + getCheckMessage(SeparatorWrapCheck.class, "line.previous", "..."), - }; - - final Configuration checkConfig = getModuleConfig("SeparatorWrap", "SeparatorWrapEllipsis"); - final String filePath = getPath("InputSeparatorWrapEllipsis.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testArrayDeclarator() throws Exception { - final String[] expected = { - "9:13: " + getCheckMessage(SeparatorWrapCheck.class, "line.previous", "["), - }; - final Configuration checkConfig = getModuleConfig("SeparatorWrap", - "SeparatorWrapArrayDeclarator"); - final String filePath = getPath("InputSeparatorWrapArrayDeclarator.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/WhereToBreakTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/WhereToBreakTest.java new file mode 100644 index 00000000000..88e3cf6bb28 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/WhereToBreakTest.java @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class WhereToBreakTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule451wheretobreak"; + } + + @Test + public void testOperatorWrap() throws Exception { + verifyWithWholeConfig(getPath("InputOperatorWrap.java")); + } + + @Test + public void testOperatorWrapFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedOperatorWrap.java")); + } + + @Test + public void testMethodParamPad() throws Exception { + verifyWithWholeConfig(getPath("InputMethodParamPad.java")); + } + + @Test + public void testMethodParamPadFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedMethodParamPad.java")); + } + + @Test + public void testSeparatorWrapDot() throws Exception { + verifyWithWholeConfig(getPath("InputSeparatorWrap.java")); + } + + @Test + public void testSeparatorWrapDotFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedSeparatorWrap.java")); + } + + @Test + public void testSeparatorWrapComma() throws Exception { + verifyWithWholeConfig(getPath("InputSeparatorWrapComma.java")); + } + + @Test + public void testSeparatorWrapCommaFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedSeparatorWrapComma.java")); + } + + @Test + public void testSeparatorWrapMethodRef() throws Exception { + verifyWithWholeConfig(getPath("InputSeparatorWrapMethodRef.java")); + } + + @Test + public void testSeparatorWrapMethodRefFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedSeparatorWrapMethodRef.java")); + } + + @Test + public void testEllipsis() throws Exception { + verifyWithWholeConfig(getPath("InputSeparatorWrapEllipsis.java")); + } + + @Test + public void testEllipsisFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedSeparatorWrapEllipsis.java")); + } + + @Test + public void testArrayDeclarator() throws Exception { + verifyWithWholeConfig(getPath("InputSeparatorWrapArrayDeclarator.java")); + } + + @Test + public void testArrayDeclaratorFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedSeparatorWrapArrayDeclarator.java")); + } + + @Test + public void testLambdaBodyWrap() throws Exception { + verifyWithWholeConfig(getPath("InputLambdaBodyWrap.java")); + } + + @Test + public void testLambdaBodyWrapFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedLambdaBodyWrap.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/IndentContinuationLinesAtLeast4SpacesTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/IndentContinuationLinesAtLeast4SpacesTest.java new file mode 100644 index 00000000000..eea51f1ab4d --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/IndentContinuationLinesAtLeast4SpacesTest.java @@ -0,0 +1,92 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractIndentationTestSupport; + +public class IndentContinuationLinesAtLeast4SpacesTest extends AbstractIndentationTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines"; + } + + @Test + public void testCorrectClass() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectClass.java")); + } + + @Test + public void testCorrectField() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectFieldAndParameter.java")); + } + + @Test + public void testCorrectFor() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectForAndParameter.java")); + } + + @Test + public void testCorrectIf() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectIfAndParameter.java")); + } + + @Test + public void testCorrectNewKeyword() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectNewChildren.java")); + } + + @Test + public void testCorrect() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrect.java")); + } + + @Test + public void testCorrectReturn() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectReturnAndParameter.java")); + } + + @Test + public void testCorrectWhile() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectWhileDoWhileAndParameter.java")); + } + + @Test + public void testCorrectChained() throws Exception { + verifyWithWholeConfig(getPath("ClassWithChainedMethodsCorrect.java")); + } + + @Test + public void testWarnChained() throws Exception { + verifyWithWholeConfig(getPath("ClassWithChainedMethods.java")); + } + + @Test + public void testCorrectAnnotationArrayInit() throws Exception { + verifyWithWholeConfig(getPath("InputIndentationCorrectAnnotationArrayInit.java")); + } + + @Test + public void testFastMatcher() throws Exception { + verifyWithWholeConfig(getPath("InputFastMatcher.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java deleted file mode 100644 index db402357298..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/EmptyLineSeparatorTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyLineSeparatorCheck; - -public class EmptyLineSeparatorTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace"; - } - - @Test - public void testEmptyLineSeparator() throws Exception { - final Class clazz = EmptyLineSeparatorCheck.class; - final String messageKey = "empty.line.separator"; - - final String[] expected = { - "19:1: " + getCheckMessage(clazz, messageKey, "package"), - "20:1: " + getCheckMessage(clazz, messageKey, "import"), - "33:1: " + getCheckMessage(clazz, messageKey, "CLASS_DEF"), - "37:5: " + getCheckMessage(clazz, messageKey, "STATIC_INIT"), - "66:5: " + getCheckMessage(clazz, messageKey, "METHOD_DEF"), - "75:5: " + getCheckMessage(clazz, messageKey, "INTERFACE_DEF"), - "82:9: " + getCheckMessage(clazz, messageKey, "INSTANCE_INIT"), - "113:1: " + getCheckMessage(clazz, messageKey, "CLASS_DEF"), - "119:5: " + getCheckMessage(clazz, messageKey, "VARIABLE_DEF"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyLineSeparator"); - final String filePath = getPath("InputEmptyLineSeparator.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/VerticalWhitespaceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/VerticalWhitespaceTest.java new file mode 100644 index 00000000000..4090ddae371 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/VerticalWhitespaceTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class VerticalWhitespaceTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace"; + } + + @Test + public void testEmptyLineSeparator() throws Exception { + verifyWithWholeConfig(getPath("InputVerticalWhitespace.java")); + } + + @Test + public void testEmptyLineSeparatorFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedVerticalWhitespace.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java deleted file mode 100644 index 5a369793745..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/GenericWhitespaceTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class GenericWhitespaceTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void testWhitespaceAroundGenerics() throws Exception { - final String msgPreceded = "ws.preceded"; - final String msgFollowed = "ws.followed"; - final Configuration checkConfig = getModuleConfig("GenericWhitespace"); - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "12:17: " + getCheckMessage(messages, msgFollowed, "<"), - "12:17: " + getCheckMessage(messages, msgPreceded, "<"), - "12:37: " + getCheckMessage(messages, msgFollowed, "<"), - "12:37: " + getCheckMessage(messages, msgPreceded, "<"), - "12:48: " + getCheckMessage(messages, msgFollowed, ">"), - "12:48: " + getCheckMessage(messages, msgPreceded, ">"), - "12:50: " + getCheckMessage(messages, msgPreceded, ">"), - "14:33: " + getCheckMessage(messages, msgFollowed, "<"), - "14:33: " + getCheckMessage(messages, msgPreceded, "<"), - "14:46: " + getCheckMessage(messages, msgPreceded, ">"), - "15:33: " + getCheckMessage(messages, msgFollowed, "<"), - "15:33: " + getCheckMessage(messages, msgPreceded, "<"), - "15:46: " + getCheckMessage(messages, msgPreceded, ">"), - "20:39: " + getCheckMessage(messages, msgFollowed, "<"), - "20:39: " + getCheckMessage(messages, msgPreceded, "<"), - "20:62: " + getCheckMessage(messages, msgPreceded, ">"), - }; - - final String filePath = getPath("InputWhitespaceAroundGenerics.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testGenericWhitespace() throws Exception { - final String msgPreceded = "ws.preceded"; - final String msgFollowed = "ws.followed"; - final String msgNotPreceded = "ws.notPreceded"; - final String msgIllegalFollow = "ws.illegalFollow"; - final Configuration checkConfig = getModuleConfig("GenericWhitespace"); - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "16:14: " + getCheckMessage(messages, msgFollowed, "<"), - "16:14: " + getCheckMessage(messages, msgPreceded, "<"), - "16:24: " + getCheckMessage(messages, msgPreceded, ">"), - "16:44: " + getCheckMessage(messages, msgFollowed, "<"), - "16:44: " + getCheckMessage(messages, msgPreceded, "<"), - "16:54: " + getCheckMessage(messages, msgPreceded, ">"), - "17:14: " + getCheckMessage(messages, msgFollowed, "<"), - "17:14: " + getCheckMessage(messages, msgPreceded, "<"), - "17:21: " + getCheckMessage(messages, msgFollowed, "<"), - "17:21: " + getCheckMessage(messages, msgPreceded, "<"), - "17:31: " + getCheckMessage(messages, msgFollowed, ">"), - "17:31: " + getCheckMessage(messages, msgPreceded, ">"), - "17:33: " + getCheckMessage(messages, msgPreceded, ">"), - "17:53: " + getCheckMessage(messages, msgFollowed, "<"), - "17:53: " + getCheckMessage(messages, msgPreceded, "<"), - "17:60: " + getCheckMessage(messages, msgFollowed, "<"), - "17:60: " + getCheckMessage(messages, msgPreceded, "<"), - "17:70: " + getCheckMessage(messages, msgFollowed, ">"), - "17:70: " + getCheckMessage(messages, msgPreceded, ">"), - "17:72: " + getCheckMessage(messages, msgPreceded, ">"), - "30:18: " + getCheckMessage(messages, msgNotPreceded, "<"), - "30:20: " + getCheckMessage(messages, msgIllegalFollow, ">"), - "42:22: " + getCheckMessage(messages, msgPreceded, "<"), - "42:29: " + getCheckMessage(messages, msgFollowed, ">"), - "60:59: " + getCheckMessage(messages, msgNotPreceded, "&"), - "63:59: " + getCheckMessage(messages, msgFollowed, ">"), - }; - - final String filePath = getPath("InputGenericWhitespace.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void genericEndsTheLine() throws Exception { - final Configuration checkConfig = getModuleConfig("GenericWhitespace"); - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - verify(checkConfig, getPath("InputGenericWhitespaceEndsTheLine.java"), - expected); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/HorizontalWhitespaceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/HorizontalWhitespaceTest.java new file mode 100644 index 00000000000..73041da755a --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/HorizontalWhitespaceTest.java @@ -0,0 +1,172 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class HorizontalWhitespaceTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; + } + + @Test + public void testWhitespaceAroundBasic() throws Exception { + verifyWithWholeConfig(getPath("InputWhitespaceAroundBasic.java")); + } + + @Test + public void testWhitespaceAroundBasicFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedWhitespaceAroundBasic.java")); + } + + @Test + public void testWhitespaceAroundEmptyTypesCycles() throws Exception { + verifyWithWholeConfig(getPath("InputWhitespaceAroundEmptyTypesAndCycles.java")); + } + + @Test + public void testWhitespaceAroundEmptyTypesCyclesFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedWhitespaceAroundEmptyTypesAndCycles.java")); + } + + @Test + public void testWhitespaceAfterBad() throws Exception { + verifyWithWholeConfig(getPath("InputWhitespaceAfterBad.java")); + } + + @Test + public void testWhitespaceAfterBadFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedWhitespaceAfterBad.java")); + } + + @Test + public void testWhitespaceAfterGood() throws Exception { + verifyWithWholeConfig(getPath("InputWhitespaceAfterGood.java")); + } + + @Test + public void testWhitespaceAfterGoodFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedWhitespaceAfterGood.java")); + } + + @Test + public void testParenPad() throws Exception { + verifyWithWholeConfig(getPath("InputParenPad.java")); + } + + @Test + public void testParenPadFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedParenPad.java")); + } + + @Test + public void testNoWhitespaceBeforeEmptyForLoop() throws Exception { + verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeEmptyForLoop.java")); + } + + @Test + public void testNoWhitespaceBeforeEmptyForLoopFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeEmptyForLoop.java")); + } + + @Test + public void testNoWhitespaceBeforeColonOfLabel() throws Exception { + verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeColonOfLabel.java")); + } + + @Test + public void testNoWhitespaceBeforeColonOfLabelFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeColonOfLabel.java")); + } + + @Test + public void testNoWhitespaceBeforeAnnotations() throws Exception { + verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeAnnotations.java")); + } + + @Test + public void testNoWhitespaceBeforeAnnotationsFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeAnnotations.java")); + } + + @Test + public void testNoWhitespaceBeforeCaseDefaultColon() throws Exception { + verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeCaseDefaultColon.java")); + } + + @Test + public void testNoWhitespaceBeforeCaseDefaultColonFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeCaseDefaultColon.java")); + } + + @Test + public void testMethodParamPad() throws Exception { + verifyWithWholeConfig(getPath("InputMethodParamPad.java")); + } + + @Test + public void testMethodParamPadFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedMethodParamPad.java")); + } + + @Test + public void testWhitespaceAroundGenerics() throws Exception { + verifyWithWholeConfig(getPath("InputWhitespaceAroundGenerics.java")); + } + + @Test + public void testWhitespaceAroundGenericsFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedWhitespaceAroundGenerics.java")); + } + + @Test + public void testGenericWhitespace() throws Exception { + verifyWithWholeConfig(getPath("InputGenericWhitespace.java")); + } + + @Test + public void testGenericWhitespaceFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedGenericWhitespace.java")); + } + + @Test + public void genericEndsTheLine() throws Exception { + verifyWithWholeConfig(getPath("InputGenericWhitespaceEndsTheLine.java")); + } + + @Test + public void genericEndsTheLineFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedGenericWhitespaceEndsTheLine.java")); + } + + @Test + public void testWhitespaceAroundWhen() throws Exception { + verifyWithWholeConfig(getNonCompilablePath("InputWhitespaceAroundWhen.java")); + } + + @Test + public void testWhitespaceAroundWhenFormatted() throws Exception { + verifyWithWholeConfig(getNonCompilablePath("InputFormattedWhitespaceAroundWhen.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java deleted file mode 100644 index 0476a578fb6..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/MethodParamPadTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck; - -public class MethodParamPadTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void testOperatorWrap() throws Exception { - final Class clazz = MethodParamPadCheck.class; - final String messageKeyPreceded = "ws.preceded"; - - final String[] expected = { - "11:32: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "13:15: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "20:24: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "29:39: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "35:16: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "41:21: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "47:18: " + getCheckMessage(clazz, messageKeyPreceded, "("), - "52:36: " + getCheckMessage(clazz, messageKeyPreceded, "("), - }; - final Configuration checkConfig = getModuleConfig("MethodParamPad"); - final String filePath = getPath("InputMethodParamPad.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeCaseDefaultColonTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeCaseDefaultColonTest.java deleted file mode 100644 index 04c134293c0..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeCaseDefaultColonTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck; - -public class NoWhitespaceBeforeCaseDefaultColonTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void test() throws Exception { - final Class clazz = NoWhitespaceBeforeCheck.class; - final String messageKeyPreceded = "ws.preceded"; - - final String[] expected = { - "6:20: " + getCheckMessage(clazz, messageKeyPreceded, ":"), - "10:21: " + getCheckMessage(clazz, messageKeyPreceded, ":"), - }; - final Configuration checkConfig = getModuleConfig("NoWhitespaceBeforeCaseDefaultColon"); - final String filePath = getPath("InputNoWhitespaceBeforeCaseDefaultColon.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} - diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeTest.java deleted file mode 100644 index 254d94f4ac8..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/NoWhitespaceBeforeTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.NoWhitespaceBeforeCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class NoWhitespaceBeforeTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void testEmptyForLoop() throws Exception { - final Class clazz = NoWhitespaceBeforeCheck.class; - final String messageKeyPreceded = "ws.preceded"; - - final String[] expected = { - "12:24: " + getCheckMessage(clazz, messageKeyPreceded, ";"), - "18:32: " + getCheckMessage(clazz, messageKeyPreceded, ";"), - }; - final Configuration checkConfig = getModuleConfig("NoWhitespaceBefore"); - final String filePath = getPath("InputNoWhitespaceBeforeEmptyForLoop.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testColonOfLabel() throws Exception { - final Class clazz = NoWhitespaceBeforeCheck.class; - final String messageKeyPreceded = "ws.preceded"; - - final String[] expected = { - "6:16: " + getCheckMessage(clazz, messageKeyPreceded, ":"), - }; - final Configuration checkConfig = getModuleConfig("NoWhitespaceBefore"); - final String filePath = getPath("InputNoWhitespaceBeforeColonOfLabel.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testAnnotations() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - final Configuration checkConfig = getModuleConfig("NoWhitespaceBefore"); - final String filePath = getPath("InputNoWhitespaceBeforeAnnotations.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} - diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java deleted file mode 100644 index 50f241fd2b7..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/ParenPadTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.ParenPadCheck; - -public class ParenPadTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void testMethodParen() throws Exception { - final Class clazz = ParenPadCheck.class; - final String messageKeyPreceded = "ws.preceded"; - final String messageKeyFollowed = "ws.followed"; - - final String[] expected = { - "44:26: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "44:28: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "45:17: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "48:26: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "49:18: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "49:20: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "52:26: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "53:20: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "54:17: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "54:51: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "54:53: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "57:25: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "58:21: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "59:23: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "60:25: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "60:50: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "60:56: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "61:28: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "62:42: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "63:40: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "65:42: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "78:27: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "78:29: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "79:20: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "82:34: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "83:18: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "83:20: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "86:30: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "87:36: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "88:50: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "88:52: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "88:54: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "90:39: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "91:33: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "92:36: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "93:31: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "94:61: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "94:63: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "94:70: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "95:35: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "96:48: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "97:43: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "99:45: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "112:16: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "113:22: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "113:24: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "113:32: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "114:25: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "114:27: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "114:35: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "114:51: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "115:25: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "115:27: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "115:36: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "115:54: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "115:56: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "119:16: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "119:23: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "123:29: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "123:45: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "126:21: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "126:23: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "130:18: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "130:20: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "139:9: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "139:21: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "145:32: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "145:47: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "153:33: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "154:49: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "155:35: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "155:47: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "159:25: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "159:36: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "160:12: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "160:28: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "160:49: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "160:51: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "163:31: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "163:36: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "163:47: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "163:61: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "166:40: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "167:24: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "167:51: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "173:37: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "174:49: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "175:20: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "175:49: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "185:16: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "185:36: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "186:19: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "186:39: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "190:29: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "190:45: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "191:12: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "191:39: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "192:22: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "192:40: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "200:80: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "200:84: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "201:20: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "202:24: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "203:20: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "203:25: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "206:13: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "206:23: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "206:31: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "207:17: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "207:47: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "210:36: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "210:73: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "210:81: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "210:83: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "211:36: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "212:48: " + getCheckMessage(clazz, messageKeyFollowed, "("), - "212:52: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "212:54: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "220:37: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - "221:61: " + getCheckMessage(clazz, messageKeyPreceded, ")"), - }; - final Configuration checkConfig = getModuleConfig("ParenPad"); - final String filePath = getPath("InputParenPad.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAfterTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAfterTest.java deleted file mode 100644 index 54904778b57..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAfterTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.whitespace.WhitespaceAfterCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class WhitespaceAfterTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void testWhitespaceAfterBad() throws Exception { - final Class clazz = WhitespaceAfterCheck.class; - final String message = "ws.notFollowed"; - - final String[] expected = { - "4:29: " + getCheckMessage(clazz, message, ","), - "5:9: " + getCheckMessage(clazz, message, "for"), - "5:20: " + getCheckMessage(clazz, message, ","), - "5:24: " + getCheckMessage(clazz, message, ";"), - "5:28: " + getCheckMessage(clazz, message, ";"), - "5:32: " + getCheckMessage(clazz, message, ","), - "6:9: " + getCheckMessage(clazz, message, "while"), - "7:20: " + getCheckMessage(clazz, message, ","), - "9:9: " + getCheckMessage(clazz, message, "do"), - "11:10: " + getCheckMessage(clazz, message, "while"), - "13:35: " + getCheckMessage(clazz, message, ","), - "14:9: " + getCheckMessage(clazz, message, "if"), - "14:18: " + getCheckMessage(clazz, message, "typecast"), - "17:9: " + getCheckMessage(clazz, message, "else"), - "22:28: " + getCheckMessage(clazz, message, "..."), - "23:26: " + getCheckMessage(clazz, message, "->"), - "24:9: " + getCheckMessage(clazz, message, "switch"), - "31:9: " + getCheckMessage(clazz, message, "try"), - "35:16: " + getCheckMessage(clazz, message, "finally"), - "36:38: " + getCheckMessage(clazz, message, "finally"), - "40:16: " + getCheckMessage(clazz, message, "catch"), - "44:9: " + getCheckMessage(clazz, message, "synchronized"), - "49:9: " + getCheckMessage(clazz, message, "return"), - }; - final Configuration checkConfig = getModuleConfig("WhitespaceAfter"); - final String filePath = getPath("InputWhitespaceAfterBad.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testWhitespaceAfterGood() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - final Configuration checkConfig = getModuleConfig("WhitespaceAfter"); - final String filePath = getPath("InputWhitespaceAfterGood.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java deleted file mode 100644 index eede67bf966..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/WhitespaceAroundTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class WhitespaceAroundTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace"; - } - - @Test - public void testWhitespaceAroundBasic() throws Exception { - final Configuration checkConfig = getModuleConfig("WhitespaceAround"); - final String msgPreceded = "ws.notPreceded"; - final String msgFollowed = "ws.notFollowed"; - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "10:22: " + getCheckMessage(messages, msgPreceded, "="), - "12:23: " + getCheckMessage(messages, msgFollowed, "="), - "20:14: " + getCheckMessage(messages, msgPreceded, "="), - "21:10: " + getCheckMessage(messages, msgPreceded, "="), - "22:11: " + getCheckMessage(messages, msgFollowed, "+="), - "23:11: " + getCheckMessage(messages, msgFollowed, "-="), - "31:9: " + getCheckMessage(messages, msgFollowed, "synchronized"), - "33:13: " + getCheckMessage(messages, msgFollowed, "{"), - "35:36: " + getCheckMessage(messages, msgFollowed, "{"), - "52:9: " + getCheckMessage(messages, msgFollowed, "if"), - "70:13: " + getCheckMessage(messages, msgFollowed, "return"), - "92:24: " + getCheckMessage(messages, msgFollowed, "=="), - "98:22: " + getCheckMessage(messages, msgPreceded, "*"), - "113:18: " + getCheckMessage(messages, msgPreceded, "%"), - "114:19: " + getCheckMessage(messages, msgFollowed, "%"), - "115:18: " + getCheckMessage(messages, msgPreceded, "%"), - "117:18: " + getCheckMessage(messages, msgPreceded, "/"), - "118:19: " + getCheckMessage(messages, msgFollowed, "/"), - "147:9: " + getCheckMessage(messages, msgFollowed, "assert"), - "150:20: " + getCheckMessage(messages, msgPreceded, ":"), - "241:19: " + getCheckMessage(messages, msgFollowed, ":"), - "241:19: " + getCheckMessage(messages, msgPreceded, ":"), - "242:20: " + getCheckMessage(messages, msgFollowed, ":"), - "243:19: " + getCheckMessage(messages, msgPreceded, ":"), - "257:14: " + getCheckMessage(messages, msgPreceded, "->"), - "258:15: " + getCheckMessage(messages, msgFollowed, "->"), - }; - - final String filePath = getPath("InputWhitespaceAroundBasic.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testWhitespaceAroundEmptyTypesCycles() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("WhitespaceAround"); - final String filePath = getPath("InputWhitespaceAroundEmptyTypesAndCycles.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java deleted file mode 100644 index 9775197fdd5..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/MultipleVariableDeclarationsTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule4821onevariableperline; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck; - -public class MultipleVariableDeclarationsTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline"; - } - - @Test - public void testMultipleVariableDeclarations() throws Exception { - final String msgComma = getCheckMessage(MultipleVariableDeclarationsCheck.class, - "multiple.variable.declarations.comma"); - final String msg = getCheckMessage(MultipleVariableDeclarationsCheck.class, - "multiple.variable.declarations"); - - final String[] expected = { - "5:5: " + msgComma, - "6:5: " + msg, - "9:9: " + msgComma, - "10:9: " + msg, - "14:5: " + msg, - "17:5: " + msg, - "31:9: " + msgComma, - "32:9: " + msg, - "35:13: " + msgComma, - "36:13: " + msg, - "40:9: " + msg, - "43:9: " + msg, - "57:13: " + msgComma, - "58:13: " + msg, - "61:17: " + msgComma, - "62:17: " + msg, - "66:13: " + msg, - "69:13: " + msg, - "86:5: " + msgComma, - "89:5: " + msgComma, - }; - - final Configuration checkConfig = getModuleConfig("MultipleVariableDeclarations"); - final String filePath = getPath("InputMultipleVariableDeclarations.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/OneVariablePerDeclarationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/OneVariablePerDeclarationTest.java new file mode 100644 index 00000000000..38ea2369fc3 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/OneVariablePerDeclarationTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4821onevariableperline; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class OneVariablePerDeclarationTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline"; + } + + @Test + public void testMultipleVariableDeclarations() throws Exception { + verifyWithWholeConfig(getPath("InputOneVariablePerDeclaration.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/DeclaredWhenNeededTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/DeclaredWhenNeededTest.java new file mode 100644 index 00000000000..d02e69fff7b --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/DeclaredWhenNeededTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4822declaredwhenneeded; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class DeclaredWhenNeededTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded"; + } + + @Test + public void testVariableDeclarationUsageDistance() throws Exception { + verifyWithWholeConfig(getPath("InputDeclaredWhenNeeded.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java deleted file mode 100644 index 777c5699c2c..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/VariableDeclarationUsageDistanceTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule4822variabledistance; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.VariableDeclarationUsageDistanceCheck; - -public class VariableDeclarationUsageDistanceTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule4822variabledistance"; - } - - @Test - public void testArrayTypeStyle() throws Exception { - final String msgExt = "variable.declaration.usage.distance.extend"; - final Class clazz = - VariableDeclarationUsageDistanceCheck.class; - - final String[] expected = { - "71:9: " + getCheckMessage(clazz, msgExt, "count", 4, 3), - "219:9: " + getCheckMessage(clazz, msgExt, "t", 5, 3), - "483:9: " + getCheckMessage(clazz, msgExt, "myOption", 7, 3), - "495:9: " + getCheckMessage(clazz, msgExt, "myOption", 6, 3), - }; - - final Configuration checkConfig = - getModuleConfig("VariableDeclarationUsageDistance"); - final String filePath = getPath("InputVariableDeclarationUsageDistanceCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java deleted file mode 100644 index a93e3e9e50f..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/ArrayTypeStyleTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule4832nocstylearray; - -import static com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck.MSG_KEY; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.ArrayTypeStyleCheck; - -public class ArrayTypeStyleTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray"; - } - - @Test - public void testArrayTypeStyle() throws Exception { - final String[] expected = { - "9:23: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "15:44: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "21:20: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "22:19: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "22:21: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "22:23: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "41:33: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "46:34: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "46:36: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "52:27: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "62:16: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "63:15: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "63:17: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - "63:19: " + getCheckMessage(ArrayTypeStyleCheck.class, MSG_KEY), - }; - - final Configuration checkConfig = getModuleConfig("ArrayTypeStyle"); - final String filePath = getPath("InputArrayTypeStyle.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/NoCstyleArrayDeclarationsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/NoCstyleArrayDeclarationsTest.java new file mode 100644 index 00000000000..52551662944 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray/NoCstyleArrayDeclarationsTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4832nocstylearray; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NoCstyleArrayDeclarationsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4832nocstylearray"; + } + + @Test + public void testArrayTypeStyle() throws Exception { + verifyWithWholeConfig(getPath("InputNoCstyleArrays.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java index 350dd5b536a..d4d080fc2a6 100644 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4841indentation/IndentationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,15 +19,9 @@ package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -import static com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck.MSG_CHILD_ERROR; -import static com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck.MSG_ERROR; - import org.junit.jupiter.api.Test; import com.google.checkstyle.test.base.AbstractIndentationTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; public class IndentationTest extends AbstractIndentationTestSupport { @@ -38,129 +32,61 @@ protected String getPackageLocation() { @Test public void testCorrectClass() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectClass.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectClass.java")); } @Test public void testCorrectField() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectFieldAndParameter.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectFieldAndParameter.java")); } @Test public void testCorrectFor() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectForAndParameter.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectForAndParameter.java")); } @Test public void testCorrectIf() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectIfAndParameter.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectIfAndParameter.java")); } @Test public void testCorrectNewKeyword() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectNewChildren.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectNewChildren.java")); } @Test public void testCorrect() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrect.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrect.java")); } @Test public void testCorrectReturn() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectReturnAndParameter.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectReturnAndParameter.java")); } @Test public void testCorrectWhile() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectWhileDoWhileAndParameter.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectWhileDoWhileAndParameter.java")); } @Test public void testCorrectChained() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("ClassWithChainedMethodsCorrect.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("ClassWithChainedMethodsCorrect.java")); } @Test public void testWarnChained() throws Exception { - final String[] expected = { - "18:5: " + getCheckMessage(IndentationCheck.class, - MSG_CHILD_ERROR, "method call", 4, 8), - "23:5: " + getCheckMessage(IndentationCheck.class, MSG_ERROR, ".", 4, 8), - "24:5: " + getCheckMessage(IndentationCheck.class, MSG_ERROR, ".", 4, 8), - "27:5: " + getCheckMessage(IndentationCheck.class, MSG_ERROR, "new", 4, 8), - }; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("ClassWithChainedMethods.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("ClassWithChainedMethods.java")); } @Test public void testCorrectAnnotationArrayInit() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("Indentation"); - final String filePath = getPath("InputIndentationCorrectAnnotationArrayInit.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); + verifyWithWholeConfig(getPath("InputIndentationCorrectAnnotationArrayInit.java")); } + @Test + public void testFastMatcher() throws Exception { + verifyWithWholeConfig(getPath("InputFastMatcher.java")); + } } diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughCommentedTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughCommentedTest.java new file mode 100644 index 00000000000..0f85064323f --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughCommentedTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4842fallthrough; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class FallThroughCommentedTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4842fallthrough"; + } + + @Test + public void testFallThrough() throws Exception { + verifyWithWholeConfig(getPath("InputFallThrough.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java deleted file mode 100644 index e89cee33826..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/FallThroughTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule4842fallthrough; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.FallThroughCheck; - -public class FallThroughTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule4842fallthrough"; - } - - @Test - public void testFallThrough() throws Exception { - final String msg = getCheckMessage(FallThroughCheck.class, "fall.through"); - - final String[] expected = { - "14:13: " + msg, - "38:13: " + msg, - "47:13: " + msg, - "53:13: " + msg, - "70:13: " + msg, - "87:13: " + msg, - "123:13: " + msg, - "179:11: " + msg, - "369:11: " + msg, - "372:11: " + msg, - "374:41: " + msg, - "440:15: " + msg, - "442:15: " + msg, - "444:15: " + msg, - "446:15: " + msg, - "448:15: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("FallThrough"); - final String filePath = getPath("InputFallThrough.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java deleted file mode 100644 index bbf5760986b..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/MissingSwitchDefaultTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule4843defaultcasepresent; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.MissingSwitchDefaultCheck; - -public class MissingSwitchDefaultTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent"; - } - - @Test - public void testMissingSwitchDefault() throws Exception { - final String msg = getCheckMessage(MissingSwitchDefaultCheck.class, - "missing.switch.default"); - - final String[] expected = { - "11:9: " + msg, - "19:9: " + msg, - "23:9: " + msg, - "31:13: " + msg, - "38:21: " + msg, - "42:21: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("MissingSwitchDefault"); - final String filePath = getPath("InputMissingSwitchDefault.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence/PresenceOfTheDefaultLabelTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence/PresenceOfTheDefaultLabelTest.java new file mode 100644 index 00000000000..ab95e3fc5de --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence/PresenceOfTheDefaultLabelTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4843defaultlabelpresence; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class PresenceOfTheDefaultLabelTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence"; + } + + @Test + public void testPresenceOfDefaultLabel() throws Exception { + verifyWithWholeConfig(getPath("InputPresenceOfDefaultLabel.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/ClassAnnotationsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/ClassAnnotationsTest.java new file mode 100644 index 00000000000..ca9836aab3c --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/ClassAnnotationsTest.java @@ -0,0 +1,44 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4852classannotations; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ClassAnnotationsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4852classannotations"; + } + + @Test + public void testAnnotation() throws Exception { + final String filePath = getPath("InputClassAnnotations.java"); + verifyWithWholeConfig(filePath); + } + + @Test + public void testAnnotationFormatted() throws Exception { + final String filePath = getPath("InputFormattedClassAnnotations.java"); + verifyWithWholeConfig(filePath); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/MethodsAndConstructorsAnnotationsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/MethodsAndConstructorsAnnotationsTest.java new file mode 100644 index 00000000000..8e2eefe370c --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/MethodsAndConstructorsAnnotationsTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4853methodsandconstructorsannotations; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class MethodsAndConstructorsAnnotationsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/" + + "rule4853methodsandconstructorsannotations"; + } + + @Test + public void testAnnotation() throws Exception { + verifyWithWholeConfig(getPath("InputMethodsAndConstructorsAnnotations.java")); + } + + @Test + public void testAnnotationFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedMethodsAndConstructorsAnnotations.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/FieldAnnotationsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/FieldAnnotationsTest.java new file mode 100644 index 00000000000..1e5cd3c16f3 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/FieldAnnotationsTest.java @@ -0,0 +1,41 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4854fieldannotations; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class FieldAnnotationsTest extends AbstractGoogleModuleTestSupport { + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations"; + } + + @Test + public void testAnnotations() throws Exception { + verifyWithWholeConfig(getPath("InputFieldAnnotations.java")); + } + + @Test + public void testAnnotationsFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedFieldAnnotations.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java deleted file mode 100644 index 3d050947f69..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule485annotations/AnnotationLocationTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule485annotations; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck; - -public class AnnotationLocationTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule485annotations"; - } - - @Test - public void testAnnotation() throws Exception { - final Class clazz = AnnotationLocationCheck.class; - getCheckMessage(clazz, "annotation.location.alone"); - final Configuration checkConfig = getModuleConfig("AnnotationLocation", - "AnnotationLocationMostCases"); - - final String msgLocationAlone = "annotation.location.alone"; - final String msgLocation = "annotation.location"; - final String[] expected = { - "3:16: " + getCheckMessage(clazz, msgLocationAlone, "MyAnnotation1"), - "20:9: " + getCheckMessage(clazz, msgLocation, "MyAnnotation1", "8", "4"), - "27:8: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "7", "4"), - "31:9: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "8", "4"), - "32:7: " + getCheckMessage(clazz, msgLocation, "MyAnnotation3", "6", "4"), - "33:11: " + getCheckMessage(clazz, msgLocation, "MyAnnotation4", "10", "4"), - "54:13: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "12", "8"), - "58:13: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "12", "8"), - "78:12: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "11", "8"), - "81:11: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "10", "8"), - "90:2: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "1", "0"), - "93:1: " + getCheckMessage(clazz, msgLocationAlone, "MyAnnotationWithParam"), - }; - - final String filePath = getPath("InputAnnotationLocation.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testAnnotationVariables() throws Exception { - final Class clazz = AnnotationLocationCheck.class; - getCheckMessage(clazz, "annotation.location.alone"); - final Configuration checkConfig = getModuleConfig("AnnotationLocation", - "AnnotationLocationVariables"); - - final String msgLocation = "annotation.location"; - final String[] expected = { - "63:8: " + getCheckMessage(clazz, msgLocation, "MyAnnotation2", "7", "4"), - }; - - final String filePath = getPath("InputAnnotationLocationVariables.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/BlockCommentStyleTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/BlockCommentStyleTest.java new file mode 100644 index 00000000000..10234dd46e7 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/BlockCommentStyleTest.java @@ -0,0 +1,74 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class BlockCommentStyleTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle"; + } + + @Test + public void testCommentIsAtTheEndOfBlock() throws Exception { + verifyWithWholeConfig(getPath("InputCommentsIndentationCommentIsAtTheEndOfBlock.java")); + } + + @Test + public void testCommentIsAtTheEndOfBlockFormatted() throws Exception { + verifyWithWholeConfig( + getPath("InputFormattedCommentsIndentationCommentIsAtTheEndOfBlock.java")); + } + + @Test + public void testCommentIsInsideSwitchBlock() throws Exception { + verifyWithWholeConfig(getPath("InputCommentsIndentationInSwitchBlock.java")); + } + + @Test + public void testCommentIsInsideSwitchBlockFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedCommentsIndentationInSwitchBlock.java")); + } + + @Test + public void testCommentIsInsideEmptyBlock() throws Exception { + verifyWithWholeConfig(getPath("InputCommentsIndentationInEmptyBlock.java")); + } + + @Test + public void testCommentIsInsideEmptyBlockFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedCommentsIndentationInEmptyBlock.java")); + } + + @Test + public void testSurroundingCode() throws Exception { + verifyWithWholeConfig(getPath("InputCommentsIndentationSurroundingCode.java")); + } + + @Test + public void testSurroundingCodeFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedCommentsIndentationSurroundingCode.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java deleted file mode 100644 index 4b83c054247..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/CommentsIndentationTest.java +++ /dev/null @@ -1,203 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.indentation.CommentsIndentationCheck; - -public class CommentsIndentationTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle"; - } - - @Test - public void testCommentIsAtTheEndOfBlock() throws Exception { - final String[] expected = { - "18:26: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 17, 25, 8), - "33:6: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 35, 5, 4), - "37:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 36, 0, 8), - "47:16: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 46, 15, 12), - "49:11: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 45, 10, 8), - "54:14: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 53, 13, 8), - "74:19: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 70, 18, 8), - "88:32: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 85, 31, 8), - "100:22: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 98, 21, 8), - "115:30: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 116, 29, 12), - "138:27: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 131, 26, 8), - "164:34: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 161, 33, 8), - "174:22: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 173, 21, 8), - "186:35: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 184, 34, 8), - "208:27: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 206, 26, 8), - "214:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 213, 0, 8), - "228:13: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 225, 12, 8), - "234:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 233, 0, 8), - "248:13: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 245, 12, 8), - "255:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 252, 0, 8), - "265:15: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 264, 14, 8), - "271:10: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 269, 9, 8), - "277:10: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 276, 9, 8), - "316:10: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 315, 9, 8), - "322:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 323, 0, 4), - "336:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 333, 0, 8), - "355:10: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 352, 9, 8), - }; - - final Configuration checkConfig = getModuleConfig("CommentsIndentation"); - final String filePath = - getPath("InputCommentsIndentationCommentIsAtTheEndOfBlock.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCommentIsInsideSwitchBlock() throws Exception { - final String[] expected = { - "19:13: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.block", 20, 12, 16), - "25:20: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "24, 26", 19, "16, 12"), - "31:20: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "30, 32", 19, "16, 12"), - "48:7: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 49, 6, 16), - "55:9: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 56, 8, 12), - "59:23: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 58, 22, 16), - "68:15: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "65, 69", 14, "12, 16"), - "88:25: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 89, 24, 20), - "113:16: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "112, 114", 15, "17, 12"), - "125:9: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 126, 8, 12), - "138:5: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 139, 4, 8), - "157:19: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "156, 158", 18, "16, 12"), - "200:5: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "199, 201", 4, "12, 12"), - "203:23: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "202, 206", 22, "16, 12"), - "204:21: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "202, 206", 20, "16, 12"), - "205:18: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "202, 206", 17, "16, 12"), - "229:7: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", "228, 230", 6, "12, 12"), - }; - - final Configuration checkConfig = getModuleConfig("CommentsIndentation"); - final String filePath = - getPath("InputCommentsIndentationInSwitchBlock.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCommentIsInsideEmptyBlock() throws Exception { - final String[] expected = { - "9:20: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 12, 19, 31), - "10:24: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.block", 12, 23, 31), - "33:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 34, 0, 8), - "57:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 58, 0, 8), - "71:1: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 72, 0, 8), - }; - - final Configuration checkConfig = getModuleConfig("CommentsIndentation"); - final String filePath = - getPath("InputCommentsIndentationInEmptyBlock.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testSurroundingCode() throws Exception { - final String[] expected = { - "13:15: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 14, 14, 12), - "23:17: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.block", 24, 16, 12), - "25:17: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.block", 27, 16, 12), - "28:17: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.block", 31, 16, 12), - "50:28: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 53, 27, 36), - "51:24: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.block", 53, 23, 36), - "90:15: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 91, 14, 8), - "98:14: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 100, 13, 8), - "108:34: " + getCheckMessage(CommentsIndentationCheck.class, - "comments.indentation.single", 109, 33, 8), - }; - - final Configuration checkConfig = getModuleConfig("CommentsIndentation"); - final String filePath = - getPath("InputCommentsIndentationSurroundingCode.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java deleted file mode 100644 index 98452995a4c..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifierOrderTest.java +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule487modifiers; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.modifier.ModifierOrderCheck; - -public class ModifierOrderTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule487modifiers"; - } - - @Test - public void testModifierOrder() throws Exception { - final Class clazz = ModifierOrderCheck.class; - final String msgMod = "mod.order"; - final String msgAnnotation = "annotation.order"; - - final String[] expected = { - "3:10: " + getCheckMessage(clazz, msgMod, "abstract"), - "5:15: " + getCheckMessage(clazz, msgMod, "private"), - "7:14: " + getCheckMessage(clazz, msgMod, "public"), - "15:14: " + getCheckMessage(clazz, msgMod, "private"), - "25:13: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "30:13: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "40:34: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation4"), - "46:14: " + getCheckMessage(clazz, msgMod, "protected"), - "48:18: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "50:40: " + getCheckMessage(clazz, msgMod, "final"), - "52:29: " + getCheckMessage(clazz, msgMod, "static"), - "54:18: " + getCheckMessage(clazz, msgMod, "final"), - "56:49: " + getCheckMessage(clazz, msgMod, "private"), - "58:20: " + getCheckMessage(clazz, msgMod, "synchronized"), - "60:29: " + getCheckMessage(clazz, msgMod, "protected"), - "62:14: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "80:11: " + getCheckMessage(clazz, msgMod, "private"), - "96:15: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "98:12: " + getCheckMessage(clazz, msgMod, "protected"), - "102:12: " + getCheckMessage(clazz, msgMod, "synchronized"), - "104:12: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "106:19: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "108:18: " + getCheckMessage(clazz, msgMod, "static"), - "110:25: " + getCheckMessage(clazz, msgMod, "private"), - "137:19: " + getCheckMessage(clazz, msgMod, "private"), - "139:18: " + getCheckMessage(clazz, msgMod, "public"), - "143:19: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "145:22: " + getCheckMessage(clazz, msgMod, "protected"), - "147:16: " + getCheckMessage(clazz, msgMod, "synchronized"), - "149:16: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "151:16: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "153:29: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "155:22: " + getCheckMessage(clazz, msgMod, "private"), - "168:23: " + getCheckMessage(clazz, msgMod, "private"), - "170:22: " + getCheckMessage(clazz, msgMod, "public"), - "172:23: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "174:23: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "176:26: " + getCheckMessage(clazz, msgMod, "protected"), - "178:20: " + getCheckMessage(clazz, msgMod, "synchronized"), - "182:20: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "184:33: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "186:26: " + getCheckMessage(clazz, msgMod, "private"), - "197:19: " + getCheckMessage(clazz, msgMod, "private"), - "199:18: " + getCheckMessage(clazz, msgMod, "public"), - "203:18: " + getCheckMessage(clazz, msgMod, "protected"), - "205:22: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "207:37: " + getCheckMessage(clazz, msgMod, "final"), - "209:33: " + getCheckMessage(clazz, msgMod, "final"), - "211:22: " + getCheckMessage(clazz, msgMod, "final"), - "213:46: " + getCheckMessage(clazz, msgMod, "private"), - "215:24: " + getCheckMessage(clazz, msgMod, "synchronized"), - "217:33: " + getCheckMessage(clazz, msgMod, "protected"), - "219:18: " + getCheckMessage(clazz, msgAnnotation, "@MyAnnotation2"), - "245:14: " + getCheckMessage(clazz, msgMod, "default"), - }; - - final Configuration checkConfig = getModuleConfig("ModifierOrder"); - final String filePath = getPath("InputModifierOrder.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifiersTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifiersTest.java new file mode 100644 index 00000000000..ad5ee73256c --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule487modifiers/ModifiersTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule487modifiers; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ModifiersTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule487modifiers"; + } + + @Test + public void testModifierOrder() throws Exception { + verifyWithWholeConfig(getPath("InputModifierOrder.java")); + } + + @Test + public void testModifierOrderFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedModifierOrder.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/NumericLiteralsTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/NumericLiteralsTest.java new file mode 100644 index 00000000000..17fc410d04d --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/NumericLiteralsTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule488numericliterals; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NumericLiteralsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter4formatting/rule488numericliterals"; + } + + @Test + public void testUpperEll() throws Exception { + verifyWithWholeConfig(getPath("InputNumericLiterals.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java b/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java deleted file mode 100644 index 8bb5b343a4d..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/UpperEllTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter4formatting.rule488numericliterals; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class UpperEllTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter4formatting/rule488numericliterals"; - } - - @Test - public void testUpperEll() throws Exception { - final String[] expected = { - "6:33: Should use uppercase 'L'.", - "12:25: Should use uppercase 'L'.", - "14:30: Should use uppercase 'L'.", - "17:16: Should use uppercase 'L'.", - "21:27: Should use uppercase 'L'.", - "22:20: Should use uppercase 'L'.", - "25:13: Should use uppercase 'L'.", - "34:44: Should use uppercase 'L'.", - "40:29: Should use uppercase 'L'.", - "42:34: Should use uppercase 'L'.", - "45:20: Should use uppercase 'L'.", - "50:31: Should use uppercase 'L'.", - "51:24: Should use uppercase 'L'.", - "56:21: Should use uppercase 'L'.", - "65:45: Should use uppercase 'L'.", - "71:37: Should use uppercase 'L'.", - "73:42: Should use uppercase 'L'.", - "76:28: Should use uppercase 'L'.", - "80:39: Should use uppercase 'L'.", - "81:32: Should use uppercase 'L'.", - "84:25: Should use uppercase 'L'.", - "97:43: Should use uppercase 'L'.", - "99:27: Should use uppercase 'L'.", - "100:20: Should use uppercase 'L'.", - }; - - final Configuration checkConfig = getModuleConfig("UpperEll"); - final String filePath = getPath("InputUpperEll.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java deleted file mode 100644 index 953d1c2f301..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/CatchParameterNameTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule51identifiernames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class CatchParameterNameTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule51identifiernames"; - } - - @Test - public void testCatchParameterName() throws Exception { - final String msgKey = "name.invalidPattern"; - final Configuration checkConfig = getModuleConfig("CatchParameterName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "47:28: " + getCheckMessage(messages, msgKey, "iException", format), - "50:28: " + getCheckMessage(messages, msgKey, "ex_1", format), - "53:28: " + getCheckMessage(messages, msgKey, "eX", format), - "56:28: " + getCheckMessage(messages, msgKey, "eXX", format), - "59:28: " + getCheckMessage(messages, msgKey, "x_y_z", format), - "62:28: " + getCheckMessage(messages, msgKey, "Ex", format), - }; - - final String filePath = getPath("InputCatchParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/RulesCommonToAllIdentifiersTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/RulesCommonToAllIdentifiersTest.java new file mode 100644 index 00000000000..c6190552083 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule51identifiernames/RulesCommonToAllIdentifiersTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule51identifiernames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class RulesCommonToAllIdentifiersTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule51identifiernames"; + } + + @Test + public void testCatchParameterName() throws Exception { + verifyWithWholeConfig(getPath("InputCatchParameterName.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java deleted file mode 100644 index bbe6d44d40d..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNameTest.java +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule521packagenames; - -import java.io.File; -import java.io.IOException; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class PackageNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming"; - } - - private String getPath(String packageName, String fileName) throws IOException { - return getPath("rule521" + packageName + File.separator + fileName); - } - - @Test - public void testGoodPackageName() throws Exception { - final Configuration checkConfig = getModuleConfig("PackageName"); - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final String filePath = getPath("packagenames", "InputPackageNameGood.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testBadPackageName() throws Exception { - final String packagePath = - "com.google.checkstyle.test.chapter5naming.rule521packageNamesCamelCase"; - final Configuration checkConfig = getModuleConfig("PackageName"); - final String format = checkConfig.getProperty("format"); - final String msg = getCheckMessage(checkConfig.getMessages(), MSG_KEY, packagePath, format); - - final String[] expected = { - "1:9: " + msg, - }; - - final String filePath = getPath("packageNamesCamelCase", "InputPackageNameBad.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testBadPackageName2() throws Exception { - final String packagePath = "com.google.checkstyle.test.chapter5naming.rule521_packagenames"; - final Configuration checkConfig = getModuleConfig("PackageName"); - final String format = checkConfig.getProperty("format"); - final String msg = getCheckMessage(checkConfig.getMessages(), MSG_KEY, packagePath, format); - - final String[] expected = { - "1:9: " + msg, - }; - - final String filePath = getPath("_packagenames", "InputBadPackageName2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testBadPackageName3() throws Exception { - final String packagePath = "com.google.checkstyle.test.chapter5naming.rule521$packagenames"; - final Configuration checkConfig = getModuleConfig("PackageName"); - final String format = checkConfig.getProperty("format"); - final String msg = getCheckMessage(checkConfig.getMessages(), MSG_KEY, packagePath, format); - - final String[] expected = { - "1:9: " + msg, - }; - - final String filePath = getPath("$packagenames", "InputPackageBadName3.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNamesTest.java new file mode 100644 index 00000000000..08df5075c25 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule521packagenames/PackageNamesTest.java @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule521packagenames; + +import java.io.File; +import java.io.IOException; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class PackageNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming"; + } + + private String getPath(String packageName, String fileName) throws IOException { + return getPath("rule521" + packageName + File.separator + fileName); + } + + @Test + public void testGoodPackageName() throws Exception { + verifyWithWholeConfig(getPath("packagenames", "InputPackageNameGood.java")); + } + + @Test + public void testBadPackageName() throws Exception { + verifyWithWholeConfig(getPath("packageNamesCamelCase", "InputPackageNameBad.java")); + } + + @Test + public void testBadPackageName2() throws Exception { + verifyWithWholeConfig(getPath("_packagenames", "InputBadPackageName2.java")); + } + + @Test + public void testBadPackageName3() throws Exception { + verifyWithWholeConfig(getPath("$packagenames", "InputPackageBadName3.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule522classnames/ClassNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule522classnames/ClassNamesTest.java new file mode 100644 index 00000000000..e82537a7982 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule522classnames/ClassNamesTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule522classnames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ClassNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule522classnames"; + } + + @Test + public void testClassNames() throws Exception { + verifyWithWholeConfig(getPath("InputClassNames.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java deleted file mode 100644 index af5d81b856c..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule522typenames/TypeNameTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule522typenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class TypeNameTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule522typenames"; - } - - @Test - public void testTypeName() throws Exception { - final Configuration checkConfig = getModuleConfig("TypeName"); - final String msgKey = "name.invalidPattern"; - final String format = "^[A-Z][a-zA-Z0-9]*$"; - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "3:7: " + getCheckMessage(messages, msgKey, "inputHeaderClass", format), - "5:22: " + getCheckMessage(messages, msgKey, "InputHeader___Interface", format), - "7:17: " + getCheckMessage(messages, msgKey, "inputHeaderEnum", format), - "9:11: " + getCheckMessage(messages, msgKey, "NoValid$Name", format), - "11:11: " + getCheckMessage(messages, msgKey, "$NoValidName", format), - "13:11: " + getCheckMessage(messages, msgKey, "NoValidName$", format), - "19:7: " + getCheckMessage(messages, msgKey, "_ValidName", format), - "21:7: " + getCheckMessage(messages, msgKey, "Valid_Name", format), - "23:7: " + getCheckMessage(messages, msgKey, "ValidName_", format), - "27:11: " + getCheckMessage(messages, msgKey, "_Foo", format), - "29:11: " + getCheckMessage(messages, msgKey, "Fo_o", format), - "31:11: " + getCheckMessage(messages, msgKey, "Foo_", format), - "33:11: " + getCheckMessage(messages, msgKey, "$Foo", format), - "35:11: " + getCheckMessage(messages, msgKey, "Fo$o", format), - "37:11: " + getCheckMessage(messages, msgKey, "Foo$", format), - "41:6: " + getCheckMessage(messages, msgKey, "_FooEnum", format), - "43:6: " + getCheckMessage(messages, msgKey, "Foo_Enum", format), - "45:6: " + getCheckMessage(messages, msgKey, "FooEnum_", format), - "47:6: " + getCheckMessage(messages, msgKey, "$FooEnum", format), - "49:6: " + getCheckMessage(messages, msgKey, "Foo$Enum", format), - "51:6: " + getCheckMessage(messages, msgKey, "FooEnum$", format), - "53:7: " + getCheckMessage(messages, msgKey, "aaa", format), - "55:11: " + getCheckMessage(messages, msgKey, "bbb", format), - "57:6: " + getCheckMessage(messages, msgKey, "ccc", format), - "61:12: " + getCheckMessage(messages, msgKey, "_Annotation", format), - "63:12: " + getCheckMessage(messages, msgKey, "Annot_ation", format), - "65:12: " + getCheckMessage(messages, msgKey, "Annotation_", format), - "67:12: " + getCheckMessage(messages, msgKey, "$Annotation", format), - "69:12: " + getCheckMessage(messages, msgKey, "Annot$ation", format), - "71:12: " + getCheckMessage(messages, msgKey, "Annotation$", format), - }; - - final String filePath = getPath("InputTypeName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java deleted file mode 100644 index bde7a5443b2..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNameTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule523methodnames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class MethodNameTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule523methodnames"; - } - - @Test - public void testMethodName() throws Exception { - final Configuration checkConfig = getModuleConfig("MethodName"); - final String msgKey = "name.invalidPattern"; - final String format = "^[a-z][a-z0-9]\\w*$"; - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "11:10: " + getCheckMessage(messages, msgKey, "Foo", format), - "12:10: " + getCheckMessage(messages, msgKey, "fOo", format), - "14:10: " + getCheckMessage(messages, msgKey, "f$o", format), - "15:10: " + getCheckMessage(messages, msgKey, "f_oo", format), - "16:10: " + getCheckMessage(messages, msgKey, "f", format), - "17:10: " + getCheckMessage(messages, msgKey, "fO", format), - "21:14: " + getCheckMessage(messages, msgKey, "Foo", format), - "22:14: " + getCheckMessage(messages, msgKey, "fOo", format), - "24:14: " + getCheckMessage(messages, msgKey, "f$o", format), - "25:14: " + getCheckMessage(messages, msgKey, "f_oo", format), - "26:14: " + getCheckMessage(messages, msgKey, "f", format), - "27:14: " + getCheckMessage(messages, msgKey, "fO", format), - "32:14: " + getCheckMessage(messages, msgKey, "Foo", format), - "33:14: " + getCheckMessage(messages, msgKey, "fOo", format), - "35:14: " + getCheckMessage(messages, msgKey, "f$o", format), - "36:14: " + getCheckMessage(messages, msgKey, "f_oo", format), - "37:14: " + getCheckMessage(messages, msgKey, "f", format), - "38:14: " + getCheckMessage(messages, msgKey, "fO", format), - "44:10: " + getCheckMessage(messages, msgKey, "Foo", format), - "45:10: " + getCheckMessage(messages, msgKey, "fOo", format), - "47:10: " + getCheckMessage(messages, msgKey, "f$o", format), - "48:10: " + getCheckMessage(messages, msgKey, "f_oo", format), - "49:10: " + getCheckMessage(messages, msgKey, "f", format), - "50:10: " + getCheckMessage(messages, msgKey, "fO", format), - }; - - final String filePath = getPath("InputMethodName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNamesTest.java new file mode 100644 index 00000000000..a932477410d --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule523methodnames/MethodNamesTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule523methodnames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class MethodNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule523methodnames"; + } + + @Test + public void testMethodName() throws Exception { + verifyWithWholeConfig(getPath("InputMethodName.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java deleted file mode 100644 index d6f3d5afb9d..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/MemberNameTest.java +++ /dev/null @@ -1,111 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class MemberNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames"; - } - - @Test - public void testMemberName() throws Exception { - final Configuration checkConfig = getModuleConfig("MemberName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - final String[] expected = { - "5:16: " + getCheckMessage(messages, MSG_KEY, "mPublic", format), - "6:19: " + getCheckMessage(messages, MSG_KEY, "mProtected", format), - "7:9: " + getCheckMessage(messages, MSG_KEY, "mPackage", format), - "8:17: " + getCheckMessage(messages, MSG_KEY, "mPrivate", format), - "10:16: " + getCheckMessage(messages, MSG_KEY, "_public", format), - "11:19: " + getCheckMessage(messages, MSG_KEY, "prot_ected", format), - "12:9: " + getCheckMessage(messages, MSG_KEY, "package_", format), - "13:17: " + getCheckMessage(messages, MSG_KEY, "priva$te", format), - "20:9: " + getCheckMessage(messages, MSG_KEY, "ABC", format), - "21:15: " + getCheckMessage(messages, MSG_KEY, "C_D_E", format), - "23:16: " + getCheckMessage(messages, MSG_KEY, "$mPublic", format), - "24:19: " + getCheckMessage(messages, MSG_KEY, "mPro$tected", format), - "25:9: " + getCheckMessage(messages, MSG_KEY, "mPackage$", format), - }; - - final String filePath = getPath("InputMemberNameBasic.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testSimple() throws Exception { - final Configuration checkConfig = getModuleConfig("MemberName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - final String[] expected = { - "12:17: " + getCheckMessage(messages, MSG_KEY, "bad$Static", format), - "17:17: " + getCheckMessage(messages, MSG_KEY, "bad_Member", format), - "19:17: " + getCheckMessage(messages, MSG_KEY, "m", format), - "21:19: " + getCheckMessage(messages, MSG_KEY, "m_M", format), - "24:19: " + getCheckMessage(messages, MSG_KEY, "m$nts", format), - "35:9: " + getCheckMessage(messages, MSG_KEY, "mTest1", format), - "37:16: " + getCheckMessage(messages, MSG_KEY, "mTest2", format), - "39:16: " + getCheckMessage(messages, MSG_KEY, "$mTest2", format), - "41:16: " + getCheckMessage(messages, MSG_KEY, "mTes$t2", format), - "43:16: " + getCheckMessage(messages, MSG_KEY, "mTest2$", format), - "77:21: " + getCheckMessage(messages, MSG_KEY, "bad$Static", format), - "79:22: " + getCheckMessage(messages, MSG_KEY, "sum_Created", format), - "82:21: " + getCheckMessage(messages, MSG_KEY, "bad_Member", format), - "84:21: " + getCheckMessage(messages, MSG_KEY, "m", format), - "86:23: " + getCheckMessage(messages, MSG_KEY, "m_M", format), - "89:23: " + getCheckMessage(messages, MSG_KEY, "m$nts", format), - "93:13: " + getCheckMessage(messages, MSG_KEY, "mTest1", format), - "95:20: " + getCheckMessage(messages, MSG_KEY, "mTest2", format), - "97:20: " + getCheckMessage(messages, MSG_KEY, "$mTest2", format), - "99:20: " + getCheckMessage(messages, MSG_KEY, "mTes$t2", format), - "101:20: " + getCheckMessage(messages, MSG_KEY, "mTest2$", format), - "107:25: " + getCheckMessage(messages, MSG_KEY, "bad$Static", format), - "109:25: " + getCheckMessage(messages, MSG_KEY, "sum_Created", format), - "112:25: " + getCheckMessage(messages, MSG_KEY, "bad_Member", format), - "114:25: " + getCheckMessage(messages, MSG_KEY, "m", format), - "116:25: " + getCheckMessage(messages, MSG_KEY, "m_M", format), - "119:27: " + getCheckMessage(messages, MSG_KEY, "m$nts", format), - "123:25: " + getCheckMessage(messages, MSG_KEY, "mTest1", format), - "125:25: " + getCheckMessage(messages, MSG_KEY, "mTest2", format), - "127:25: " + getCheckMessage(messages, MSG_KEY, "$mTest2", format), - "129:25: " + getCheckMessage(messages, MSG_KEY, "mTes$t2", format), - "131:25: " + getCheckMessage(messages, MSG_KEY, "mTest2$", format), - }; - - final String filePath = getPath("InputMemberNameSimple.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/NonConstantFieldNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/NonConstantFieldNamesTest.java new file mode 100644 index 00000000000..0667538fbac --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/NonConstantFieldNamesTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NonConstantFieldNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames"; + } + + @Test + public void testMemberName() throws Exception { + verifyWithWholeConfig(getPath("InputNonConstantNamesBasic.java")); + } + + @Test + public void testSimple() throws Exception { + verifyWithWholeConfig(getPath("InputNonConstantNamesSimple.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/LambdaParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/LambdaParameterNameTest.java deleted file mode 100644 index f8fc270b35b..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/LambdaParameterNameTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule526parameternames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class LambdaParameterNameTest extends AbstractGoogleModuleTestSupport { - - public static final String MSG_INVALID_PATTERN = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule526parameternames"; - } - - @Test - public void testLambdaParameterName() throws Exception { - final Configuration config = getModuleConfig("LambdaParameterName"); - final String format = config.getProperty("format"); - final Map messages = config.getMessages(); - - final String[] expected = { - "9:13: " + getCheckMessage(messages, MSG_INVALID_PATTERN, "S", format), - "12:14: " + getCheckMessage(messages, MSG_INVALID_PATTERN, "sT", format), - "14:65: " + getCheckMessage(messages, MSG_INVALID_PATTERN, "sT1", format), - "14:70: " + getCheckMessage(messages, MSG_INVALID_PATTERN, "sT2", format), - "17:21: " + getCheckMessage(messages, MSG_INVALID_PATTERN, "_s", format), - }; - - final String filePath = getPath("InputLambdaParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(config, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java deleted file mode 100644 index 5b0e91729b8..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNameTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule526parameternames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class ParameterNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule526parameternames"; - } - - @Test - public void testGeneralParameterName() throws Exception { - final Configuration config = getModuleConfig("ParameterName"); - final String format = config.getProperty("format"); - final Map messages = config.getMessages(); - final String[] expected = { - "10:21: " + getCheckMessage(messages, MSG_KEY, "bB", format), - "33:18: " + getCheckMessage(messages, MSG_KEY, "llll_llll", format), - "34:21: " + getCheckMessage(messages, MSG_KEY, "bB", format), - "64:13: " + getCheckMessage(messages, MSG_KEY, "$arg1", format), - "65:13: " + getCheckMessage(messages, MSG_KEY, "ar$g2", format), - "66:13: " + getCheckMessage(messages, MSG_KEY, "arg3$", format), - "67:13: " + getCheckMessage(messages, MSG_KEY, "a_rg4", format), - "68:13: " + getCheckMessage(messages, MSG_KEY, "_arg5", format), - "69:13: " + getCheckMessage(messages, MSG_KEY, "arg6_", format), - "70:13: " + getCheckMessage(messages, MSG_KEY, "aArg7", format), - "71:13: " + getCheckMessage(messages, MSG_KEY, "aArg8", format), - "72:13: " + getCheckMessage(messages, MSG_KEY, "aar_g", format), - }; - - final String filePath = getPath("InputParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(config, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNamesTest.java new file mode 100644 index 00000000000..d0db5441405 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/ParameterNamesTest.java @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule526parameternames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ParameterNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule526parameternames"; + } + + @Test + public void testLambdaParameterName() throws Exception { + verifyWithWholeConfig(getPath("InputLambdaParameterName.java")); + } + + @Test + public void testGeneralParameterName() throws Exception { + verifyWithWholeConfig(getPath("InputParameterName.java")); + } + + @Test + public void testRecordParameterName() throws Exception { + verifyWithWholeConfig(getNonCompilablePath("InputRecordComponentName.java")); + } + + @Test + public void testCatchParameterName() throws Exception { + verifyWithWholeConfig(getPath("InputCatchParameterName.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/RecordComponentNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/RecordComponentNameTest.java deleted file mode 100644 index 7c2772d8f49..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule526parameternames/RecordComponentNameTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule526parameternames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class RecordComponentNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule526parameternames"; - } - - @Test - public void testGeneralParameterName() throws Exception { - final Configuration config = getModuleConfig("RecordComponentName"); - final String format = config.getProperty("format"); - final Map messages = config.getMessages(); - final String[] expected = { - "8:47: " + getCheckMessage(messages, MSG_KEY, "_componentName", format), - "12:40: " + getCheckMessage(messages, MSG_KEY, "Capital", format), - }; - - final String filePath = getNonCompilablePath("InputRecordComponentName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(config, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java deleted file mode 100644 index ad4abba5aef..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNameTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class LocalVariableNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule527localvariablenames"; - } - - @Test - public void testLocalVariableName() throws Exception { - final Configuration checkConfig = getModuleConfig("LocalVariableName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - final String[] expected = { - "27:13: " + getCheckMessage(messages, MSG_KEY, "aA", format), - "28:13: " + getCheckMessage(messages, MSG_KEY, "a1_a", format), - "29:13: " + getCheckMessage(messages, MSG_KEY, "A_A", format), - "30:13: " + getCheckMessage(messages, MSG_KEY, "aa2_a", format), - "31:13: " + getCheckMessage(messages, MSG_KEY, "_a", format), - "32:13: " + getCheckMessage(messages, MSG_KEY, "_aa", format), - "33:13: " + getCheckMessage(messages, MSG_KEY, "aa_", format), - "34:13: " + getCheckMessage(messages, MSG_KEY, "aaa$aaa", format), - "35:13: " + getCheckMessage(messages, MSG_KEY, "$aaaaaa", format), - "36:13: " + getCheckMessage(messages, MSG_KEY, "aaaaaa$", format), - }; - - final String filePath = getPath("InputLocalVariableNameSimple.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testOneChar() throws Exception { - final Configuration checkConfig = getModuleConfig("LocalVariableName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - final String[] expected = { - "21:17: " + getCheckMessage(messages, MSG_KEY, "I_ndex", format), - "45:17: " + getCheckMessage(messages, MSG_KEY, "i_ndex", format), - "49:17: " + getCheckMessage(messages, MSG_KEY, "ii_i1", format), - "53:17: " + getCheckMessage(messages, MSG_KEY, "$index", format), - "57:17: " + getCheckMessage(messages, MSG_KEY, "in$dex", format), - "61:17: " + getCheckMessage(messages, MSG_KEY, "index$", format), - }; - - final String filePath = getPath("InputLocalVariableNameOneCharVarName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNamesTest.java new file mode 100644 index 00000000000..cea989c7e3c --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/LocalVariableNamesTest.java @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class LocalVariableNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule527localvariablenames"; + } + + @Test + public void testPatternVariableName() throws Exception { + verifyWithWholeConfig(getNonCompilablePath( + "InputPatternVariableNameEnhancedInstanceofTestDefault.java")); + } + + @Test + public void testLocalAndPatternVariableName() throws Exception { + verifyWithWholeConfig(getPath("InputLocalVariableNameSimple.java")); + } + + @Test + public void testOneChar() throws Exception { + verifyWithWholeConfig(getPath("InputLocalVariableNameOneCharVarName.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/PatternVariableNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/PatternVariableNameTest.java deleted file mode 100644 index 3d3e5cc548c..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/PatternVariableNameTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class PatternVariableNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule527localvariablenames"; - } - - @Test - public void testPatternVariableName() throws Exception { - final Configuration checkConfig = getModuleConfig("PatternVariableName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - final String[] expected = { - "11:39: " + getCheckMessage(messages, MSG_KEY, "OTHER", format), - "21:34: " + getCheckMessage(messages, MSG_KEY, "Count", format), - "36:36: " + getCheckMessage(messages, MSG_KEY, "aA", format), - "37:42: " + getCheckMessage(messages, MSG_KEY, "a1_a", format), - "40:34: " + getCheckMessage(messages, MSG_KEY, "A_A", format), - "41:43: " + getCheckMessage(messages, MSG_KEY, "aa2_a", format), - "53:37: " + getCheckMessage(messages, MSG_KEY, "_a", format), - "59:43: " + getCheckMessage(messages, MSG_KEY, "_aa", format), - "63:41: " + getCheckMessage(messages, MSG_KEY, "aa_", format), - "68:38: " + getCheckMessage(messages, MSG_KEY, "aaa$aaa", format), - "69:36: " + getCheckMessage(messages, MSG_KEY, "$aaaaaa", format), - "70:37: " + getCheckMessage(messages, MSG_KEY, "aaaaaa$", format), - "77:41: " + getCheckMessage(messages, MSG_KEY, "_A_aa_B", format), - - }; - - final String filePath = - getNonCompilablePath( - "InputPatternVariableNameEnhancedInstanceofTestDefault.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java deleted file mode 100644 index 8b1b898084d..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/ClassTypeParameterNameTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class ClassTypeParameterNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; - } - - @Test - public void testClassDefault() throws Exception { - final Configuration configuration = getModuleConfig("ClassTypeParameterName"); - final String format = configuration.getProperty("format"); - final Map messages = configuration.getMessages(); - - final String[] expected = { - "5:36: " + getCheckMessage(messages, MSG_KEY, "t", format), - "13:14: " + getCheckMessage(messages, MSG_KEY, "foo", format), - "27:24: " + getCheckMessage(messages, MSG_KEY, "$foo", format), - }; - - final String filePath = getPath("InputClassTypeParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(configuration, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java deleted file mode 100644 index d658b382871..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InterfaceTypeParameterNameTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class InterfaceTypeParameterNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; - } - - @Test - public void testInterfaceDefault() throws Exception { - final Configuration configuration = getModuleConfig("InterfaceTypeParameterName"); - final String format = configuration.getProperty("format"); - final Map messages = configuration.getMessages(); - - final String[] expected = { - "48:15: " + getCheckMessage(messages, MSG_KEY, "Input", format), - "76:25: " + getCheckMessage(messages, MSG_KEY, "Request", format), - "80:25: " + getCheckMessage(messages, MSG_KEY, "TRequest", format), - }; - - final String filePath = getPath("InputInterfaceTypeParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(configuration, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java deleted file mode 100644 index b33d3fe72b7..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/MethodTypeParameterNameTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class MethodTypeParameterNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; - } - - @Test - public void testMethodDefault() throws Exception { - final Configuration checkConfig = getModuleConfig("MethodTypeParameterName"); - final String format = checkConfig.getProperty("format"); - final Map messages = checkConfig.getMessages(); - - final String[] expected = { - "9:6: " + getCheckMessage(messages, MSG_KEY, "e_e", format), - "19:6: " + getCheckMessage(messages, MSG_KEY, "Tfo$o2T", format), - "23:6: " + getCheckMessage(messages, MSG_KEY, "foo_", format), - "28:10: " + getCheckMessage(messages, MSG_KEY, "_abc", format), - "37:14: " + getCheckMessage(messages, MSG_KEY, "T$", format), - "42:14: " + getCheckMessage(messages, MSG_KEY, "EE", format), - }; - - final String filePath = getPath("InputMethodTypeParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/RecordTypeParameterNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/RecordTypeParameterNameTest.java deleted file mode 100644 index df6d3f7a6dd..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/RecordTypeParameterNameTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; - -import java.util.Map; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; - -public class RecordTypeParameterNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "name.invalidPattern"; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; - } - - @Test - public void testRecordDefault() throws Exception { - final Configuration configuration = getModuleConfig("RecordTypeParameterName"); - final String format = configuration.getProperty("format"); - final Map messages = configuration.getMessages(); - - final String[] expected = { - "13:44: " + getCheckMessage(messages, MSG_KEY, "t", format), - "20:15: " + getCheckMessage(messages, MSG_KEY, "foo", format), - "35:25: " + getCheckMessage(messages, MSG_KEY, "foo", format), - }; - - final String filePath = getNonCompilablePath("InputRecordTypeParameterName.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(configuration, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/TypeVariableNamesTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/TypeVariableNamesTest.java new file mode 100644 index 00000000000..15dbf93bbb0 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/TypeVariableNamesTest.java @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule528typevariablenames; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class TypeVariableNamesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule528typevariablenames"; + } + + @Test + public void testMethodDefault() throws Exception { + verifyWithWholeConfig(getPath("InputMethodTypeParameterName.java")); + } + + @Test + public void testClassDefault() throws Exception { + verifyWithWholeConfig(getPath("InputClassTypeParameterName.java")); + } + + @Test + public void testInterfaceDefault() throws Exception { + verifyWithWholeConfig(getPath("InputInterfaceTypeParameterName.java")); + } + + @Test + public void testRecordDefault() throws Exception { + verifyWithWholeConfig(getNonCompilablePath("InputRecordTypeParameterName.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java deleted file mode 100644 index e47f33968ee..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/AbbreviationAsWordInNameTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter5naming.rule53camelcase; - -import java.io.IOException; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.naming.AbbreviationAsWordInNameCheck; - -public class AbbreviationAsWordInNameTest extends AbstractGoogleModuleTestSupport { - - private static final String MSG_KEY = "abbreviation.as.word"; - private final Class clazz = AbbreviationAsWordInNameCheck.class; - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter5naming/rule53camelcase"; - } - - @Test - public void testAbbreviationAsWordInName() throws Exception { - final int maxCapitalCount = 1; - - final String[] expected = { - "51:9: " + getWarningMessage("newCustomerID", maxCapitalCount), - "53:13: " + getWarningMessage("supportsIPv6OnIOS", maxCapitalCount), - "55:10: " + getWarningMessage("XMLHTTPRequest", maxCapitalCount), - "59:13: " + getWarningMessage("newCustomerID", maxCapitalCount), - "61:17: " + getWarningMessage("supportsIPv6OnIOS", maxCapitalCount), - "63:14: " + getWarningMessage("XMLHTTPRequest", maxCapitalCount), - "69:17: " + getWarningMessage("newCustomerID", maxCapitalCount), - "71:21: " + getWarningMessage("supportsIPv6OnIOS", maxCapitalCount), - "73:18: " + getWarningMessage("XMLHTTPRequest", maxCapitalCount), - }; - - final String filePath = getPath("InputAbbreviationAsWordInTypeNameCheck.java"); - - final Configuration checkConfig = getModuleConfig("AbbreviationAsWordInName"); - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - private String getWarningMessage(String typeName, int expectedCapitalCount) - throws IOException { - return getCheckMessage(clazz, MSG_KEY, typeName, expectedCapitalCount); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/CamelCaseDefinedTest.java b/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/CamelCaseDefinedTest.java new file mode 100644 index 00000000000..4647c6f32c8 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter5naming/rule53camelcase/CamelCaseDefinedTest.java @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter5naming.rule53camelcase; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class CamelCaseDefinedTest extends AbstractGoogleModuleTestSupport { + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter5naming/rule53camelcase"; + } + + @Test + public void testCamelCaseNames() throws Exception { + verifyWithWholeConfig(getPath("InputCamelCaseDefined.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/CaughtExceptionsNotIgnoredTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/CaughtExceptionsNotIgnoredTest.java new file mode 100644 index 00000000000..6eabdac05a8 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/CaughtExceptionsNotIgnoredTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter6programpractice.rule62donotignoreexceptions; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class CaughtExceptionsNotIgnoredTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions"; + } + + @Test + public void testEmptyFinallyBlock() throws Exception { + verifyWithWholeConfig(getPath("InputEmptyFinallyBlock.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java deleted file mode 100644 index 8490c25d204..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/EmptyBlockTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter6programpractice.rule62donotignoreexceptions; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck; - -public class EmptyBlockTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions"; - } - - @Test - public void testEmptyBlockCatch() throws Exception { - final String[] expected = { - "29:17: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "finally"), - "50:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "finally"), - "72:21: " + getCheckMessage(EmptyBlockCheck.class, "block.empty", "finally"), - }; - - final Configuration checkConfig = getModuleConfig("EmptyBlock"); - final String filePath = getPath("InputEmptyBlockCatch.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/FinalizersNotUsedTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/FinalizersNotUsedTest.java new file mode 100644 index 00000000000..a63967a8af0 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/FinalizersNotUsedTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter6programpractice.rule64finalizers; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class FinalizersNotUsedTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter6programpractice/rule64finalizers"; + } + + @Test + public void testNoFinalizerBasic() throws Exception { + verifyWithWholeConfig(getPath("InputNoFinalizer.java")); + } + + @Test + public void testNoFinalizerExtended() throws Exception { + verifyWithWholeConfig(getPath("InputNoFinalizeExtend.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java b/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java deleted file mode 100644 index 6f91a306b80..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/NoFinalizerTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter6programpractice.rule64finalizers; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.coding.NoFinalizerCheck; - -public class NoFinalizerTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter6programpractice/rule64finalizers"; - } - - @Test - public void testNoFinalizerBasic() throws Exception { - final String msg = getCheckMessage(NoFinalizerCheck.class, "avoid.finalizer.method"); - - final String[] expected = { - "5:5: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("NoFinalizer"); - final String filePath = getPath("InputNoFinalizer.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testNoFinalizerExtended() throws Exception { - final String msg = getCheckMessage(NoFinalizerCheck.class, "avoid.finalizer.method"); - - final String[] expected = { - "9:5: " + msg, - "21:5: " + msg, - "33:5: " + msg, - "45:5: " + msg, - "57:5: " + msg, - "69:5: " + msg, - "79:9: " + msg, - "119:13: " + msg, - "136:5: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("NoFinalizer"); - final String filePath = getPath("InputNoFinalizeExtend.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/GeneralFormTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/GeneralFormTest.java new file mode 100644 index 00000000000..d1c15428f4b --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/GeneralFormTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule711generalform; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class GeneralFormTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule711generalform"; + } + + @Test + public void testSingleLineJavadocAndInvalidJavadocPosition() throws Exception { + verifyWithWholeConfig(getPath("InputSingleLineJavadocAndInvalidJavadocPosition.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InvalidJavadocPositionTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InvalidJavadocPositionTest.java deleted file mode 100644 index 4d18ff3c114..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InvalidJavadocPositionTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule711generalform; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.InvalidJavadocPositionCheck; - -public class InvalidJavadocPositionTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule711generalform"; - } - - @Test - public void testDefault() throws Exception { - final String message = getCheckMessage(InvalidJavadocPositionCheck.class, - "invalid.position"); - - final String[] expected = { - "1:9: " + message, - "3:1: " + message, - "6:1: " + message, - "9:5: " + message, - "14:5: " + message, - "17:5: " + message, - "27:9: " + message, - "28:17: " + message, - "29:17: " + message, - "39:10: " + message, - "40:19: " + message, - "41:19: " + message, - "42:21: " + message, - "43:23: " + message, - "44:23: " + message, - "47:1: " + message, - "52:7: " + message, - "53:36: " + message, - "54:1: " + message, - }; - - final Configuration checkConfig = getModuleConfig("InvalidJavadocPosition"); - final String filePath = getPath("InputInvalidJavadocPosition.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java deleted file mode 100644 index 3c2f12f63a4..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule711generalform/SingleLineJavadocTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule711generalform; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.SingleLineJavadocCheck; - -public class SingleLineJavadocTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule711generalform"; - } - - @Test - public void testSingleLineJavadoc() throws Exception { - final String msg = getCheckMessage(SingleLineJavadocCheck.class, "singleline.javadoc"); - - final String[] expected = { - "13: " + msg, - "29: " + msg, - "35: " + msg, - "41: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("SingleLineJavadoc"); - final String filePath = getPath("InputSingleLineJavadocCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java deleted file mode 100644 index ed4c2fe6d9b..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/JavadocParagraphTest.java +++ /dev/null @@ -1,96 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class JavadocParagraphTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule712paragraphs"; - } - - @Test - public void testJavadocParagraphCorrect() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("JavadocParagraph"); - final String filePath = getPath("InputCorrectJavadocParagraphCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testJavadocParagraphIncorrect() throws Exception { - final String msgBefore = getCheckMessage(JavadocParagraphCheck.class, - "javadoc.paragraph.line.before"); - final String msgRed = getCheckMessage(JavadocParagraphCheck.class, - "javadoc.paragraph.redundant.paragraph"); - final String msgMisplaced = getCheckMessage(JavadocParagraphCheck.class, - "javadoc.paragraph.misplaced.tag"); - - final String[] expected = { - "5: " + msgMisplaced, - "5: " + msgBefore, - "6: " + msgMisplaced, - "6: " + msgBefore, - "12: " + msgMisplaced, - "12: " + msgBefore, - "14: " + msgMisplaced, - "21: " + msgBefore, - "30: " + msgRed, - "31: " + msgMisplaced, - "31: " + msgBefore, - "32: " + msgMisplaced, - "32: " + msgBefore, - "33: " + msgMisplaced, - "33: " + msgBefore, - "37: " + msgMisplaced, - "37: " + msgBefore, - "43: " + msgMisplaced, - "43: " + msgRed, - "46: " + msgMisplaced, - "48: " + msgMisplaced, - "48: " + msgBefore, - "49: " + msgMisplaced, - "49: " + msgBefore, - "59: " + msgRed, - "68: " + msgMisplaced, - "68: " + msgBefore, - "70: " + msgMisplaced, - "73: " + msgMisplaced, - "73: " + msgBefore, - }; - - final Configuration checkConfig = getModuleConfig("JavadocParagraph"); - final String filePath = getPath("InputIncorrectJavadocParagraphCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/ParagraphsTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/ParagraphsTest.java new file mode 100644 index 00000000000..5877653c36a --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/ParagraphsTest.java @@ -0,0 +1,75 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ParagraphsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule712paragraphs"; + } + + @Test + public void testJavadocParagraphCorrect() throws Exception { + verifyWithWholeConfig(getPath("InputCorrectJavadocParagraph.java")); + } + + @Test + public void testJavadocParagraphCorrectFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedCorrectJavadocParagraph.java")); + } + + @Test + public void testJavadocParagraphIncorrect() throws Exception { + verifyWithWholeConfig(getPath("InputIncorrectJavadocParagraph.java")); + } + + @Test + public void testJavadocParagraphIncorrectFormatted() throws Exception { + verifyWithWholeConfig(getPath("InputFormattedIncorrectJavadocParagraph.java")); + } + + @Test + public void testRequireEmptyLineBeforeBlockTagGroupCorrect() throws Exception { + verifyWithWholeConfig(getPath("InputCorrectRequireEmptyLineBeforeBlockTagGroup.java")); + } + + @Test + public void testRequireEmptyLineBeforeBlockTagGroupCorrectFormatted() throws Exception { + verifyWithWholeConfig( + getPath("InputFormattedCorrectRequireEmptyLineBeforeBlockTagGroup.java")); + } + + @Test + public void testRequireEmptyLineBeforeBlockTagGroupIncorrect() throws Exception { + verifyWithWholeConfig(getPath("InputIncorrectRequireEmptyLineBeforeBlockTagGroup.java")); + } + + @Test + public void testRequireEmptyLineBeforeBlockTagGroupIncorrectFormatted() throws Exception { + verifyWithWholeConfig( + getPath("InputFormattedIncorrectRequireEmptyLineBeforeBlockTagGroup.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/RequireEmptyLineBeforeBlockTagGroupTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/RequireEmptyLineBeforeBlockTagGroupTest.java deleted file mode 100644 index b4880825322..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/RequireEmptyLineBeforeBlockTagGroupTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; - -import java.io.IOException; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.RequireEmptyLineBeforeBlockTagGroupCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class RequireEmptyLineBeforeBlockTagGroupTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule712paragraphs"; - } - - @Test - public void testJavadocParagraphCorrect() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig( - "RequireEmptyLineBeforeBlockTagGroup"); - final String filePath = getPath( - "InputCorrectRequireEmptyLineBeforeBlockTagGroupCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testJavadocParagraphIncorrect() throws Exception { - final String[] expected = { - "5: " + getTagCheckMessage("@since"), - "11: " + getTagCheckMessage("@param"), - "19: " + getTagCheckMessage("@param"), - }; - - final Configuration checkConfig = getModuleConfig( - "RequireEmptyLineBeforeBlockTagGroup"); - final String filePath = getPath( - "InputIncorrectRequireEmptyLineBeforeBlockTagGroupCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - private static String getTagCheckMessage(String tag) throws IOException { - return getCheckMessage(RequireEmptyLineBeforeBlockTagGroupCheck.class, - "javadoc.tag.line.before", - tag); - } -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java deleted file mode 100644 index 398e5ecc52a..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/AtclauseOrderTest.java +++ /dev/null @@ -1,140 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.AtclauseOrderCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class AtclauseOrderTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; - } - - @Test - public void testCorrect1() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("AtclauseOrder"); - final String filePath = getPath("InputCorrectAtClauseOrderCheck1.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCorrect2() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("AtclauseOrder"); - final String filePath = getPath("InputCorrectAtClauseOrderCheck2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testCorrect3() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("AtclauseOrder"); - final String filePath = getPath("InputCorrectAtClauseOrderCheck3.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testIncorrect1() throws Exception { - final String tagOrder = "[@param, @return, @throws, @deprecated]"; - final String msg = getCheckMessage(AtclauseOrderCheck.class, "at.clause.order", tagOrder); - - final String[] expected = { - "40: " + msg, - "51: " + msg, - "73: " + msg, - "74: " + msg, - "84: " + msg, - "85: " + msg, - "98: " + msg, - "101: " + msg, - "112: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("AtclauseOrder"); - final String filePath = getPath("InputIncorrectAtClauseOrderCheck1.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testIncorrect2() throws Exception { - final String tagOrder = "[@param, @return, @throws, @deprecated]"; - final String msg = getCheckMessage(AtclauseOrderCheck.class, "at.clause.order", tagOrder); - - final String[] expected = { - "19: " + msg, - "26: " + msg, - "59: " + msg, - "67: " + msg, - "78: " + msg, - "85: " + msg, - "92: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("AtclauseOrder"); - final String filePath = getPath("InputIncorrectAtClauseOrderCheck2.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testIncorrect3() throws Exception { - final String tagOrder = "[@param, @return, @throws, @deprecated]"; - final String msg = getCheckMessage(AtclauseOrderCheck.class, "at.clause.order", tagOrder); - - final String[] expected = { - "20: " + msg, - "21: " + msg, - "33: " + msg, - "35: " + msg, - "58: " + msg, - "69: " + msg, - "71: " + msg, - "86: " + msg, - "87: " + msg, - "98: " + msg, - "100: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("AtclauseOrder"); - final String filePath = getPath("InputIncorrectAtClauseOrderCheck3.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/BlockTagsTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/BlockTagsTest.java new file mode 100644 index 00000000000..a3805957563 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/BlockTagsTest.java @@ -0,0 +1,77 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class BlockTagsTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; + } + + @Test + public void testCorrectAtClauseOrder1() throws Exception { + verifyWithWholeConfig(getPath("InputCorrectAtClauseOrderCheck1.java")); + } + + @Test + public void testCorrectAtClauseOrder2() throws Exception { + verifyWithWholeConfig(getPath("InputCorrectAtClauseOrderCheck2.java")); + } + + @Test + public void testCorrectAtClauseOrder3() throws Exception { + verifyWithWholeConfig(getPath("InputCorrectAtClauseOrderCheck3.java")); + } + + @Test + public void testIncorrectAtClauseOrder1() throws Exception { + verifyWithWholeConfig(getPath("InputIncorrectAtClauseOrderCheck1.java")); + } + + @Test + public void testIncorrectAtClauseOrder2() throws Exception { + verifyWithWholeConfig(getPath("InputIncorrectAtClauseOrderCheck2.java")); + } + + @Test + public void testIncorrectAtClauseOrder3() throws Exception { + verifyWithWholeConfig(getPath("InputIncorrectAtClauseOrderCheck3.java")); + } + + @Test + public void testJavadocTagContinuationIndentation() throws Exception { + verifyWithWholeConfig(getPath("InputJavaDocTagContinuationIndentation.java")); + } + + @Test + public void testNonEmptyAtclauseDescription() throws Exception { + verifyWithWholeConfig(getPath("InputNonEmptyAtclauseDescription.java")); + } + + @Test + public void testNonEmptyAtclauseDescriptionSpaceSequence() throws Exception { + verifyWithWholeConfig(getPath("InputNonEmptyAtclauseDescriptionSpaceSeq.java")); + } +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java deleted file mode 100644 index 5cc693a4c1a..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/JavadocTagContinuationIndentationTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTagContinuationIndentationCheck; - -public class JavadocTagContinuationIndentationTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; - } - - @Test - public void testWithDefaultConfiguration() throws Exception { - final String msg = getCheckMessage(JavadocTagContinuationIndentationCheck.class, - "tag.continuation.indent", 4); - - final String[] expected = { - "47: " + msg, - "109: " + msg, - "112: " + msg, - "203: " + msg, - "206: " + msg, - "221: " + msg, - "223: " + msg, - "285: " + msg, - "288: " + msg, - "290: " + msg, - "310: " + msg, - "322: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("JavadocTagContinuationIndentation"); - final String filePath = getPath("InputJavaDocTagContinuationIndentation.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java deleted file mode 100644 index 0c071c0e925..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/NonEmptyAtclauseDescriptionTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.NonEmptyAtclauseDescriptionCheck; - -public class NonEmptyAtclauseDescriptionTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule713atclauses"; - } - - @Test - public void testDefaultConfiguration() throws Exception { - final String msg = getCheckMessage(NonEmptyAtclauseDescriptionCheck.class, - "non.empty.atclause"); - - final String[] expected = { - "34: " + msg, - "35: " + msg, - "36: " + msg, - "37: " + msg, - "38: " + msg, - "39: " + msg, - "48: " + msg, - "49: " + msg, - "50: " + msg, - "51: " + msg, - "52: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("NonEmptyAtclauseDescription"); - final String filePath = getPath("InputNonEmptyAtclauseDescriptionCheck.java"); - - final Integer[] warnList = getLineNumbersFromExpected(expected); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testSpaceSequence() throws Exception { - final String msg = getCheckMessage(NonEmptyAtclauseDescriptionCheck.class, - "non.empty.atclause"); - - final String[] expected = { - "27: " + msg, - "28: " + msg, - "29: " + msg, - "38: " + msg, - "39: " + msg, - "40: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("NonEmptyAtclauseDescription"); - final String filePath = getPath("InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java"); - - final Integer[] warnList = getLineNumbersFromExpected(expected); - verify(checkConfig, filePath, expected, warnList); - } - - /** - * Gets line numbers with violations from an array with expected messages. - * This is used as using "warn" comments in input files would affect the work - * of the Check. - * - * @param expected an array with expected messages. - * @return Integer array with numbers of lines with violations. - */ - private static Integer[] getLineNumbersFromExpected(String... expected) { - final Integer[] result = new Integer[expected.length]; - for (int i = 0; i < expected.length; i++) { - result[i] = Integer.valueOf(expected[i].substring(0, expected[i].indexOf(':'))); - } - return result; - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java deleted file mode 100644 index b44bb4d843f..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/SummaryJavadocTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class SummaryJavadocTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment"; - } - - @Test - public void testCorrect() throws Exception { - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("SummaryJavadoc"); - final String filePath = getPath("InputCorrectSummaryJavaDocCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testIncorrect() throws Exception { - final String msgFirstSentence = getCheckMessage(SummaryJavadocCheck.class, - "summary.first.sentence"); - final String msgForbiddenFragment = getCheckMessage(SummaryJavadocCheck.class, - "summary.javaDoc"); - final String msgMissingDoc = getCheckMessage(SummaryJavadocCheck.class, - "summary.javaDoc.missing"); - - final String[] expected = { - "14: " + msgMissingDoc, - "32: " + msgMissingDoc, - "37: " + msgFirstSentence, - "47: " + msgForbiddenFragment, - "53: " + msgMissingDoc, - "58: " + msgMissingDoc, - "69: " + msgMissingDoc, - "83: " + msgForbiddenFragment, - "103: " + msgMissingDoc, - }; - - final Configuration checkConfig = getModuleConfig("SummaryJavadoc"); - final String filePath = getPath("InputIncorrectSummaryJavaDocCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/TheSummaryFragmentTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/TheSummaryFragmentTest.java new file mode 100644 index 00000000000..ed09944d546 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/TheSummaryFragmentTest.java @@ -0,0 +1,43 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class TheSummaryFragmentTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment"; + } + + @Test + public void testCorrect() throws Exception { + verifyWithWholeConfig(getPath("InputCorrectSummaryFragment.java")); + } + + @Test + public void testIncorrect() throws Exception { + verifyWithWholeConfig(getPath("InputIncorrectSummaryFragment.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/ExceptionSelfExplanatoryMembersTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/ExceptionSelfExplanatoryMembersTest.java new file mode 100644 index 00000000000..3cd8cfb1117 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/ExceptionSelfExplanatoryMembersTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ExceptionSelfExplanatoryMembersTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory"; + } + + @Test + public void testBothModules() throws Exception { + verifyWithWholeConfig(getPath("InputJavadocMethodAndMissingJavadocMethod.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java deleted file mode 100644 index d83254e1bc1..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/JavadocMethodTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class JavadocMethodTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory"; - } - - @Test - public void testJavadocMethod() throws Exception { - - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("JavadocMethod"); - final String filePath = getPath("InputJavadocMethodCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/MissingJavadocMethodTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/MissingJavadocMethodTest.java deleted file mode 100644 index 7c440a3457c..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/MissingJavadocMethodTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck; - -public class MissingJavadocMethodTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory"; - } - - @Test - public void testJavadocMethod() throws Exception { - final String msg = getCheckMessage(MissingJavadocMethodCheck.class, "javadoc.missing"); - - final String[] expected = { - "57:5: " + msg, - }; - - final Configuration checkConfig = getModuleConfig("MissingJavadocMethod"); - final String filePath = getPath("InputMissingJavadocMethodCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides/ExceptionOverridesTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides/ExceptionOverridesTest.java new file mode 100644 index 00000000000..8445f0bd80b --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides/ExceptionOverridesTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule732exceptionoverrides; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class ExceptionOverridesTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides"; + } + + @Test + public void testBothModules() throws Exception { + verifyWithWholeConfig(getPath("InputJavadocMethodAndMissingJavadocMethod.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InvalidJavadocPositionTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InvalidJavadocPositionTest.java deleted file mode 100644 index 061b7d04dd7..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InvalidJavadocPositionTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule734nonrequiredjavadoc; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.InvalidJavadocPositionCheck; - -public class InvalidJavadocPositionTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule711generalform"; - } - - @Test - public void testDefault() throws Exception { - final String message = getCheckMessage(InvalidJavadocPositionCheck.class, - "invalid.position"); - - final String[] expected = { - "1:9: " + message, - "3:1: " + message, - "6:1: " + message, - "9:5: " + message, - "14:5: " + message, - "17:5: " + message, - "27:9: " + message, - "28:17: " + message, - "29:17: " + message, - "39:10: " + message, - "40:19: " + message, - "41:19: " + message, - "42:21: " + message, - "43:23: " + message, - "44:23: " + message, - "47:1: " + message, - "52:7: " + message, - "53:36: " + message, - "54:1: " + message, - }; - - final Configuration checkConfig = getModuleConfig("InvalidJavadocPosition"); - final String filePath = getPath("InputInvalidJavadocPosition.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/NonRequiredJavadocTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/NonRequiredJavadocTest.java new file mode 100644 index 00000000000..d2fed3c51a9 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/NonRequiredJavadocTest.java @@ -0,0 +1,38 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule734nonrequiredjavadoc; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class NonRequiredJavadocTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc"; + } + + @Test + public void testDefault() throws Exception { + verifyWithWholeConfig(getPath("InputInvalidJavadocPosition.java")); + } + +} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/MissingJavadocTypeTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/MissingJavadocTypeTest.java deleted file mode 100644 index 50db5cd3a04..00000000000 --- a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/MissingJavadocTypeTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// - -package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; - -import static com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck.MSG_JAVADOC_MISSING; - -import org.junit.jupiter.api.Test; - -import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; -import com.puppycrawl.tools.checkstyle.api.Configuration; -import com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck; -import com.puppycrawl.tools.checkstyle.utils.CommonUtil; - -public class MissingJavadocTypeTest extends AbstractGoogleModuleTestSupport { - - @Override - protected String getPackageLocation() { - return "com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired"; - } - - @Test - public void testJavadocType() throws Exception { - - final String[] expected = { - "3:1: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "5:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "9:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "13:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "14:9: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "17:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "21:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "25:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "29:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - "33:5: " + getCheckMessage(MissingJavadocTypeCheck.class, MSG_JAVADOC_MISSING), - }; - - final Configuration checkConfig = getModuleConfig("MissingJavadocType"); - final String filePath = getPath("InputMissingJavadocTypeCheck.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - - @Test - public void testJavadocTypeNoViolations() throws Exception { - - final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; - - final Configuration checkConfig = getModuleConfig("MissingJavadocType"); - final String filePath = getPath("InputMissingJavadocTypeCheckNoViolations.java"); - - final Integer[] warnList = getLinesWithWarn(filePath); - verify(checkConfig, filePath, expected, warnList); - } - -} diff --git a/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/WhereJavadocIsUsedTest.java b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/WhereJavadocIsUsedTest.java new file mode 100644 index 00000000000..370eef44a80 --- /dev/null +++ b/src/it/java/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/WhereJavadocIsUsedTest.java @@ -0,0 +1,48 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; + +import org.junit.jupiter.api.Test; + +import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport; + +public class WhereJavadocIsUsedTest extends AbstractGoogleModuleTestSupport { + + @Override + protected String getPackageLocation() { + return "com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired"; + } + + @Test + public void testMissingJavadocTypeIncorrect() throws Exception { + verifyWithWholeConfig(getPath("InputMissingJavadocTypeIncorrect.java")); + } + + @Test + public void testMissingJavadocTypeCorrect() throws Exception { + verifyWithWholeConfig(getPath("InputMissingJavadocTypeCorrect.java")); + } + + @Test + public void testJavadocMethodAndMissingJavadocMethod() throws Exception { + verifyWithWholeConfig(getPath("InputJavadocMethodAndMissingJavadocMethod.java")); + } + +} diff --git a/src/it/java/com/sun/checkstyle/test/base/AbstractSunModuleTestSupport.java b/src/it/java/com/sun/checkstyle/test/base/AbstractSunModuleTestSupport.java index 3f62cd1d47e..3dbdf47fbf6 100644 --- a/src/it/java/com/sun/checkstyle/test/base/AbstractSunModuleTestSupport.java +++ b/src/it/java/com/sun/checkstyle/test/base/AbstractSunModuleTestSupport.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java b/src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java index fdaf7270dba..80bbd15f576 100644 --- a/src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java +++ b/src/it/java/com/sun/checkstyle/test/chapter5comments/rule52documentationcomments/InvalidJavadocPositionTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/com/sun/checkstyle/test/chapter6declarations/rule61numberperline/MultipleVariableDeclarationsTest.java b/src/it/java/com/sun/checkstyle/test/chapter6declarations/rule61numberperline/MultipleVariableDeclarationsTest.java index 0ed7926eb23..b3b11ccbee8 100644 --- a/src/it/java/com/sun/checkstyle/test/chapter6declarations/rule61numberperline/MultipleVariableDeclarationsTest.java +++ b/src/it/java/com/sun/checkstyle/test/chapter6declarations/rule61numberperline/MultipleVariableDeclarationsTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/org/checkstyle/base/AbstractCheckstyleModuleTestSupport.java b/src/it/java/org/checkstyle/base/AbstractCheckstyleModuleTestSupport.java index 5ffa8010614..283cd3501a9 100644 --- a/src/it/java/org/checkstyle/base/AbstractCheckstyleModuleTestSupport.java +++ b/src/it/java/org/checkstyle/base/AbstractCheckstyleModuleTestSupport.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/org/checkstyle/base/AbstractItModuleTestSupport.java b/src/it/java/org/checkstyle/base/AbstractItModuleTestSupport.java index c5d1eb5d628..d02e074076e 100644 --- a/src/it/java/org/checkstyle/base/AbstractItModuleTestSupport.java +++ b/src/it/java/org/checkstyle/base/AbstractItModuleTestSupport.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -34,11 +34,13 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Properties; import java.util.regex.Pattern; +import java.util.stream.Collectors; import com.puppycrawl.tools.checkstyle.AbstractPathTestSupport; import com.puppycrawl.tools.checkstyle.Checker; @@ -47,6 +49,8 @@ import com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter; import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; +import com.puppycrawl.tools.checkstyle.bdd.InlineConfigParser; +import com.puppycrawl.tools.checkstyle.bdd.TestInputViolation; import com.puppycrawl.tools.checkstyle.internal.utils.BriefUtLogger; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; @@ -289,7 +293,8 @@ protected final Checker createChecker(Configuration moduleConfig, final Configuration config = createTreeWalkerConfig(moduleConfig); checker.configure(config); } - else if (ROOT_MODULE_NAME.equals(moduleConfig.getName())) { + else if (ROOT_MODULE_NAME.equals(moduleConfig.getName()) + || "Checker".equals(moduleConfig.getName())) { checker.configure(moduleConfig); } else { @@ -451,6 +456,100 @@ protected final void verify(Checker checker, checker.destroy(); } + /** + * Performs the verification of the file with the given file path and config. + * + * @param config config to check against. + * @param filePath input file path. + * @throws Exception if exception occurs during verification process. + */ + protected void verifyWithItConfig(Configuration config, String filePath) throws Exception { + final List violations = + InlineConfigParser.getViolationsFromInputFile(filePath); + final List actualViolations = getActualViolationsForFile(config, filePath); + + verifyViolations(filePath, violations, actualViolations); + } + + /** + * Tests the file with the check config. + * + * @param config check configuration. + * @param file input file path. + * @return list of actual violations. + * @throws Exception if exception occurs during verification process. + */ + private List getActualViolationsForFile(Configuration config, + String file) throws Exception { + stream.flush(); + stream.reset(); + final List files = Collections.singletonList(new File(file)); + final Checker checker = createChecker(config); + final Map> actualViolations = + getActualViolations(checker.process(files)); + checker.destroy(); + return actualViolations.getOrDefault(file, new ArrayList<>()); + } + + /** + * Returns the actual violations for each file that has been checked against {@link Checker}. + * Each file is mapped to their corresponding violation messages. Reads input stream for these + * messages using instance of {@link InputStreamReader}. + * + * @param errorCount count of errors after checking set of files against {@link Checker}. + * @return a {@link Map} object containing file names and the corresponding violation messages. + * @throws IOException exception can occur when reading input stream. + */ + private Map> getActualViolations(int errorCount) throws IOException { + // process each of the lines + try (ByteArrayInputStream inputStream = + new ByteArrayInputStream(stream.toByteArray()); + LineNumberReader lnr = new LineNumberReader( + new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { + final Map> actualViolations = new HashMap<>(); + for (String line = lnr.readLine(); line != null && lnr.getLineNumber() <= errorCount; + line = lnr.readLine()) { + // have at least 2 characters before the splitting colon, + // to not split after the drive letter on Windows + final String[] actualViolation = line.split("(?<=.{2}):", 2); + final String actualViolationFileName = actualViolation[0]; + final String actualViolationMessage = actualViolation[1]; + + actualViolations + .computeIfAbsent(actualViolationFileName, key -> new ArrayList<>()) + .add(actualViolationMessage); + } + + return actualViolations; + } + } + + /** + * Performs verification of violation lines. + * + * @param file file path. + * @param testInputViolations List of TestInputViolation objects. + * @param actualViolations for a file + */ + private static void verifyViolations(String file, List testInputViolations, + List actualViolations) { + final List actualViolationLines = actualViolations.stream() + .map(violation -> violation.substring(0, violation.indexOf(':'))) + .map(Integer::valueOf) + .collect(Collectors.toUnmodifiableList()); + final List expectedViolationLines = testInputViolations.stream() + .map(TestInputViolation::getLineNo) + .collect(Collectors.toUnmodifiableList()); + assertWithMessage("Violation lines for %s differ.", file) + .that(actualViolationLines) + .isEqualTo(expectedViolationLines); + for (int index = 0; index < actualViolations.size(); index++) { + assertWithMessage("Actual and expected violations differ.") + .that(actualViolations.get(index)) + .matches(testInputViolations.get(index).toRegex()); + } + } + /** * Gets the check message 'as is' from appropriate 'messages.properties' * file. diff --git a/src/it/java/org/checkstyle/checks/imports/ImportOrderTest.java b/src/it/java/org/checkstyle/checks/imports/ImportOrderTest.java index 76bd726cc96..e83e006fcd7 100644 --- a/src/it/java/org/checkstyle/checks/imports/ImportOrderTest.java +++ b/src/it/java/org/checkstyle/checks/imports/ImportOrderTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/AbstractXpathTestSupport.java b/src/it/java/org/checkstyle/suppressionxpathfilter/AbstractXpathTestSupport.java index be3e706d9e0..c9d904dade5 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/AbstractXpathTestSupport.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/AbstractXpathTestSupport.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -25,9 +25,9 @@ import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Path; import java.util.List; import java.util.Locale; +import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -56,7 +56,7 @@ public abstract class AbstractXpathTestSupport extends AbstractCheckstyleModuleT * The temporary folder to hold intermediate files. */ @TempDir - public Path temporaryFolder; + public File temporaryFolder; /** * Returns name of the check. @@ -120,9 +120,10 @@ private static void verifyXpathQueries(List generatedXpathQueries, private String createSuppressionsXpathConfigFile(String checkName, List xpathQueries) throws Exception { - final Path suppressionsXpathConfigPath = - Files.createTempFile(temporaryFolder, "", ""); - try (Writer bw = Files.newBufferedWriter(suppressionsXpathConfigPath, + final String uniqueFileName = + "suppressions_xpath_config_" + UUID.randomUUID() + ".xml"; + final File suppressionsXpathConfigPath = new File(temporaryFolder, uniqueFileName); + try (Writer bw = Files.newBufferedWriter(suppressionsXpathConfigPath.toPath(), StandardCharsets.UTF_8)) { bw.write("\n"); bw.write(" expectedXpathQueries) throws Exception { + if (expectedViolation.length != 1) { + throw new IllegalArgumentException( + "Expected violations should contain exactly one element." + + " Multiple violations are not supported." + ); + } + final ViolationPosition position = - extractLineAndColumnNumber(expectedViolations); + extractLineAndColumnNumber(expectedViolation); final List generatedXpathQueries = generateXpathQueries(fileToProcess, position); @@ -211,7 +220,7 @@ protected void runVerifications(DefaultConfiguration moduleConfig, generatedXpathQueries)); final Integer[] warnList = getLinesWithWarn(fileToProcess.getPath()); - verify(moduleConfig, fileToProcess.getPath(), expectedViolations, warnList); + verify(moduleConfig, fileToProcess.getPath(), expectedViolation, warnList); verifyXpathQueries(generatedXpathQueries, expectedXpathQueries); verify(treeWalkerConfigWithXpath, fileToProcess.getPath(), CommonUtil.EMPTY_STRING_ARRAY); } diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java index 341faa4ae84..b1e77d45b0a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbbreviationAsWordInNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testAnnotation() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation.java")); + "InputXpathAbbreviationAsWordInNameAnnotation.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -52,7 +52,7 @@ public void testAnnotation() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation']]" + + "@text='InputXpathAbbreviationAsWordInNameAnnotation']]" + "/OBJBLOCK/ANNOTATION_DEF/IDENT[@text='ANNOTATION']" ); @@ -63,7 +63,7 @@ public void testAnnotation() throws Exception { @Test public void testAnnotationField() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField.java")); + "InputXpathAbbreviationAsWordInNameAnnotationField.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -75,7 +75,7 @@ public void testAnnotationField() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/ANNOTATION_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField']]" + + "@text='InputXpathAbbreviationAsWordInNameAnnotationField']]" + "/OBJBLOCK/ANNOTATION_FIELD_DEF/IDENT[@text='ANNOTATION_FIELD']" ); @@ -86,7 +86,7 @@ public void testAnnotationField() throws Exception { @Test public void testClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameClass.java")); + "InputXpathAbbreviationAsWordInNameClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -98,7 +98,7 @@ public void testClass() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameClass']]" + + "@text='InputXpathAbbreviationAsWordInNameClass']]" + "/OBJBLOCK/CLASS_DEF/IDENT[@text='CLASS']" ); @@ -109,7 +109,7 @@ public void testClass() throws Exception { @Test public void testEnum() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameEnum.java")); + "InputXpathAbbreviationAsWordInNameEnum.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -121,7 +121,7 @@ public void testEnum() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameEnum']]" + + "@text='InputXpathAbbreviationAsWordInNameEnum']]" + "/OBJBLOCK/ENUM_DEF/IDENT[@text='ENUMERATION']" ); @@ -132,7 +132,7 @@ public void testEnum() throws Exception { @Test public void testField() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameField.java")); + "InputXpathAbbreviationAsWordInNameField.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -144,7 +144,7 @@ public void testField() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameField']]" + + "@text='InputXpathAbbreviationAsWordInNameField']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='FIELD']" ); @@ -155,7 +155,7 @@ public void testField() throws Exception { @Test public void testInterface() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameInterface.java")); + "InputXpathAbbreviationAsWordInNameInterface.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -167,7 +167,7 @@ public void testInterface() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameInterface']]" + + "@text='InputXpathAbbreviationAsWordInNameInterface']]" + "/OBJBLOCK/INTERFACE_DEF/IDENT[@text='INTERFACE']" ); @@ -178,7 +178,7 @@ public void testInterface() throws Exception { @Test public void testMethod() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameMethod.java")); + "InputXpathAbbreviationAsWordInNameMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -190,7 +190,7 @@ public void testMethod() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameMethod']]" + + "@text='InputXpathAbbreviationAsWordInNameMethod']]" + "/OBJBLOCK/METHOD_DEF/IDENT[@text='METHOD']" ); @@ -201,7 +201,7 @@ public void testMethod() throws Exception { @Test public void testParameter() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameParameter.java")); + "InputXpathAbbreviationAsWordInNameParameter.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -213,7 +213,7 @@ public void testParameter() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameParameter']]" + + "@text='InputXpathAbbreviationAsWordInNameParameter']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='PARAMETER']" ); @@ -225,7 +225,7 @@ public void testParameter() throws Exception { @Test public void testVariable() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAbbreviationAsWordInNameVariable.java")); + "InputXpathAbbreviationAsWordInNameVariable.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbbreviationAsWordInNameCheck.class); @@ -237,7 +237,7 @@ public void testVariable() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAbbreviationAsWordInNameVariable']]" + + "@text='InputXpathAbbreviationAsWordInNameVariable']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + "/SLIST/VARIABLE_DEF/IDENT[@text='VARIABLE']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbstractClassNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbstractClassNameTest.java index 85533e76f0d..a3dad7eb76a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbstractClassNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAbstractClassNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testClassNameTop() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionAbstractClassNameTop.java")); + new File(getPath("InputXpathAbstractClassNameTop.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbstractClassNameCheck.class); @@ -48,17 +48,17 @@ public void testClassNameTop() throws Exception { final String[] expectedViolation = { "3:1: " + getCheckMessage(AbstractClassNameCheck.class, AbstractClassNameCheck.MSG_ILLEGAL_ABSTRACT_CLASS_NAME, - "SuppressionXpathRegressionAbstractClassNameTop", "^Abstract.+$"), + "InputXpathAbstractClassNameTop", "^Abstract.+$"), }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAbstractClassNameTop']]", + + "[./IDENT[@text='InputXpathAbstractClassNameTop']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAbstractClassNameTop']]" + + "[./IDENT[@text='InputXpathAbstractClassNameTop']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAbstractClassNameTop']]" + + "[./IDENT[@text='InputXpathAbstractClassNameTop']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -69,7 +69,7 @@ public void testClassNameTop() throws Exception { @Test public void testClassNameInner() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionAbstractClassNameInner.java")); + new File(getPath("InputXpathAbstractClassNameInner.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbstractClassNameCheck.class); @@ -82,13 +82,13 @@ public void testClassNameInner() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAbstractClassNameInner']]" + + "[./IDENT[@text='InputXpathAbstractClassNameInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='MyClass']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAbstractClassNameInner']]" + + "[./IDENT[@text='InputXpathAbstractClassNameInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='MyClass']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAbstractClassNameInner']]" + + "[./IDENT[@text='InputXpathAbstractClassNameInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='MyClass']]/MODIFIERS/ABSTRACT" ); @@ -99,7 +99,7 @@ public void testClassNameInner() throws Exception { @Test public void testClassNameNoModifier() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionAbstractClassNameNoModifier.java")); + new File(getPath("InputXpathAbstractClassNameNoModifier.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AbstractClassNameCheck.class); @@ -112,13 +112,13 @@ public void testClassNameNoModifier() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAbstractClassNameNoModifier']]" + + "InputXpathAbstractClassNameNoModifier']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='AbstractMyClass']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAbstractClassNameNoModifier']]" + + "InputXpathAbstractClassNameNoModifier']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='AbstractMyClass']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAbstractClassNameNoModifier']]" + + "InputXpathAbstractClassNameNoModifier']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='AbstractMyClass']]/LITERAL_CLASS" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java index 8e8fbf78e16..96042a77977 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationLocationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationLocationClass.java")); + "InputXpathAnnotationLocationClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationLocationCheck.class); @@ -52,15 +52,15 @@ public void testClass() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationClass']]", + + "[./IDENT[@text='InputXpathAnnotationLocationClass']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationClass']]" + + "[./IDENT[@text='InputXpathAnnotationLocationClass']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationClass']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationClass']]/" + "MODIFIERS/ANNOTATION[./IDENT[@text='ClassAnnotation']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationClass']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationClass']]/" + "MODIFIERS/ANNOTATION[./IDENT[@text='ClassAnnotation']]/AT" ); @@ -71,7 +71,7 @@ public void testClass() throws Exception { @Test public void testInterface() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationLocationInterface.java")); + "InputXpathAnnotationLocationInterface.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationLocationCheck.class); @@ -84,16 +84,16 @@ public void testInterface() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationInterface']]", + + "[./IDENT[@text='" + + "InputXpathAnnotationLocationInterface']]", "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationInterface'" + + "[./IDENT[@text='InputXpathAnnotationLocationInterface'" + "]]/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationInterface']]" + + "[./IDENT[@text='InputXpathAnnotationLocationInterface']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='InterfaceAnnotation']]", "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationInterface']]" + + "[./IDENT[@text='InputXpathAnnotationLocationInterface']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='InterfaceAnnotation']]/AT" ); @@ -104,7 +104,7 @@ public void testInterface() throws Exception { @Test public void testEnum() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationLocationEnum.java")); + "InputXpathAnnotationLocationEnum.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationLocationCheck.class); @@ -116,16 +116,16 @@ public void testEnum() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/ENUM_DEF[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationEnum']]", + "/COMPILATION_UNIT/ENUM_DEF[./IDENT[@text='" + + "InputXpathAnnotationLocationEnum']]", "/COMPILATION_UNIT/ENUM_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationEnum']]" + + "[./IDENT[@text='InputXpathAnnotationLocationEnum']]" + "/MODIFIERS", "/COMPILATION_UNIT/ENUM_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationEnum']]" + + "[./IDENT[@text='InputXpathAnnotationLocationEnum']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='EnumAnnotation']]", "/COMPILATION_UNIT/ENUM_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationEnum']]" + + "[./IDENT[@text='InputXpathAnnotationLocationEnum']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='EnumAnnotation']]/AT" ); @@ -137,7 +137,7 @@ public void testEnum() throws Exception { @Test public void testMethod() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationLocationMethod.java")); + "InputXpathAnnotationLocationMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationLocationCheck.class); @@ -151,17 +151,17 @@ public void testMethod() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationMethod']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationMethod']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationMethod']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationMethod']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationMethod']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationMethod']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]/MODIFIERS/" + "ANNOTATION[./IDENT[@text='MethodAnnotation']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationMethod']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationMethod']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]/MODIFIERS/" + "ANNOTATION[./IDENT[@text='MethodAnnotation']]/AT" ); @@ -174,7 +174,7 @@ public void testMethod() throws Exception { @Test public void testVariable() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationLocationVariable.java")); + "InputXpathAnnotationLocationVariable.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationLocationCheck.class); @@ -188,17 +188,17 @@ public void testVariable() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationVariable']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationVariable']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='b']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationVariable']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationVariable']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='b']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationVariable']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationVariable']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='b']]/MODIFIERS/" + "ANNOTATION[./IDENT[@text='VariableAnnotation']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationLocationVariable']]/" + + "[./IDENT[@text='InputXpathAnnotationLocationVariable']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='b']]/MODIFIERS/" + "ANNOTATION[./IDENT[@text='VariableAnnotation']]/AT" ); @@ -211,7 +211,7 @@ public void testVariable() throws Exception { @Test public void testConstructor() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationLocationCTOR.java")); + "InputXpathAnnotationLocationCTOR.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationLocationCheck.class); @@ -224,23 +224,23 @@ public void testConstructor() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" - + "[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" - + "[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/MODIFIERS", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" - + "[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/" + "MODIFIERS/ANNOTATION[./IDENT[@text='CTORAnnotation']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" - + "[./IDENT[@text='SuppressionXpathRegression" - + "AnnotationLocationCTOR']]/" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='" + + "InputXpathAnnotationLocationCTOR']]/" + "MODIFIERS/ANNOTATION[./IDENT[@text='CTORAnnotation']]/AT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationOnSameLineTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationOnSameLineTest.java index 556b26f222b..d44229ee044 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationOnSameLineTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationOnSameLineTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationOnSameLineOne.java")); + "InputXpathAnnotationOnSameLineMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationOnSameLineCheck.class); @@ -60,17 +60,17 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineOne']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='getX']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineOne']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='getX']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineOne']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='getX']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='Deprecated']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineOne']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='getX']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]/AT" ); @@ -83,7 +83,7 @@ public void testOne() throws Exception { public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationOnSameLineTwo.java")); + "InputXpathAnnotationOnSameLineField.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationOnSameLineCheck.class); @@ -96,17 +96,17 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineTwo']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='names']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineTwo']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='names']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineTwo']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='names']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='Deprecated']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineTwo']]" + + "[./IDENT[@text='InputXpathAnnotationOnSameLineField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='names']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='Deprecated']]/AT" ); @@ -119,7 +119,7 @@ public void testTwo() throws Exception { public void testThree() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationOnSameLineThree.java")); + "InputXpathAnnotationOnSameLineInterface.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationOnSameLineCheck.class); @@ -136,15 +136,15 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[" - + "./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineThree']]", + + "./IDENT[@text='InputXpathAnnotationOnSameLineInterface']]", "/COMPILATION_UNIT/INTERFACE_DEF[" - + "./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineThree']]" + + "./IDENT[@text='InputXpathAnnotationOnSameLineInterface']]" + "/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[" - + "./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineThree']]" + + "./IDENT[@text='InputXpathAnnotationOnSameLineInterface']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]", "/COMPILATION_UNIT/INTERFACE_DEF[" - + "./IDENT[@text='SuppressionXpathRegressionAnnotationOnSameLineThree']]" + + "./IDENT[@text='InputXpathAnnotationOnSameLineInterface']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]/AT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationUseStyleTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationUseStyleTest.java index a008f1d3ca7..c6622f42498 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationUseStyleTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnnotationUseStyleTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleOne.java")); + "InputXpathAnnotationUseStyleOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -54,10 +54,10 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleOne']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleOne']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleOne']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]/AT" ); @@ -68,7 +68,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleTwo.java")); + "InputXpathAnnotationUseStyleTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -84,15 +84,15 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleTwo']]", + + "[./IDENT[@text='InputXpathAnnotationUseStyleTwo']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleTwo']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleTwo']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleTwo']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleTwo']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleTwo']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleTwo']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='Deprecated']]/AT" ); @@ -103,7 +103,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleThree.java")); + "InputXpathAnnotationUseStyleThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -118,17 +118,17 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleThree']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleThree']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleThree']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='SuppressWarnings']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleThree']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='SuppressWarnings']]/AT" ); @@ -140,7 +140,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleFour.java")); + "InputXpathAnnotationUseStyleFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -156,7 +156,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleFour']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleFour']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]" + "/ANNOTATION_ARRAY_INIT/RCURLY" ); @@ -168,7 +168,7 @@ public void testFour() throws Exception { @Test public void testFive() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleFive.java")); + "InputXpathAnnotationUseStyleFive.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -185,15 +185,15 @@ public void testFive() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleFive']]", + + "[./IDENT[@text='InputXpathAnnotationUseStyleFive']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleFive']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleFive']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleFive']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleFive']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleFive']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleFive']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]/AT" ); @@ -204,7 +204,7 @@ public void testFive() throws Exception { @Test public void testSix() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleSix.java")); + "InputXpathAnnotationUseStyleSix.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -221,15 +221,15 @@ public void testSix() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleSix']]", + + "[./IDENT[@text='InputXpathAnnotationUseStyleSix']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleSix']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleSix']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleSix']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleSix']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleSix']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleSix']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]/AT" ); @@ -240,7 +240,7 @@ public void testSix() throws Exception { @Test public void testSeven() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleSeven.java")); + "InputXpathAnnotationUseStyleSeven.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -253,10 +253,10 @@ public void testSeven() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleSeven']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleSeven']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleSeven']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleSeven']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]/AT" ); @@ -267,7 +267,7 @@ public void testSeven() throws Exception { @Test public void testEight() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAnnotationUseStyleEight.java")); + "InputXpathAnnotationUseStyleEight.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnnotationUseStyleCheck.class); @@ -283,7 +283,7 @@ public void testEight() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnnotationUseStyleEight']]" + + "[./IDENT[@text='InputXpathAnnotationUseStyleEight']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='SuppressWarnings']]" + "/ANNOTATION_ARRAY_INIT/COMMA" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java index 73c79b4deb4..0c89c9af45c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAnonInnerLengthTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionAnonInnerLengthDefault.java")); + new File(getPath("InputXpathAnonInnerLengthDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnonInnerLengthCheck.class); @@ -52,12 +52,12 @@ public void testDefault() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnonInnerLengthDefault']]" + + "[./IDENT[@text='InputXpathAnonInnerLengthDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='runnable']]" + "/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnonInnerLengthDefault']]" + + "[./IDENT[@text='InputXpathAnonInnerLengthDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='runnable']]" + "/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='Runnable']]" @@ -71,7 +71,7 @@ public void testDefault() throws Exception { public void testMaxLength() throws Exception { final int maxLen = 5; final File fileToProcess = - new File(getPath("SuppressionXpathRegressionAnonInnerLength.java")); + new File(getPath("InputXpathAnonInnerLength.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AnonInnerLengthCheck.class); @@ -84,11 +84,11 @@ public void testMaxLength() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnonInnerLength']]" + + "[./IDENT[@text='InputXpathAnonInnerLength']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='compare']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='comp']]/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAnonInnerLength']]" + + "[./IDENT[@text='InputXpathAnonInnerLength']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='compare']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='comp']]/ASSIGN/EXPR" + "/LITERAL_NEW[./IDENT[@text='Comparator']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTrailingCommaTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTrailingCommaTest.java index cfb90ed0166..ef481fbef70 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTrailingCommaTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTrailingCommaTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionArrayTrailingCommaOne.java")); + new File(getPath("InputXpathArrayTrailingCommaLinear.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ArrayTrailingCommaCheck.class); @@ -53,11 +53,11 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionArrayTrailingCommaOne']]" + + "[./IDENT[@text='InputXpathArrayTrailingCommaLinear']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a2']]/ASSIGN/EXPR/LITERAL_NEW" + "/ARRAY_INIT/EXPR[./NUM_INT[@text='3']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionArrayTrailingCommaOne']]" + + "[./IDENT[@text='InputXpathArrayTrailingCommaLinear']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a2']]/ASSIGN/EXPR/LITERAL_NEW" + "/ARRAY_INIT/EXPR/NUM_INT[@text='3']" ); @@ -69,7 +69,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionArrayTrailingCommaTwo.java")); + new File(getPath("InputXpathArrayTrailingCommaMatrix.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ArrayTrailingCommaCheck.class); @@ -81,7 +81,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionArrayTrailingCommaTwo']]" + + "[./IDENT[@text='InputXpathArrayTrailingCommaMatrix']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='d2']]/ASSIGN/EXPR/LITERAL_NEW" + "/ARRAY_INIT/ARRAY_INIT[./EXPR/NUM_INT[@text='5']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTypeStyleTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTypeStyleTest.java index c458489bc76..e49232f3039 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTypeStyleTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionArrayTypeStyleTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,7 +38,7 @@ protected String getCheckName() { @Test public void testVariable() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionArrayTypeStyleVariable.java")); + new File(getPath("InputXpathArrayTypeStyleVariable.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ArrayTypeStyleCheck.class); @@ -49,7 +49,7 @@ public void testVariable() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionArrayTypeStyleVariable']]" + + "[./IDENT[@text='InputXpathArrayTypeStyleVariable']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='strings']]/TYPE[" + "./IDENT[@text='String']]/ARRAY_DECLARATOR" ); @@ -61,7 +61,7 @@ public void testVariable() throws Exception { @Test public void testMethodDef() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionArrayTypeStyleMethodDef.java")); + new File(getPath("InputXpathArrayTypeStyleMethodDef.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ArrayTypeStyleCheck.class); @@ -72,7 +72,7 @@ public void testMethodDef() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionArrayTypeStyleMethodDef']]" + + "[./IDENT[@text='InputXpathArrayTypeStyleMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='getData']]/TYPE/ARRAY_DECLARATOR" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidDoubleBraceInitializationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidDoubleBraceInitializationTest.java index b58f566f6aa..ceb996630c2 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidDoubleBraceInitializationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidDoubleBraceInitializationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testClassFields() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidDoubleBraceInitialization.java")); + getPath("InputXpathAvoidDoubleBraceInitializationClassFields.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -51,11 +51,11 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidDoubleBraceInitialization']]" + + "[./IDENT[@text='InputXpathAvoidDoubleBraceInitializationClassFields']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='list']]/ASSIGN/EXPR/" + "LITERAL_NEW[./IDENT[@text='ArrayList']]/OBJBLOCK", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidDoubleBraceInitialization']]" + + "[./IDENT[@text='InputXpathAvoidDoubleBraceInitializationClassFields']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='list']]/ASSIGN/EXPR/" + "LITERAL_NEW[./IDENT[@text='ArrayList']]/OBJBLOCK/LCURLY" ); @@ -64,9 +64,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testMethodDef() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo.java")); + getPath("InputXpathAvoidDoubleBraceInitializationMethodDef.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -76,12 +76,12 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo']]" + + "'InputXpathAvoidDoubleBraceInitializationMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='HashSet']]" + "/OBJBLOCK", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo']]" + + "'InputXpathAvoidDoubleBraceInitializationMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='HashSet']]" + "/OBJBLOCK/LCURLY" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java index b8664a98f7c..56bec5bc969 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidEscapedUnicodeCharactersTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testDefault() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault.java")); + "InputXpathAvoidEscapedUnicodeCharactersDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class); @@ -52,11 +52,11 @@ public void testDefault() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault']]" + + "[@text='InputXpathAvoidEscapedUnicodeCharactersDefault']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev2']]" + "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault']]" + + "[@text='InputXpathAvoidEscapedUnicodeCharactersDefault']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev2']]" + "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']" ); @@ -68,7 +68,7 @@ public void testDefault() throws Exception { @Test public void testControlCharacters() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters.java") + "InputXpathAvoidEscapedUnicodeCharactersControlCharacters.java") ); final DefaultConfiguration moduleConfig = @@ -82,12 +82,12 @@ public void testControlCharacters() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters']]" + + "'InputXpathAvoidEscapedUnicodeCharactersControlCharacters']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]", "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters']]" + + "'InputXpathAvoidEscapedUnicodeCharactersControlCharacters']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']" ); @@ -99,7 +99,7 @@ public void testControlCharacters() throws Exception { @Test public void testTailComment() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment.java")); + "InputXpathAvoidEscapedUnicodeCharactersTailComment.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class); @@ -112,12 +112,12 @@ public void testTailComment() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment']]" + + "'InputXpathAvoidEscapedUnicodeCharactersTailComment']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]", "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment']]" + + "'InputXpathAvoidEscapedUnicodeCharactersTailComment']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']" ); @@ -129,7 +129,7 @@ public void testTailComment() throws Exception { @Test public void testAllCharactersEscaped() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped.java")); + "InputXpathAvoidEscapedUnicodeCharactersAllEscaped.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class); @@ -142,12 +142,12 @@ public void testAllCharactersEscaped() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped']]" + + "'InputXpathAvoidEscapedUnicodeCharactersAllEscaped']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]", "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped']]" + + "'InputXpathAvoidEscapedUnicodeCharactersAllEscaped']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']" ); @@ -159,7 +159,7 @@ public void testAllCharactersEscaped() throws Exception { @Test public void testNonPrintableCharacters() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable.java")); + "InputXpathAvoidEscapedUnicodeCharactersNonPrintable.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidEscapedUnicodeCharactersCheck.class); @@ -172,12 +172,12 @@ public void testNonPrintableCharacters() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable']]" + + "'InputXpathAvoidEscapedUnicodeCharactersNonPrintable']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR[./STRING_LITERAL[@text='\\u03bcs']]", "/COMPILATION_UNIT/CLASS_DEF[." + "/IDENT[@text=" - + "'SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable']]" + + "'InputXpathAvoidEscapedUnicodeCharactersNonPrintable']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='unitAbbrev9']]" + "/ASSIGN/EXPR/STRING_LITERAL[@text='\\u03bcs']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidInlineConditionalsTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidInlineConditionalsTest.java index 8a488bfc591..da04e7a6bd8 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidInlineConditionalsTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidInlineConditionalsTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,7 +39,7 @@ protected String getCheckName() { @Test public void testInlineConditionalsVariableDef() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidInlineConditionalsVariableDef.java")); + getPath("InputXpathAvoidInlineConditionalsVariableDef.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidInlineConditionalsCheck.class); @@ -51,11 +51,11 @@ public void testInlineConditionalsVariableDef() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAvoidInlineConditionalsVariableDef']]" + + "InputXpathAvoidInlineConditionalsVariableDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='substring']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='b']]/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAvoidInlineConditionalsVariableDef']]" + + "InputXpathAvoidInlineConditionalsVariableDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='substring']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='b']]/ASSIGN/EXPR/QUESTION" ); @@ -67,7 +67,7 @@ public void testInlineConditionalsVariableDef() throws Exception { @Test public void testInlineConditionalsAssign() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidInlineConditionalsAssign.java")); + getPath("InputXpathAvoidInlineConditionalsAssign.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidInlineConditionalsCheck.class); @@ -79,7 +79,7 @@ public void testInlineConditionalsAssign() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAvoidInlineConditionalsAssign']]" + + "InputXpathAvoidInlineConditionalsAssign']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setB']]/SLIST" + "/EXPR/ASSIGN[./IDENT[@text='b']]/QUESTION" ); @@ -91,7 +91,7 @@ public void testInlineConditionalsAssign() throws Exception { @Test public void testInlineConditionalsAssert() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidInlineConditionalsAssert.java")); + getPath("InputXpathAvoidInlineConditionalsAssert.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidInlineConditionalsCheck.class); @@ -103,11 +103,11 @@ public void testInlineConditionalsAssert() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAvoidInlineConditionalsAssert']]" + + "InputXpathAvoidInlineConditionalsAssert']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='assertA']]/SLIST" + "/LITERAL_ASSERT/EXPR[./QUESTION/METHOD_CALL/DOT/IDENT[@text='a']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='" - + "SuppressionXpathRegressionAvoidInlineConditionalsAssert']]" + + "InputXpathAvoidInlineConditionalsAssert']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='assertA']]/SLIST" + "/LITERAL_ASSERT/EXPR/QUESTION" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNestedBlocksTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNestedBlocksTest.java index 1e68266aba2..e14606d97ef 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNestedBlocksTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNestedBlocksTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,7 +39,7 @@ protected String getCheckName() { @Test public void testEmpty() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidNestedBlocksEmpty.java")); + getPath("InputXpathAvoidNestedBlocksEmpty.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidNestedBlocksCheck.class); @@ -51,7 +51,7 @@ public void testEmpty() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksEmpty']]" + + "[./IDENT[@text='InputXpathAvoidNestedBlocksEmpty']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='empty']]/SLIST/SLIST" ); @@ -62,7 +62,7 @@ public void testEmpty() throws Exception { @Test public void testVariableAssignment() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidNestedBlocksVariable.java")); + getPath("InputXpathAvoidNestedBlocksVariable.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidNestedBlocksCheck.class); @@ -74,7 +74,7 @@ public void testVariableAssignment() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksVariable']]" + + "[./IDENT[@text='InputXpathAvoidNestedBlocksVariable']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='varAssign']]/SLIST/SLIST" ); @@ -84,8 +84,8 @@ public void testVariableAssignment() throws Exception { @Test public void testSwitchAllowInSwitchCaseFalse() throws Exception { - final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidNestedBlocksSwitch1.java")); + final File fileToProcess = new File(getPath( + "InputXpathAvoidNestedBlocksNotAllowedInSwitchCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidNestedBlocksCheck.class); @@ -93,21 +93,17 @@ public void testSwitchAllowInSwitchCaseFalse() throws Exception { final String[] expectedViolation = { "9:21: " + getCheckMessage(AvoidNestedBlocksCheck.class, AvoidNestedBlocksCheck.MSG_KEY_BLOCK_NESTED), - "16:13: " + getCheckMessage(AvoidNestedBlocksCheck.class, - AvoidNestedBlocksCheck.MSG_KEY_BLOCK_NESTED), - "20:21: " + getCheckMessage(AvoidNestedBlocksCheck.class, - AvoidNestedBlocksCheck.MSG_KEY_BLOCK_NESTED), }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksSwitch1']]" - + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH" - + "/CASE_GROUP/SLIST", + + "[./IDENT[@text='InputXpathAvoidNestedBlocksNotAllowedInSwitchCase" + + "']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksSwitch1']]" - + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH" - + "/CASE_GROUP/SLIST/SLIST" + + "[./IDENT[@text='InputXpathAvoidNestedBlocksNotAllowedInSwitchCase" + + "']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/SLIST" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -117,28 +113,50 @@ public void testSwitchAllowInSwitchCaseFalse() throws Exception { @Test public void testSwitchAllowInSwitchCaseTrue() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionAvoidNestedBlocksSwitch2.java")); + getPath("InputXpathAvoidNestedBlocksAllowedInSwitchCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(AvoidNestedBlocksCheck.class); moduleConfig.addProperty("allowInSwitchCase", "true"); final String[] expectedViolation = { - "9:21: " + getCheckMessage(AvoidNestedBlocksCheck.class, + "11:13: " + getCheckMessage(AvoidNestedBlocksCheck.class, AvoidNestedBlocksCheck.MSG_KEY_BLOCK_NESTED), - "16:13: " + getCheckMessage(AvoidNestedBlocksCheck.class, + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathAvoidNestedBlocksAllowedInSwitchCase" + + "']]/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]" + + "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/SLIST" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testSwitchWithBreakOutside() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathAvoidNestedBlocksBreakOutside.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(AvoidNestedBlocksCheck.class); + + final String[] expectedViolation = { + "8:21: " + getCheckMessage(AvoidNestedBlocksCheck.class, AvoidNestedBlocksCheck.MSG_KEY_BLOCK_NESTED), }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksSwitch2']]" - + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH" - + "/CASE_GROUP/SLIST", - "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionAvoidNestedBlocksSwitch2']]" - + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]/SLIST/LITERAL_SWITCH" - + "/CASE_GROUP/SLIST/SLIST" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathAvoidNestedBlocksBreakOutside']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]" + + "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathAvoidNestedBlocksBreakOutside']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='s']]" + + "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/SLIST" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java index 6b752793f6a..42741bf3241 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidNoArgumentSuperConstructorCallTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testDefault() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall.java")); + "InputXpathAvoidNoArgumentSuperConstructorCallDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -54,9 +54,9 @@ public void testDefault() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall']]" + + "[@text='InputXpathAvoidNoArgumentSuperConstructorCallDefault']]" + "/OBJBLOCK/CTOR_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall']]" + + "@text='InputXpathAvoidNoArgumentSuperConstructorCallDefault']]" + "/SLIST/SUPER_CTOR_CALL" ); @@ -66,7 +66,7 @@ public void testDefault() throws Exception { @Test public void testInnerClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCallInnerClass.java" + "InputXpathAvoidNoArgumentSuperConstructorCallInnerClass.java" )); final DefaultConfiguration moduleConfig = @@ -79,7 +79,7 @@ public void testInnerClass() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCallInnerClass']]" + + "'InputXpathAvoidNoArgumentSuperConstructorCallInnerClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/CLASS_DEF[./IDENT[@text='Inner']]" + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='Inner']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStarImportTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStarImportTest.java index 8a567e4d6fa..3ff7b2b80ad 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStarImportTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStarImportTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidStarImport1.java")); + "InputXpathAvoidStarImportOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -62,7 +62,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidStarImport2.java")); + "InputXpathAvoidStarImportTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImportTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImportTest.java index 275abbf413a..82b63e30a63 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImportTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionAvoidStaticImportTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidStaticImport1.java")); + "InputXpathAvoidStaticImportOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -62,7 +62,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionAvoidStaticImport2.java")); + "InputXpathAvoidStaticImportTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionBooleanExpressionComplexityTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionBooleanExpressionComplexityTest.java new file mode 100644 index 00000000000..75badfd2c7d --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionBooleanExpressionComplexityTest.java @@ -0,0 +1,110 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.metrics.BooleanExpressionComplexityCheck; + +public class XpathRegressionBooleanExpressionComplexityTest + extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return BooleanExpressionComplexityCheck.class.getSimpleName(); + } + + @Test + public void testCatchBlock() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathBooleanExpressionComplexityCatchBlock.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(BooleanExpressionComplexityCheck.class); + + final String[] expectedViolationMessages = { + "10:23: " + getCheckMessage(BooleanExpressionComplexityCheck.class, + BooleanExpressionComplexityCheck.MSG_KEY, 11, 3), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathBooleanExpressionComplexityCatchBlock']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]/SLIST" + + "/LITERAL_TRY/LITERAL_CATCH/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='d']]/ASSIGN" + ); + + runVerifications(moduleConfig, fileToProcess, + expectedViolationMessages, expectedXpathQueries); + } + + @Test + public void testClassFields() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathBooleanExpressionComplexityClassFields.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(BooleanExpressionComplexityCheck.class); + + final String[] expectedViolationMessages = { + "9:19: " + getCheckMessage(BooleanExpressionComplexityCheck.class, + BooleanExpressionComplexityCheck.MSG_KEY, 11, 3), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathBooleanExpressionComplexityClassFields']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodTwo']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='d']]/ASSIGN" + ); + + runVerifications(moduleConfig, fileToProcess, + expectedViolationMessages, expectedXpathQueries); + } + + @Test + public void testConditionals() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathBooleanExpressionComplexityConditionals.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(BooleanExpressionComplexityCheck.class); + + final String[] expectedViolationMessages = { + "9:9: " + getCheckMessage(BooleanExpressionComplexityCheck.class, + BooleanExpressionComplexityCheck.MSG_KEY, 4, 3), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathBooleanExpressionComplexityConditionals']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodThree']]/SLIST/LITERAL_IF" + ); + + runVerifications(moduleConfig, fileToProcess, + expectedViolationMessages, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java new file mode 100644 index 00000000000..4dafea4bfb5 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCatchParameterNameTest.java @@ -0,0 +1,230 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.naming.CatchParameterNameCheck; + +public class XpathRegressionCatchParameterNameTest extends AbstractXpathTestSupport { + private final String checkName = CatchParameterNameCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testSimple() throws Exception { + final String pattern = "^(e|t|ex|[a-z][a-z][a-zA-Z]+|_)$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameSimple.java")); + + final String[] expectedViolation = { + "6:28: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "e1", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF/IDENT[@text='e1']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testNested() throws Exception { + final String pattern = "^(e|t|ex|[a-z][a-z][a-zA-Z]+|_)$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameNested.java")); + + final String[] expectedViolation = { + "9:40: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "i", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameNested']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='NestedClass']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/SLIST/LITERAL_IF/SLIST" + + "/LITERAL_TRY/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF/IDENT[@text='i']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testStaticInit() throws Exception { + final String pattern = "^[a-z][a-zA-Z0-9]+$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameStaticInit.java")); + + final String[] expectedViolation = { + "7:32: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "Ex", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameStaticInit']]" + + "/OBJBLOCK/STATIC_INIT/SLIST" + + "/LITERAL_DO/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF/IDENT[@text='Ex']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testAnonymous() throws Exception { + final String pattern = "^[a-z][a-zA-Z0-9]+$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameAnonymous.java")); + + final String[] expectedViolation = { + "12:40: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "E1", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameAnonymous']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InnerClass']]" + + "/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='Runnable']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='run']]" + + "/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF/IDENT[@text='E1']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testLambda() throws Exception { + final String pattern = "^[A-Z][a-z]+$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameLambda.java")); + + final String[] expectedViolation = { + "12:32: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "e", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameLambda']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='lambdaFunction']]" + + "/ASSIGN/LAMBDA[./IDENT[@text='a']]" + + "/SLIST/LITERAL_FOR/SLIST/LITERAL_TRY/LITERAL_CATCH" + + "/PARAMETER_DEF/IDENT[@text='e']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testEnum() throws Exception { + final String pattern = "^[A-Z][a-z]+$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameEnum.java")); + + final String[] expectedViolation = { + "10:40: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "eX", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/ENUM_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameEnum']]" + + "/OBJBLOCK/ENUM_CONSTANT_DEF[./IDENT[@text='VALUE']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/LITERAL_TRY/LITERAL_CATCH/" + + "PARAMETER_DEF/IDENT[@text='eX']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testInterface() throws Exception { + final String pattern = "^[A-Z][a-z]+$"; + + final DefaultConfiguration moduleConfig = + createModuleConfig(CatchParameterNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final File fileToProcess = + new File(getPath("InputXpathCatchParameterNameInterface.java")); + + final String[] expectedViolation = { + "7:32: " + getCheckMessage(CatchParameterNameCheck.class, + MSG_INVALID_PATTERN, "EX", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/INTERFACE_DEF" + + "[./IDENT[@text='InputXpathCatchParameterNameInterface']]" + + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='InnerInterface']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF/IDENT[@text='EX']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java index d4a45d223f0..a4885bac3ca 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionClassMemberImpliedModifierTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testInterface() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionClassMemberImpliedModifierOne.java")); + new File(getPath("InputXpathClassMemberImpliedModifierInterface.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ClassMemberImpliedModifierCheck.class); @@ -52,13 +52,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionClassMemberImpliedModifierOne']]" + + "@text='InputXpathClassMemberImpliedModifierInterface']]" + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Foo']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionClassMemberImpliedModifierOne']]" + + "@text='InputXpathClassMemberImpliedModifierInterface']]" + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Foo']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionClassMemberImpliedModifierOne']]" + + "@text='InputXpathClassMemberImpliedModifierInterface']]" + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Foo']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -67,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testEnum() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionClassMemberImpliedModifierTwo.java")); + new File(getPath("InputXpathClassMemberImpliedModifierEnum.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ClassMemberImpliedModifierCheck.class); @@ -81,13 +81,13 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionClassMemberImpliedModifierTwo']]" + + "[./IDENT[@text='InputXpathClassMemberImpliedModifierEnum']]" + "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Count']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionClassMemberImpliedModifierTwo']]" + + "[./IDENT[@text='InputXpathClassMemberImpliedModifierEnum']]" + "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Count']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionClassMemberImpliedModifierTwo']]" + + "[./IDENT[@text='InputXpathClassMemberImpliedModifierEnum']]" + "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Count']]/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCommentsIndentationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCommentsIndentationTest.java index 3ea2c23d246..8431f8641d5 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCommentsIndentationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCommentsIndentationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,8 +40,7 @@ protected String getCheckName() { @Test public void testSingleLine() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "SingleLine.java")); + new File(getPath("InputXpathCommentsIndentationSingleLine.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -53,7 +52,7 @@ public void testSingleLine() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationSingleLine']]" + + "[@text='InputXpathCommentsIndentationSingleLine']]" + "/OBJBLOCK/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\n']]" ); @@ -64,8 +63,7 @@ public void testSingleLine() throws Exception { @Test public void testBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "Block.java")); + new File(getPath("InputXpathCommentsIndentationBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -77,7 +75,7 @@ public void testBlock() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationBlock']]/OBJBLOCK/" + + "[@text='InputXpathCommentsIndentationBlock']]/OBJBLOCK/" + "VARIABLE_DEF[./IDENT[@text='f']]/TYPE/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text=' // warn\\n * Javadoc comment\\n ']]" ); @@ -89,8 +87,7 @@ public void testBlock() throws Exception { @Test public void testSeparator() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "Separator.java")); + new File(getPath("InputXpathCommentsIndentationSeparator.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -102,7 +99,7 @@ public void testSeparator() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationSeparator']]" + + "[@text='InputXpathCommentsIndentationSeparator']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS/SINGLE_LINE_COMMENT" + "[./COMMENT_CONTENT[@text='///////////// Comment separator // warn\\n']]" ); @@ -114,8 +111,7 @@ public void testSeparator() throws Exception { @Test public void testDistributedStatement() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "DistributedStatement.java")); + new File(getPath("InputXpathCommentsIndentationDistributedStatement.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -127,7 +123,7 @@ public void testDistributedStatement() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationDistributedStatement']]" + + "[@text='InputXpathCommentsIndentationDistributedStatement']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/SINGLE_LINE_COMMENT" + "[./COMMENT_CONTENT[@text=' Comment // warn\\n']]" ); @@ -139,8 +135,7 @@ public void testDistributedStatement() throws Exception { @Test public void testSingleLineBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "SingleLineBlock.java")); + new File(getPath("InputXpathCommentsIndentationSingleLineBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -152,7 +147,7 @@ public void testSingleLineBlock() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationSingleLineBlock']]" + + "[@text='InputXpathCommentsIndentationSingleLineBlock']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/SINGLE_LINE_COMMENT" + "[./COMMENT_CONTENT[@text=' block Comment // warn\\n']]" ); @@ -164,8 +159,7 @@ public void testSingleLineBlock() throws Exception { @Test public void testNonEmptyCase() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "NonEmptyCase.java")); + new File(getPath("InputXpathCommentsIndentationNonEmptyCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -177,7 +171,7 @@ public void testNonEmptyCase() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationNonEmptyCase']]" + + "[@text='InputXpathCommentsIndentationNonEmptyCase']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/LITERAL_SWITCH/" + "CASE_GROUP/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\n']]" ); @@ -189,8 +183,7 @@ public void testNonEmptyCase() throws Exception { @Test public void testEmptyCase() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "EmptyCase.java")); + new File(getPath("InputXpathCommentsIndentationEmptyCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -202,7 +195,7 @@ public void testEmptyCase() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationEmptyCase']]" + + "[@text='InputXpathCommentsIndentationEmptyCase']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/LITERAL_SWITCH/" + "CASE_GROUP/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\n']]" ); @@ -214,8 +207,7 @@ public void testEmptyCase() throws Exception { @Test public void testWithinBlockStatement() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCommentsIndentation" - + "WithinBlockStatement.java")); + new File(getPath("InputXpathCommentsIndentationWithinBlockStatement.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CommentsIndentationCheck.class); @@ -227,7 +219,7 @@ public void testWithinBlockStatement() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionCommentsIndentationWithinBlockStatement']]" + + "[@text='InputXpathCommentsIndentationWithinBlockStatement']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF" + "[./IDENT[@text='s']]/ASSIGN/EXPR/PLUS[./STRING_LITERAL[@text='O']]" + "/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' Comment // warn\\n']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstantNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstantNameTest.java index 8e2009add36..01db1dafd08 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstantNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstantNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -44,7 +44,7 @@ protected String getCheckName() { @Test public void testLowercase() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionConstantNameLowercase.java")); + getPath("InputXpathConstantNameLowercase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -54,7 +54,7 @@ public void testLowercase() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionConstantNameLowercase']]" + + "[@text='InputXpathConstantNameLowercase']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='number']" ); @@ -65,7 +65,7 @@ public void testLowercase() throws Exception { @Test public void testCamelCase() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionConstantNameCamelCase.java")); + new File(getPath("InputXpathConstantNameCamelCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -76,7 +76,7 @@ public void testCamelCase() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionConstantNameCamelCase']]" + + "[./IDENT[@text='InputXpathConstantNameCamelCase']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='badConstant']" ); @@ -87,7 +87,7 @@ public void testCamelCase() throws Exception { @Test public void testWithBeginningUnderscore() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionConstantNameWithBeginningUnderscore.java")); + getPath("InputXpathConstantNameWithBeginningUnderscore.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -97,7 +97,7 @@ public void testWithBeginningUnderscore() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionConstantNameWithBeginningUnderscore']]" + + "[@text='InputXpathConstantNameWithBeginningUnderscore']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='_CONSTANT']" ); @@ -108,7 +108,7 @@ public void testWithBeginningUnderscore() throws Exception { @Test public void testWithTwoUnderscores() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionConstantNameWithTwoUnderscores.java")); + getPath("InputXpathConstantNameWithTwoUnderscores.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -118,7 +118,7 @@ public void testWithTwoUnderscores() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionConstantNameWithTwoUnderscores']]" + + "[@text='InputXpathConstantNameWithTwoUnderscores']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='BAD__NAME']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstructorsDeclarationGroupingTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstructorsDeclarationGroupingTest.java new file mode 100644 index 00000000000..6d054d2388c --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionConstructorsDeclarationGroupingTest.java @@ -0,0 +1,138 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.ConstructorsDeclarationGroupingCheck; + +public class XpathRegressionConstructorsDeclarationGroupingTest extends AbstractXpathTestSupport { + + private final Class clazz = + ConstructorsDeclarationGroupingCheck.class; + + @Override + protected String getCheckName() { + return clazz.getSimpleName(); + } + + @Test + public void testClass() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathConstructorsDeclarationGroupingClass.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(clazz); + + final String[] expectedViolation = { + "10:5: " + getCheckMessage(clazz, + ConstructorsDeclarationGroupingCheck.MSG_KEY, 6), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingClass']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingClass']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingClass']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingClass']]" + + "/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingClass']]" + + "/OBJBLOCK/CTOR_DEF/IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingClass']" + + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testEnum() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathConstructorsDeclarationGroupingEnum.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(clazz); + + final String[] expectedViolation = { + "12:5: " + getCheckMessage(clazz, + ConstructorsDeclarationGroupingCheck.MSG_KEY, 8), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/ENUM_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingEnum']]" + + "/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='InputXpathConstructorsDeclarationGroupingEnum']]", + + "/COMPILATION_UNIT/ENUM_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingEnum']]" + + "/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='InputXpathConstructorsDeclarationGroupingEnum']]" + + "/MODIFIERS", + + "/COMPILATION_UNIT/ENUM_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingEnum']]" + + "/OBJBLOCK/CTOR_DEF/IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingEnum']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testRecords() throws Exception { + final File fileToProcess = new File( + getNonCompilablePath("InputXpathConstructorsDeclarationGroupingRecords.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(clazz); + + final String[] expectedViolation = { + "14:5: " + getCheckMessage(clazz, + ConstructorsDeclarationGroupingCheck.MSG_KEY, 8), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingRecords']]" + + "/OBJBLOCK/RECORD_DEF[./IDENT[@text='MyRecord']]" + + "/OBJBLOCK/COMPACT_CTOR_DEF[./IDENT[@text='MyRecord']]", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingRecords']]" + + "/OBJBLOCK/RECORD_DEF[./IDENT[@text='MyRecord']]" + + "/OBJBLOCK/COMPACT_CTOR_DEF[./IDENT[@text='MyRecord']]/MODIFIERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathConstructorsDeclarationGroupingRecords']]" + + "/OBJBLOCK/RECORD_DEF[./IDENT[@text='MyRecord']]" + + "/OBJBLOCK/COMPACT_CTOR_DEF[./IDENT[@text='MyRecord']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCovariantEqualsTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCovariantEqualsTest.java index 21e30330219..2029104a0b7 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCovariantEqualsTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCovariantEqualsTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testCovariantEqualsInClass() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCovariantEqualsInClass.java")); + new File(getPath("InputXpathCovariantEqualsInClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CovariantEqualsCheck.class); @@ -52,7 +52,7 @@ public void testCovariantEqualsInClass() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCovariantEqualsInClass']]" + + "[./IDENT[@text='InputXpathCovariantEqualsInClass']]" + "/OBJBLOCK/METHOD_DEF/IDENT[@text='equals']" ); @@ -63,7 +63,7 @@ public void testCovariantEqualsInClass() throws Exception { @Test public void testCovariantEqualsInEnum() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCovariantEqualsInEnum.java")); + new File(getPath("InputXpathCovariantEqualsInEnum.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CovariantEqualsCheck.class); @@ -75,7 +75,7 @@ public void testCovariantEqualsInEnum() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/ENUM_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCovariantEqualsInEnum']]" + + "[./IDENT[@text='InputXpathCovariantEqualsInEnum']]" + "/OBJBLOCK/METHOD_DEF/IDENT[@text='equals']"); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -86,7 +86,7 @@ public void testCovariantEqualsInEnum() throws Exception { public void testCovariantEqualsInRecord() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionCovariantEqualsInRecord.java")); + "InputXpathCovariantEqualsInRecord.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CovariantEqualsCheck.class); @@ -98,7 +98,7 @@ public void testCovariantEqualsInRecord() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/RECORD_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCovariantEqualsInRecord']]" + + "[./IDENT[@text='InputXpathCovariantEqualsInRecord']]" + "/OBJBLOCK/METHOD_DEF/IDENT[@text='equals']"); runVerifications(moduleConfig, fileToProcess, expectedViolation, diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCustomImportOrderTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCustomImportOrderTest.java index cc7ddc77497..24f8b28bd79 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCustomImportOrderTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCustomImportOrderTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCustomImportOrderOne.java")); + new File(getPath("InputXpathCustomImportOrderOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CustomImportOrderCheck.class); @@ -64,7 +64,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCustomImportOrderTwo.java")); + new File(getPath("InputXpathCustomImportOrderTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CustomImportOrderCheck.class); @@ -86,7 +86,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCustomImportOrderThree.java")); + new File(getPath("InputXpathCustomImportOrderThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CustomImportOrderCheck.class); @@ -108,7 +108,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCustomImportOrderFour.java")); + new File(getPath("InputXpathCustomImportOrderFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CustomImportOrderCheck.class); @@ -131,7 +131,7 @@ public void testFour() throws Exception { @Test public void testFive() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCustomImportOrderFive.java")); + new File(getPath("InputXpathCustomImportOrderFive.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CustomImportOrderCheck.class); @@ -154,7 +154,7 @@ public void testFive() throws Exception { @Test public void testSix() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCustomImportOrderSix.java")); + new File(getPath("InputXpathCustomImportOrderSix.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CustomImportOrderCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCyclomaticComplexityTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCyclomaticComplexityTest.java index 164c8bf8cb0..185ec51f9fd 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCyclomaticComplexityTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionCyclomaticComplexityTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,10 +38,10 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testConditionals() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCyclomaticComplexityOne.java")); + new File(getPath("InputXpathCyclomaticComplexityConditionals.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CyclomaticComplexityCheck.class); @@ -54,13 +54,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityOne']]" + + "[./IDENT[@text='InputXpathCyclomaticComplexityConditionals']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityOne']]" + + "[./IDENT[@text='InputXpathCyclomaticComplexityConditionals']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityOne']]" + + "[./IDENT[@text='InputXpathCyclomaticComplexityConditionals']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -69,9 +69,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testSwitchBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionCyclomaticComplexityTwo.java")); + new File(getPath("InputXpathCyclomaticComplexitySwitchBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CyclomaticComplexityCheck.class); @@ -84,13 +84,13 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityTwo']]" + + "[./IDENT[@text='InputXpathCyclomaticComplexitySwitchBlock']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo2']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityTwo']]" + + "[./IDENT[@text='InputXpathCyclomaticComplexitySwitchBlock']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo2']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionCyclomaticComplexityTwo']]" + + "[./IDENT[@text='InputXpathCyclomaticComplexitySwitchBlock']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo2']]/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDeclarationOrderTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDeclarationOrderTest.java index f82e1149182..a6ee5c07cd0 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDeclarationOrderTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDeclarationOrderTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testNonStatic() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionDeclarationOrderOne.java")); + new File(getPath("InputXpathDeclarationOrderNonStatic.java")); final DefaultConfiguration moduleConfig = createModuleConfig(DeclarationOrderCheck.class); @@ -52,13 +52,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionDeclarationOrderOne']]" + + "[./IDENT[@text='InputXpathDeclarationOrderNonStatic']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='name']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionDeclarationOrderOne']]" + + "[./IDENT[@text='InputXpathDeclarationOrderNonStatic']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='name']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionDeclarationOrderOne']]" + + "[./IDENT[@text='InputXpathDeclarationOrderNonStatic']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='name']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -67,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testStatic() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionDeclarationOrderTwo.java")); + new File(getPath("InputXpathDeclarationOrderStatic.java")); final DefaultConfiguration moduleConfig = createModuleConfig(DeclarationOrderCheck.class); @@ -81,13 +81,13 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionDeclarationOrderTwo']]" + + "[./IDENT[@text='InputXpathDeclarationOrderStatic']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='MAX']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionDeclarationOrderTwo']]" + + "[./IDENT[@text='InputXpathDeclarationOrderStatic']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='MAX']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionDeclarationOrderTwo']]" + + "[./IDENT[@text='InputXpathDeclarationOrderStatic']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='MAX']]/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDefaultComesLastTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDefaultComesLastTest.java index 3a52491eb56..0891f104119 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDefaultComesLastTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionDefaultComesLastTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testNonEmptyCase() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionDefaultComesLastOne.java")); + new File(getPath("InputXpathDefaultComesLastNonEmptyCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(DefaultComesLastCheck.class); @@ -53,11 +53,11 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionDefaultComesLastOne']]/OBJBLOCK" + + "[@text='InputXpathDefaultComesLastNonEmptyCase']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/CASE_GROUP[" + "./SLIST/EXPR/ASSIGN/IDENT[@text='id']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionDefaultComesLastOne']]/OBJBLOCK" + + "[@text='InputXpathDefaultComesLastNonEmptyCase']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/CASE_GROUP" + "/LITERAL_DEFAULT" ); @@ -67,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testEmptyCase() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionDefaultComesLastTwo.java")); + new File(getPath("InputXpathDefaultComesLastEmptyCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(DefaultComesLastCheck.class); @@ -82,7 +82,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionDefaultComesLastTwo']]/OBJBLOCK" + + "[@text='InputXpathDefaultComesLastEmptyCase']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/CASE_GROUP" + "/LITERAL_DEFAULT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyBlockTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyBlockTest.java index 1c95b4622b9..2cd42ebaf2c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyBlockTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyBlockTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,7 +39,7 @@ protected String getCheckName() { @Test public void testEmptyForLoopEmptyBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionEmptyBlockEmpty.java")); + new File(getPath("InputXpathEmptyBlockEmpty.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyBlockCheck.class); moduleConfig.addProperty("option", "TEXT"); @@ -49,7 +49,7 @@ public void testEmptyForLoopEmptyBlock() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionEmptyBlockEmpty']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathEmptyBlockEmpty']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='emptyLoop']]" + "/SLIST/LITERAL_FOR/SLIST" ); @@ -60,7 +60,7 @@ public void testEmptyForLoopEmptyBlock() throws Exception { @Test public void testEmptyForLoopEmptyStatement() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionEmptyBlockEmpty.java")); + new File(getPath("InputXpathEmptyBlockEmpty.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyBlockCheck.class); final String[] expectedViolation = { @@ -69,7 +69,7 @@ public void testEmptyForLoopEmptyStatement() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionEmptyBlockEmpty']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathEmptyBlockEmpty']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='emptyLoop']]" + "/SLIST/LITERAL_FOR/SLIST" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyCatchBlockTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyCatchBlockTest.java index e26bc3190c2..6b08ddc02b0 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyCatchBlockTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyCatchBlockTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyCatchBlock1.java")); + getPath("InputXpathEmptyCatchBlockOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -51,7 +51,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyCatchBlock1']]" + + "[./IDENT[@text='InputXpathEmptyCatchBlockOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]" + "/SLIST/LITERAL_TRY/LITERAL_CATCH/SLIST" ); @@ -62,7 +62,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyCatchBlock2.java")); + getPath("InputXpathEmptyCatchBlockTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -72,7 +72,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyCatchBlock2']]" + + "[./IDENT[@text='InputXpathEmptyCatchBlockTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]" + "/SLIST/LITERAL_TRY/LITERAL_CATCH/SLIST" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForInitializerPadTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForInitializerPadTest.java index e04ef88d854..6806f0f2eb6 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForInitializerPadTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForInitializerPadTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testPreceded() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyForInitializerPadPreceded.java")); + getPath("InputXpathEmptyForInitializerPadPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyForInitializerPadCheck.class); @@ -53,10 +53,10 @@ public void testPreceded() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyForInitializerPadPreceded']]" + + "[./IDENT[@text='InputXpathEmptyForInitializerPadPreceded']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/FOR_INIT", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyForInitializerPadPreceded']]" + + "[./IDENT[@text='InputXpathEmptyForInitializerPadPreceded']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/SEMI[1]" ); @@ -67,7 +67,7 @@ public void testPreceded() throws Exception { @Test public void testNotPreceded() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyForInitializerPadNotPreceded.java")); + getPath("InputXpathEmptyForInitializerPadNotPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyForInitializerPadCheck.class); @@ -80,10 +80,10 @@ public void testNotPreceded() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionEmptyForInitializerPadNotPreceded']]" + + "@text='InputXpathEmptyForInitializerPadNotPreceded']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/FOR_INIT", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionEmptyForInitializerPadNotPreceded']]" + + "@text='InputXpathEmptyForInitializerPadNotPreceded']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/SEMI[1]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForIteratorPadTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForIteratorPadTest.java index 99b4048c89b..0e22571d42c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForIteratorPadTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyForIteratorPadTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionEmptyForIteratorPadFollowed.java")); + new File(getPath("InputXpathEmptyForIteratorPadFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyForIteratorPadCheck.class); @@ -53,10 +53,10 @@ public void testFollowed() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionEmptyForIteratorPadFollowed']]/OBJBLOCK" + + "@text='InputXpathEmptyForIteratorPadFollowed']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/FOR_ITERATOR", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionEmptyForIteratorPadFollowed']]/OBJBLOCK" + + "@text='InputXpathEmptyForIteratorPadFollowed']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/RPAREN" ); @@ -67,7 +67,7 @@ public void testFollowed() throws Exception { @Test public void testNotFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionEmptyForIteratorPadNotFollowed.java")); + new File(getPath("InputXpathEmptyForIteratorPadNotFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyForIteratorPadCheck.class); @@ -80,10 +80,10 @@ public void testNotFollowed() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionEmptyForIteratorPadNotFollowed']]/OBJBLOCK" + + "@text='InputXpathEmptyForIteratorPadNotFollowed']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/FOR_ITERATOR", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionEmptyForIteratorPadNotFollowed']]/OBJBLOCK" + + "@text='InputXpathEmptyForIteratorPadNotFollowed']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_FOR/RPAREN" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java index ea4e149f93a..52c1d88a4f6 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyLineSeparatorTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,7 +39,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyLineSeparator1.java") + getPath("InputXpathEmptyLineSeparatorOne.java") ); final DefaultConfiguration moduleConfig = @@ -61,7 +61,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyLineSeparator2.java") + getPath("InputXpathEmptyLineSeparatorTwo.java") ); final DefaultConfiguration moduleConfig = @@ -83,7 +83,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyLineSeparator3.java") + getPath("InputXpathEmptyLineSeparatorThree.java") ); final DefaultConfiguration moduleConfig = @@ -97,16 +97,16 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyLineSeparator3']]" + + "[./IDENT[@text='InputXpathEmptyLineSeparatorThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyLineSeparator3']]" + + "[./IDENT[@text='InputXpathEmptyLineSeparatorThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyLineSeparator3']]" + + "[./IDENT[@text='InputXpathEmptyLineSeparatorThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -117,7 +117,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyLineSeparator4.java") + getPath("InputXpathEmptyLineSeparatorFour.java") ); final DefaultConfiguration moduleConfig = @@ -131,7 +131,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyLineSeparator4']]" + + "[./IDENT[@text='InputXpathEmptyLineSeparatorFour']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]/SLIST/RCURLY" ); @@ -141,7 +141,7 @@ public void testFour() throws Exception { @Test public void testFive() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEmptyLineSeparator5.java") + getPath("InputXpathEmptyLineSeparatorFive.java") ); final DefaultConfiguration moduleConfig = @@ -156,7 +156,7 @@ public void testFive() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionEmptyLineSeparator5']]" + + "[./IDENT[@text='InputXpathEmptyLineSeparatorFive']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo1']]/SLIST/LITERAL_TRY/SLIST" + "/SINGLE_LINE_COMMENT/COMMENT_CONTENT[@text=' warn\\n']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyStatementTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyStatementTest.java index 593ede78668..9f4d38731cb 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyStatementTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEmptyStatementTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testForLoopEmptyStatement() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionEmptyStatement1.java")); + new File(getPath("InputXpathEmptyStatementLoops.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyStatementCheck.class); final String[] expectedViolation = { @@ -48,7 +48,7 @@ public void testForLoopEmptyStatement() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionEmptyStatement1']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathEmptyStatementLoops']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/LITERAL_FOR/EMPTY_STAT" ); @@ -59,7 +59,7 @@ public void testForLoopEmptyStatement() throws Exception { @Test public void testIfBlockEmptyStatement() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionEmptyStatement2.java")); + new File(getPath("InputXpathEmptyStatementConditionals.java")); final DefaultConfiguration moduleConfig = createModuleConfig(EmptyStatementCheck.class); final String[] expectedViolation = { @@ -67,7 +67,7 @@ public void testIfBlockEmptyStatement() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionEmptyStatement2']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathEmptyStatementConditionals']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/LITERAL_IF/EMPTY_STAT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java index 38ce994e931..6417509dde8 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsAvoidNullTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testEquals() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEqualsAvoidNull.java")); + getPath("InputXpathEqualsAvoidNull.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -51,10 +51,10 @@ public void testEquals() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionEqualsAvoidNull']]" + + "[@text='InputXpathEqualsAvoidNull']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/EXPR", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionEqualsAvoidNull']]" + + "[@text='InputXpathEqualsAvoidNull']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/EXPR/METHOD_CALL"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); @@ -63,7 +63,7 @@ public void testEquals() throws Exception { @Test public void testEqualsIgnoreCase() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionEqualsAvoidNullIgnoreCase.java")); + getPath("InputXpathEqualsAvoidNullIgnoreCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -74,10 +74,10 @@ public void testEqualsIgnoreCase() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionEqualsAvoidNullIgnoreCase']]" + + "[@text='InputXpathEqualsAvoidNullIgnoreCase']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/EXPR", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionEqualsAvoidNullIgnoreCase']]" + + "[@text='InputXpathEqualsAvoidNullIgnoreCase']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/EXPR/METHOD_CALL"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsHashCodeTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsHashCodeTest.java new file mode 100644 index 00000000000..c7def594c13 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionEqualsHashCodeTest.java @@ -0,0 +1,121 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck; + +public class XpathRegressionEqualsHashCodeTest extends AbstractXpathTestSupport { + @Override + protected String getCheckName() { + return EqualsHashCodeCheck.class.getSimpleName(); + } + + @Test + public void testEqualsOnly() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathEqualsHashCodeEqualsOnly.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(EqualsHashCodeCheck.class); + + final String[] expectedViolation = { + "4:5: " + getCheckMessage(EqualsHashCodeCheck.class, + EqualsHashCodeCheck.MSG_KEY_HASHCODE), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeEqualsOnly']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeEqualsOnly']]/OBJBLOCK/" + + "METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeEqualsOnly']]/OBJBLOCK/" + + "METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testHashCodeOnly() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathEqualsHashCodeHashCodeOnly.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(EqualsHashCodeCheck.class); + + final String[] expectedViolation = { + "4:5: " + getCheckMessage(EqualsHashCodeCheck.class, + EqualsHashCodeCheck.MSG_KEY_EQUALS), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeHashCodeOnly']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='hashCode']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeHashCodeOnly']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='hashCode']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeHashCodeOnly']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='hashCode']]/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testNestedCase() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathEqualsHashCodeNestedCase.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(EqualsHashCodeCheck.class); + + final String[] expectedViolation = { + "5:9: " + getCheckMessage(EqualsHashCodeCheck.class, + EqualsHashCodeCheck.MSG_KEY_HASHCODE), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeNestedCase']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeNestedCase']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathEqualsHashCodeNestedCase']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExecutableStatementCountTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExecutableStatementCountTest.java new file mode 100644 index 00000000000..4be48e8325c --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExecutableStatementCountTest.java @@ -0,0 +1,134 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.sizes.ExecutableStatementCountCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.sizes.ExecutableStatementCountCheck; + +public class XpathRegressionExecutableStatementCountTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return ExecutableStatementCountCheck.class.getSimpleName(); + } + + @Test + public void testDefaultConfig() throws Exception { + final String filePath = + getPath("InputXpathExecutableStatementCountDefault.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = + createModuleConfig(ExecutableStatementCountCheck.class); + + moduleConfig.addProperty("max", "0"); + + final String[] expectedViolations = { + "4:5: " + getCheckMessage(ExecutableStatementCountCheck.class, MSG_KEY, 3, 0), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountDefault']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='ElseIfLadder']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountDefault']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='ElseIfLadder']]" + + "/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountDefault']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='ElseIfLadder']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + + } + + @Test + public void testCustomMax() throws Exception { + final String filePath = + getPath("InputXpathExecutableStatementCountCustomMax.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = + createModuleConfig(ExecutableStatementCountCheck.class); + + moduleConfig.addProperty("max", "0"); + moduleConfig.addProperty("tokens", "CTOR_DEF"); + + final String[] expectedViolations = { + "4:5: " + getCheckMessage(ExecutableStatementCountCheck.class, MSG_KEY, 2, 0), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountCustomMax']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountCustomMax']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountCustomMax']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountCustomMax']]" + + "/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountCustomMax']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathExecutableStatementCountCustomMax']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testLambdas() throws Exception { + final String filePath = + getPath("InputXpathExecutableStatementCountLambdas.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = + createModuleConfig(ExecutableStatementCountCheck.class); + + moduleConfig.addProperty("max", "1"); + moduleConfig.addProperty("tokens", "LAMBDA"); + + final String[] expectedViolations = { + "7:22: " + getCheckMessage(ExecutableStatementCountCheck.class, MSG_KEY, 2, 1), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathExecutableStatementCountLambdas']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='c']]/ASSIGN/LAMBDA" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExplicitInitializationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExplicitInitializationTest.java index 48cfdc88cf4..c95696cf7d4 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExplicitInitializationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionExplicitInitializationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testPrimitiveType() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionExplicitInitializationOne.java")); + new File(getPath("InputXpathExplicitInitializationPrimitiveType.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ExplicitInitializationCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionExplicitInitializationOne']]" + + "[./IDENT[@text='InputXpathExplicitInitializationPrimitiveType']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='a']" ); @@ -61,9 +61,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testObjectType() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionExplicitInitializationTwo.java")); + new File(getPath("InputXpathExplicitInitializationObjectType.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ExplicitInitializationCheck.class); @@ -75,7 +75,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionExplicitInitializationTwo']]" + + "[./IDENT[@text='InputXpathExplicitInitializationObjectType']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='bar']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFallThroughTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFallThroughTest.java index c773982bf69..592814097e4 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFallThroughTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFallThroughTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testFallThrough() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionFallThroughOne.java")); + new File(getPath("InputXpathFallThrough.java")); final DefaultConfiguration moduleConfig = createModuleConfig(FallThroughCheck.class); @@ -51,11 +51,11 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionFallThroughOne']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathFallThrough']]" + "/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/CASE_GROUP[" + "./LITERAL_CASE/EXPR/NUM_INT[@text='2']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionFallThroughOne']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathFallThrough']]" + "/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/CASE_GROUP/LITERAL_CASE" ); @@ -65,9 +65,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testDefaultCase() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionFallThroughTwo.java")); + new File(getPath("InputXpathFallThroughDefaultCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(FallThroughCheck.class); @@ -79,11 +79,11 @@ public void testTwo() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionFallThroughTwo']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathFallThroughDefaultCase']]" + "/OBJBLOCK/METHOD_DEF[" + "./IDENT[@text='methodFallThruCustomWords']]/SLIST/LITERAL_WHILE/SLIST" + "/LITERAL_SWITCH/CASE_GROUP[./SLIST/EXPR/POST_INC/IDENT[@text='i']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionFallThroughTwo']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathFallThroughDefaultCase']]" + "/OBJBLOCK/METHOD_DEF[" + "./IDENT[@text='methodFallThruCustomWords']]/SLIST/LITERAL_WHILE/SLIST" + "/LITERAL_SWITCH/CASE_GROUP/LITERAL_DEFAULT" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalClassTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalClassTest.java index b10d5d101c0..98373ba9592 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalClassTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalClassTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,25 +37,25 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionFinalClass1.java")); + "InputXpathFinalClassDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(FinalClassCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(FinalClassCheck.class, - FinalClassCheck.MSG_KEY, "SuppressionXpathRegressionFinalClass1"), + FinalClassCheck.MSG_KEY, "InputXpathFinalClassDefault"), }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionFinalClass1']]", + + "@text='InputXpathFinalClassDefault']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionFinalClass1']]/MODIFIERS", + + "@text='InputXpathFinalClassDefault']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionFinalClass1']]/MODIFIERS/LITERAL_PUBLIC" + + "@text='InputXpathFinalClassDefault']]/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -63,9 +63,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testInnerClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionFinalClass2.java")); + "InputXpathFinalClassInnerClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(FinalClassCheck.class); @@ -77,13 +77,13 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionFinalClass2']]" + + "@text='InputXpathFinalClassInnerClass']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionFinalClass2']]" + + "@text='InputXpathFinalClassInnerClass']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionFinalClass2']]" + + "@text='InputXpathFinalClassInnerClass']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/LITERAL_CLASS" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalLocalVariableTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalLocalVariableTest.java new file mode 100644 index 00000000000..3173b554d63 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalLocalVariableTest.java @@ -0,0 +1,243 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck; + +public class XpathRegressionFinalLocalVariableTest extends AbstractXpathTestSupport { + + private final String checkName = FinalLocalVariableCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testMethodDef() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableMethodDef.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + + final String[] expectedViolation = { + "5:13: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "x"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableMethodDef']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]" + + "/SLIST/VARIABLE_DEF/IDENT[@text='x']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testForLoop() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableForLoop.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + + final String[] expectedViolation = { + "6:17: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "x"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableForLoop']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]/SLIST/" + + "LITERAL_FOR/SLIST/VARIABLE_DEF/IDENT[@text='x']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testSwitchCase() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableSwitchCase.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + + final String[] expectedViolation = { + "8:25: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "foo"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableSwitchCase']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/" + + "LITERAL_SWITCH/CASE_GROUP/SLIST/VARIABLE_DEF/IDENT[@text='foo']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testInnerClass() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableInnerClass.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + + final String[] expectedViolation = { + "7:17: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "shouldBeFinal"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableInnerClass']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test1']]" + + "/SLIST/VARIABLE_DEF/IDENT[@text='shouldBeFinal']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testParameterDef() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableParameterDef.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + moduleConfig.addProperty("tokens", "PARAMETER_DEF"); + + final String[] expectedViolation = { + "4:28: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "aArg"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableParameterDef']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='aArg']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testEnhancedFor() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableEnhancedFor.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + moduleConfig.addProperty("validateEnhancedForLoopVariable", "true"); + + final String[] expectedViolation = { + "8:20: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "a"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathFinalLocalVariableEnhancedFor']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method1']]" + + "/SLIST/LITERAL_FOR/FOR_EACH_CLAUSE/VARIABLE_DEF/IDENT[@text='a']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testCtor() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableCtor.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + moduleConfig.addProperty("tokens", "PARAMETER_DEF"); + + final String[] expectedViolation = { + "4:42: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "a"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathFinalLocalVariableCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableCtor']]" + + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='a']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testTryBlock() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableTryBlock.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + + final String[] expectedViolation = { + "6:17: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "start"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalLocalVariableTryBlock']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]" + + "/SLIST/LITERAL_TRY/SLIST/VARIABLE_DEF/IDENT[@text='start']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testConditionals() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathFinalLocalVariableConditionals.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(FinalLocalVariableCheck.class); + + final String[] expectedViolation = { + "11:25: " + getCheckMessage(FinalLocalVariableCheck.class, + FinalLocalVariableCheck.MSG_KEY, "body"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathFinalLocalVariableConditionals']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkCodeBlock']]/SLIST/LITERAL_TRY" + + "/SLIST/LITERAL_IF/LITERAL_ELSE/LITERAL_IF" + + "/SLIST/VARIABLE_DEF/IDENT[@text='body']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalParametersTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalParametersTest.java new file mode 100644 index 00000000000..baa3d9970b4 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionFinalParametersTest.java @@ -0,0 +1,190 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.FinalParametersCheck; + +public class XpathRegressionFinalParametersTest extends AbstractXpathTestSupport { + + private final String checkName = FinalParametersCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testMethod() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathFinalParametersMethod.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(FinalParametersCheck.class); + + final String[] expectedViolation = { + "5:24: " + getCheckMessage(FinalParametersCheck.class, + FinalParametersCheck.MSG_KEY, "argOne"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/PARAMETERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]/MODIFIERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]/TYPE", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]/TYPE/LITERAL_INT" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testCtor() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathFinalParametersCtor.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(FinalParametersCheck.class); + + moduleConfig.addProperty("tokens", "CTOR_DEF"); + + final String[] expectedViolation = { + "5:42: " + getCheckMessage(FinalParametersCheck.class, + FinalParametersCheck.MSG_KEY, "argOne"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathFinalParametersCtor']]" + + "/PARAMETERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathFinalParametersCtor']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathFinalParametersCtor']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]/MODIFIERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathFinalParametersCtor']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]/TYPE", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathFinalParametersCtor']]" + + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='argOne']]/TYPE/LITERAL_INT" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testAnonymous() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathFinalParametersAnonymous.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(FinalParametersCheck.class); + + moduleConfig.addProperty("ignorePrimitiveTypes", "true"); + + final String[] expectedViolation = { + "11:32: " + getCheckMessage(FinalParametersCheck.class, + FinalParametersCheck.MSG_KEY, "argOne"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersAnonymous']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='createClass']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='obj']]/ASSIGN/EXPR" + + "/LITERAL_NEW[./IDENT[@text='AnonymousClass']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='method']]/PARAMETERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersAnonymous']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='createClass']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='obj']]/ASSIGN/EXPR" + + "/LITERAL_NEW[./IDENT[@text='AnonymousClass']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='method']]/PARAMETERS" + + "/PARAMETER_DEF[./IDENT[@text='argOne']]", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersAnonymous']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='createClass']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='obj']]/ASSIGN/EXPR" + + "/LITERAL_NEW[./IDENT[@text='AnonymousClass']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='method']]/PARAMETERS" + + "/PARAMETER_DEF[./IDENT[@text='argOne']]/MODIFIERS", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersAnonymous']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='createClass']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='obj']]/ASSIGN/EXPR" + + "/LITERAL_NEW[./IDENT[@text='AnonymousClass']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='method']]/PARAMETERS" + + "/PARAMETER_DEF[./IDENT[@text='argOne']]/TYPE[./IDENT[@text='String']]", + + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathFinalParametersAnonymous']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='createClass']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='obj']]/ASSIGN/EXPR" + + "/LITERAL_NEW[./IDENT[@text='AnonymousClass']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='method']]/PARAMETERS" + + "/PARAMETER_DEF[./IDENT[@text='argOne']]/TYPE/IDENT[@text='String']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java index 22b86a9cae1..796325a6412 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionGenericWhitespaceTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testProcessEnd() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceEnd.java")); + getPath("InputXpathGenericWhitespaceEnd.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -53,7 +53,7 @@ public void testProcessEnd() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionGenericWhitespaceEnd']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathGenericWhitespaceEnd']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='bad']]" + "/PARAMETERS/PARAMETER_DEF[./IDENT[@text='cls']]" + "/TYPE[./IDENT[@text='Class']]/TYPE_ARGUMENTS/GENERIC_END" @@ -66,7 +66,7 @@ public void testProcessEnd() throws Exception { @Test public void testProcessNestedGenericsOne() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceNestedGenericsOne.java")); + getPath("InputXpathGenericWhitespaceNestedOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -78,7 +78,7 @@ public void testProcessNestedGenericsOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionGenericWhitespaceNestedGenericsOne']]" + + "@text='InputXpathGenericWhitespaceNestedOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS" + "/TYPE_PARAMETER[./IDENT[@text='E']]" + "/TYPE_UPPER_BOUNDS[./IDENT[@text='Enum']]/TYPE_ARGUMENTS/GENERIC_END" @@ -91,7 +91,7 @@ public void testProcessNestedGenericsOne() throws Exception { @Test public void testProcessNestedGenericsTwo() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceNestedGenericsTwo.java")); + getPath("InputXpathGenericWhitespaceNestedTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -103,7 +103,7 @@ public void testProcessNestedGenericsTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionGenericWhitespaceNestedGenericsTwo']]" + + "@text='InputXpathGenericWhitespaceNestedTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS" + "/TYPE_PARAMETER[./IDENT[@text='E']]" + "/TYPE_UPPER_BOUNDS[./IDENT[@text='Enum']]/TYPE_ARGUMENTS/GENERIC_END" @@ -116,7 +116,7 @@ public void testProcessNestedGenericsTwo() throws Exception { @Test public void testProcessNestedGenericsThree() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceNestedGenericsThree.java")); + getPath("InputXpathGenericWhitespaceNestedThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -128,7 +128,7 @@ public void testProcessNestedGenericsThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionGenericWhitespaceNestedGenericsThree']]" + + "@text='InputXpathGenericWhitespaceNestedThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS" + "/TYPE_PARAMETER[./IDENT[@text='E']]" + "/TYPE_UPPER_BOUNDS[./IDENT[@text='Enum']]/TYPE_ARGUMENTS/GENERIC_END" @@ -141,7 +141,7 @@ public void testProcessNestedGenericsThree() throws Exception { @Test public void testProcessSingleGenericOne() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceSingleGenericOne.java")); + getPath("InputXpathGenericWhitespaceSingleOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -153,7 +153,7 @@ public void testProcessSingleGenericOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionGenericWhitespaceSingleGenericOne']]" + + "@text='InputXpathGenericWhitespaceSingleOne']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/METHOD_CALL" + "/DOT[./IDENT[@text='Collections']]" + "/TYPE_ARGUMENTS/GENERIC_END" @@ -166,7 +166,7 @@ public void testProcessSingleGenericOne() throws Exception { @Test public void testProcessSingleGenericTwo() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceSingleGenericTwo.java")); + getPath("InputXpathGenericWhitespaceSingleTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -178,7 +178,7 @@ public void testProcessSingleGenericTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionGenericWhitespaceSingleGenericTwo']]" + + "@text='InputXpathGenericWhitespaceSingleTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS/GENERIC_END" ); @@ -189,7 +189,7 @@ public void testProcessSingleGenericTwo() throws Exception { @Test public void testProcessStartOne() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceStartOne.java")); + getPath("InputXpathGenericWhitespaceStartOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -201,10 +201,10 @@ public void testProcessStartOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartOne']]" + + "[@text='InputXpathGenericWhitespaceStartOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartOne']]" + + "[@text='InputXpathGenericWhitespaceStartOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS/GENERIC_START" ); @@ -215,7 +215,7 @@ public void testProcessStartOne() throws Exception { @Test public void testProcessStartTwo() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceStartTwo.java")); + getPath("InputXpathGenericWhitespaceStartTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -227,12 +227,12 @@ public void testProcessStartTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartTwo']]" + + "[@text='InputXpathGenericWhitespaceStartTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/PARAMETERS" + "/PARAMETER_DEF[./IDENT[@text='consumer']]" + "/TYPE[./IDENT[@text='Consumer']]/TYPE_ARGUMENTS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartTwo']]" + + "[@text='InputXpathGenericWhitespaceStartTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/PARAMETERS" + "/PARAMETER_DEF[./IDENT[@text='consumer']]" + "/TYPE[./IDENT[@text='Consumer']]/TYPE_ARGUMENTS/GENERIC_START" @@ -245,7 +245,7 @@ public void testProcessStartTwo() throws Exception { @Test public void testProcessStartThree() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionGenericWhitespaceStartThree.java")); + getPath("InputXpathGenericWhitespaceStartThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(GenericWhitespaceCheck.class); @@ -257,16 +257,16 @@ public void testProcessStartThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartThree']]" + + "[@text='InputXpathGenericWhitespaceStartThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartThree']]" + + "[@text='InputXpathGenericWhitespaceStartThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartThree']]" + + "[@text='InputXpathGenericWhitespaceStartThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionGenericWhitespaceStartThree']]" + + "[@text='InputXpathGenericWhitespaceStartThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bad']]/TYPE_PARAMETERS/GENERIC_START" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionHiddenFieldTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionHiddenFieldTest.java index ad5d6dae131..59e846a9279 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionHiddenFieldTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionHiddenFieldTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testLambdaExpInMethodCall() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionHiddenFieldOne.java")); + new File(getPath("InputXpathHiddenFieldLambdaExpInMethodCall.java")); final DefaultConfiguration moduleConfig = createModuleConfig(HiddenFieldCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionHiddenFieldOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathHiddenFieldLambdaExpInMethodCall']]/OBJBLOCK" + "/INSTANCE_INIT/SLIST/EXPR/METHOD_CALL/ELIST/LAMBDA/PARAMETERS" + "/PARAMETER_DEF/IDENT[@text='value']" ); @@ -62,9 +62,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testMethodParam() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionHiddenFieldTwo.java")); + new File(getPath("InputXpathHiddenFieldMethodParam.java")); final DefaultConfiguration moduleConfig = createModuleConfig(HiddenFieldCheck.class); @@ -76,7 +76,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionHiddenFieldTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathHiddenFieldMethodParam']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='method']]/PARAMETERS/PARAMETER_DEF" + "/IDENT[@text='other']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalCatchTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalCatchTest.java index b6452250ab1..75c5988f867 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalCatchTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalCatchTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalCatchOne.java")); + new File(getPath("InputXpathIllegalCatchOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalCatchCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIllegalCatchOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathIllegalCatchOne']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='fun']]/SLIST" + "/LITERAL_TRY/LITERAL_CATCH" ); @@ -64,7 +64,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalCatchTwo.java")); + new File(getPath("InputXpathIllegalCatchTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalCatchCheck.class); @@ -76,7 +76,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIllegalCatchTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathIllegalCatchTwo']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='methodTwo']]/SLIST" + "/LITERAL_TRY/LITERAL_CATCH" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalIdentifierNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalIdentifierNameTest.java index 5fc2d0dd1e3..764bd44b5d6 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalIdentifierNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalIdentifierNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,12 +41,12 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionIllegalIdentifierNameTestOne.java")); + "InputXpathIllegalIdentifierNameOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalIdentifierNameCheck.class); - final String format = "(?i)^(?!(record|yield|var|permits|sealed|_)$).+$"; + final String format = "(?i)^(?!(record|yield|var|permits|sealed)$).+$"; final String[] expectedViolation = { "10:20: " + getCheckMessage(IllegalIdentifierNameCheck.class, @@ -55,7 +55,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/RECORD_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIllegalIdentifierNameTestOne'" + + "[./IDENT[@text='InputXpathIllegalIdentifierNameOne'" + "]]/RECORD_COMPONENTS/RECORD_COMPONENT_DEF/IDENT[@text='yield']" ); @@ -66,12 +66,12 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionIllegalIdentifierNameTestTwo.java")); + "InputXpathIllegalIdentifierNameTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalIdentifierNameCheck.class); - final String format = "(?i)^(?!(record|yield|var|permits|sealed|_)$).+$"; + final String format = "(?i)^(?!(record|yield|var|permits|sealed)$).+$"; final String[] expectedViolation = { "9:17: " + getCheckMessage(IllegalIdentifierNameCheck.class, @@ -80,7 +80,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIllegalIdentifierNameTestTwo']" + + "[./IDENT[@text='InputXpathIllegalIdentifierNameTwo']" + "]/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/PARAMETERS/PARAMETER_DEF" + "/IDENT[@text='yield']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalImportTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalImportTest.java index 22cab115cbf..ac8e5490479 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalImportTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalImportTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalImportOne.java")); + new File(getPath("InputXpathIllegalImportDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalImportCheck.class); moduleConfig.addProperty("illegalPkgs", "java.util"); @@ -57,9 +57,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testStatic() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalImportTwo.java")); + new File(getPath("InputXpathIllegalImportStatic.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalImportCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalInstantiationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalInstantiationTest.java new file mode 100644 index 00000000000..90fd3c93a3b --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalInstantiationTest.java @@ -0,0 +1,128 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiationCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.IllegalInstantiationCheck; + +public class XpathRegressionIllegalInstantiationTest extends AbstractXpathTestSupport { + @Override + protected String getCheckName() { + return IllegalInstantiationCheck.class.getSimpleName(); + } + + @Test + public void testSimple() throws Exception { + final String fileName = "InputXpathIllegalInstantiationSimple.java"; + final File fileToProcess = new File(getNonCompilablePath(fileName)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(IllegalInstantiationCheck.class); + moduleConfig.addProperty("classes", "java.lang.Boolean"); + + final String[] expectedViolation = { + "8:21: " + getCheckMessage(IllegalInstantiationCheck.class, MSG_KEY, + "java.lang.Boolean"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathIllegalInstantiationSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='x']]/ASSIGN/EXPR", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathIllegalInstantiationSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='x']]/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='Boolean']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testAnonymous() throws Exception { + final String fileName = "InputXpathIllegalInstantiationAnonymous.java"; + final File fileToProcess = new File(getNonCompilablePath(fileName)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(IllegalInstantiationCheck.class); + moduleConfig.addProperty("classes", "java.lang.Integer"); + + final String[] expectedViolation = { + "10:25: " + getCheckMessage(IllegalInstantiationCheck.class, MSG_KEY, + "java.lang.Integer"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathIllegalInstantiationAnonymous']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[@text='e']]/ASSIGN/EXPR", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathIllegalInstantiationAnonymous']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[@text='e']]" + + "/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='Integer']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testInterface() throws Exception { + final String fileName = "InputXpathIllegalInstantiationInterface.java"; + final File fileToProcess = new File(getNonCompilablePath(fileName)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(IllegalInstantiationCheck.class); + moduleConfig.addProperty("classes", "java.lang.String"); + + final String[] expectedViolation = { + "10:24: " + getCheckMessage(IllegalInstantiationCheck.class, MSG_KEY, + "java.lang.String"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathIllegalInstantiationInterface']]" + + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Inner']]/" + + "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='s']]/ASSIGN/EXPR", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathIllegalInstantiationInterface']]" + + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Inner']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='s']]/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='String']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalThrowsTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalThrowsTest.java index d71a6f13595..da8feb51f90 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalThrowsTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalThrowsTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testRuntimeException() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalThrowsOne.java")); + new File(getPath("InputXpathIllegalThrowsRuntimeException.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalThrowsCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIllegalThrowsOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathIllegalThrowsRuntimeException']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sayHello']]/LITERAL_THROWS" + "/IDENT[@text='RuntimeException']" ); @@ -62,9 +62,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testError() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalThrowsTwo.java")); + new File(getPath("InputXpathIllegalThrowsError.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalThrowsCheck.class); @@ -76,7 +76,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIllegalThrowsTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathIllegalThrowsError']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='methodTwo']]/LITERAL_THROWS" + "/DOT[./IDENT[@text='Error']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTest.java index 92a87f290d9..beeff2252a4 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testLabel() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalToken1.java")); + new File(getPath("InputXpathIllegalTokenLabel.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); final String[] expectedViolation = { @@ -49,7 +49,7 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalToken1']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTokenLabel']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myTest']]" + "/SLIST/LABELED_STAT[./IDENT[@text='outer']]" ); @@ -59,9 +59,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testNative() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalToken2.java")); + new File(getPath("InputXpathIllegalTokenNative.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -73,7 +73,7 @@ public void testTwo() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalToken2']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTokenNative']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myTest']]" + "/MODIFIERS/LITERAL_NATIVE" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTextTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTextTest.java new file mode 100644 index 00000000000..7f53a95c913 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTokenTextTest.java @@ -0,0 +1,119 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.IllegalTokenTextCheck; + +public class XpathRegressionIllegalTokenTextTest extends AbstractXpathTestSupport { + + private final String checkName = IllegalTokenTextCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testField() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathIllegalTokenTextField.java")); + final DefaultConfiguration moduleConfig = + createModuleConfig(IllegalTokenTextCheck.class); + moduleConfig.addProperty("format", "12345"); + moduleConfig.addProperty("tokens", "NUM_INT"); + final String[] expectedViolation = { + "4:33: " + getCheckMessage(IllegalTokenTextCheck.class, + IllegalTokenTextCheck.MSG_KEY, "12345"), + }; + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTokenTextField']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='illegalNumber']]" + + "/ASSIGN/EXPR[./NUM_INT[@text='12345']]", + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTokenTextField']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='illegalNumber']]" + + "/ASSIGN/EXPR/NUM_INT[@text='12345']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testMethod() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathIllegalTokenTextMethod.java")); + final DefaultConfiguration moduleConfig = + createModuleConfig(IllegalTokenTextCheck.class); + moduleConfig.addProperty("format", "forbiddenText"); + moduleConfig.addProperty("tokens", "STRING_LITERAL"); + final String[] expectedViolation = { + "5:32: " + getCheckMessage(IllegalTokenTextCheck.class, + IllegalTokenTextCheck.MSG_KEY, "forbiddenText"), + }; + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTokenTextMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myMethod']]" + + "/SLIST/VARIABLE_DEF[./IDENT[@text='illegalString']]" + + "/ASSIGN/EXPR[./STRING_LITERAL[@text='forbiddenText']]", + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTokenTextMethod']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myMethod']]" + + "/SLIST/VARIABLE_DEF[./IDENT[@text='illegalString']]" + + "/ASSIGN/EXPR/STRING_LITERAL[@text='forbiddenText']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testInterface() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathIllegalTokenTextInterface.java")); + final DefaultConfiguration moduleConfig = + createModuleConfig(IllegalTokenTextCheck.class); + moduleConfig.addProperty("format", "invalidIdentifier"); + moduleConfig.addProperty("tokens", "IDENT"); + final String[] expectedViolation = { + "4:10: " + getCheckMessage(IllegalTokenTextCheck.class, + IllegalTokenTextCheck.MSG_KEY, "invalidIdentifier"), + }; + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT" + + "/INTERFACE_DEF[./IDENT[@text='InputXpathIllegalTokenTextInterface']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='invalidIdentifier']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTypeTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTypeTest.java index 53118cecaf8..c05e828be7b 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIllegalTypeTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalTypeOne.java")); + new File(getPath("InputXpathIllegalTypeOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTypeCheck.class); moduleConfig.addProperty("tokens", "METHOD_DEF"); @@ -50,7 +50,7 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalTypeOne']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathIllegalTypeOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='typeParam']]/TYPE_PARAMETERS/TYPE_PARAMETER" + "[./IDENT[@text='T']]/TYPE_UPPER_BOUNDS/DOT" + "[./IDENT[@text='HashSet']]/DOT/IDENT[@text='java']" @@ -63,7 +63,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIllegalTypeTwo.java")); + new File(getPath("InputXpathIllegalTypeTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTypeCheck.class); @@ -74,7 +74,7 @@ public void testTwo() throws Exception { IllegalTypeCheck.MSG_KEY, "Boolean"), }; final List expectedXpathQueries = Collections.singletonList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionIllegalTypeTwo']" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathIllegalTypeTwo']" + "]/OBJBLOCK/METHOD_DEF[./IDENT[@text='typeParam']]/TYPE_PARAMETERS/" + "TYPE_PARAMETER[./IDENT[@text='T']]/TYPE_UPPER_BOUNDS/IDENT[@text='Boolean']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportControlTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportControlTest.java index 58415f33fcf..7f41212dd2e 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportControlTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportControlTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,12 +41,12 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportControlOne.java")); + new File(getPath("InputXpathImportControlOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportControlCheck.class); moduleConfig.addProperty("file", getPath( - "SuppressionXpathRegressionImportControlOne.xml")); + "InputXpathImportControlOne.xml")); final String[] expectedViolation = { "3:1: " + getCheckMessage(ImportControlCheck.class, @@ -64,12 +64,12 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportControlTwo.java")); + new File(getPath("InputXpathImportControlTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportControlCheck.class); moduleConfig.addProperty("file", getPath( - "SuppressionXpathRegressionImportControlTwo.xml")); + "InputXpathImportControlTwo.xml")); final String[] expectedViolation = { "1:1: " + getCheckMessage(ImportControlCheck.class, @@ -87,7 +87,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportControlThree.java")); + new File(getPath("InputXpathImportControlThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportControlCheck.class); @@ -108,12 +108,12 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportControlFour.java")); + new File(getPath("InputXpathImportControlFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportControlCheck.class); moduleConfig.addProperty("file", - getPath("SuppressionXpathRegressionImportControlFour.xml")); + getPath("InputXpathImportControlFour.xml")); final String[] expectedViolation = { "4:1: " + getCheckMessage(ImportControlCheck.class, diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportOrderTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportOrderTest.java index 27dd8182258..ee4139168cb 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportOrderTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionImportOrderTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportOrderOne.java")); + new File(getPath("InputXpathImportOrderOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportOrderCheck.class); @@ -61,7 +61,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportOrderTwo.java")); + new File(getPath("InputXpathImportOrderTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportOrderCheck.class); @@ -82,7 +82,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportOrderThree.java")); + new File(getPath("InputXpathImportOrderThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportOrderCheck.class); @@ -105,7 +105,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportOrderFour.java")); + new File(getPath("InputXpathImportOrderFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportOrderCheck.class); @@ -127,7 +127,7 @@ public void testFour() throws Exception { @Test public void testFive() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionImportOrderFive.java")); + new File(getPath("InputXpathImportOrderFive.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ImportOrderCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIndentationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIndentationTest.java index 56e463cc59c..1abe2690d49 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIndentationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionIndentationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationTestOne.java")); + new File(getPath("InputXpathIndentationDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -52,19 +52,19 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestOne']]" + + "[./IDENT[@text='InputXpathIndentationDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='wrongIntend']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestOne']]" + + "[./IDENT[@text='InputXpathIndentationDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='wrongIntend']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestOne']]" + + "[./IDENT[@text='InputXpathIndentationDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='wrongIntend']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestOne']]" + + "[./IDENT[@text='InputXpathIndentationDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='wrongIntend']]/TYPE/LITERAL_VOID" ); @@ -75,7 +75,7 @@ public void testOne() throws Exception { @Test public void testBasicOffset() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationTestTwo.java")); + new File(getPath("InputXpathIndentationBasicOffset.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -95,19 +95,19 @@ public void testBasicOffset() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestTwo']]" + + "[./IDENT[@text='InputXpathIndentationBasicOffset']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestTwo']]" + + "[./IDENT[@text='InputXpathIndentationBasicOffset']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestTwo']]" + + "[./IDENT[@text='InputXpathIndentationBasicOffset']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestTwo']]" + + "[./IDENT[@text='InputXpathIndentationBasicOffset']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/LITERAL_VOID" ); @@ -118,7 +118,7 @@ public void testBasicOffset() throws Exception { @Test public void testCaseIndent() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationTestThree.java")); + new File(getPath("InputXpathIndentationSwitchCase.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -138,12 +138,12 @@ public void testCaseIndent() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestThree']]" + + "[./IDENT[@text='InputXpathIndentationSwitchCase']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/" + "CASE_GROUP", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationTestThree']]" + + "[./IDENT[@text='InputXpathIndentationSwitchCase']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/" + "CASE_GROUP/LITERAL_CASE" ); @@ -153,9 +153,9 @@ public void testCaseIndent() throws Exception { } @Test - public void testLambda() throws Exception { + public void testLambdaOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationLambdaTest1.java")); + new File(getPath("InputXpathIndentationLambdaOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -175,7 +175,7 @@ public void testLambda() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationLambdaTest1" + + "[./IDENT[@text='InputXpathIndentationLambdaOne" + "']]/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF" + "[./IDENT[@text='getA']]/ASSIGN/LAMBDA/LPAREN" ); @@ -185,9 +185,9 @@ public void testLambda() throws Exception { } @Test - public void testLambda2() throws Exception { + public void testLambdaTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationLambdaTest2.java")); + new File(getPath("InputXpathIndentationLambdaTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -207,7 +207,7 @@ public void testLambda2() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationLambdaTest2']]" + + "[./IDENT[@text='InputXpathIndentationLambdaTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='div']]/ASSIGN/LAMBDA/SLIST/LITERAL_RETURN" ); @@ -219,7 +219,7 @@ public void testLambda2() throws Exception { @Test public void testIfWithNoCurlies() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationIfWithoutCurly.java")); + new File(getPath("InputXpathIndentationIfWithoutCurly.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -240,7 +240,7 @@ public void testIfWithNoCurlies() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationIfWithoutCurly']]" + + "[./IDENT[@text='InputXpathIndentationIfWithoutCurly']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/EXPR/" + "METHOD_CALL/IDENT[@text='e']" ); @@ -252,7 +252,7 @@ public void testIfWithNoCurlies() throws Exception { @Test public void testElseWithNoCurlies() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionIndentationElseWithoutCurly.java")); + new File(getPath("InputXpathIndentationElseWithoutCurly.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IndentationCheck.class); @@ -273,7 +273,7 @@ public void testElseWithNoCurlies() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionIndentationElseWithoutCurly']]" + + "[./IDENT[@text='InputXpathIndentationElseWithoutCurly']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/LITERAL_ELSE" + "/EXPR/METHOD_CALL/IDENT[@text='exp']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerAssignmentTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerAssignmentTest.java new file mode 100644 index 00000000000..603c6de0855 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerAssignmentTest.java @@ -0,0 +1,87 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck; + +public class XpathRegressionInnerAssignmentTest extends AbstractXpathTestSupport { + + private final String checkName = InnerAssignmentCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testInnerAssignment() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathInnerAssignment.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class); + + final String[] expectedViolation = { + "7:15: " + getCheckMessage(InnerAssignmentCheck.class, InnerAssignmentCheck.MSG_KEY), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathInnerAssignment']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]" + + "/SLIST/EXPR/ASSIGN[./IDENT[@text='a']]/ASSIGN[./IDENT[@text='b']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testArrays() throws Exception { + final File fileToProcess = new + File(getPath("InputXpathInnerAssignmentArrays.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerAssignmentCheck.class); + + final String[] expectedViolation = { + "6:55: " + getCheckMessage(InnerAssignmentCheck.class, InnerAssignmentCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathInnerAssignmentArrays']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]" + + "/SLIST/VARIABLE_DEF[./IDENT[@text='doubleArray']]" + + "/ASSIGN/EXPR/LITERAL_NEW/ARRAY_INIT/EXPR[./ASSIGN/IDENT[@text='myDouble']]", + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text='InputXpathInnerAssignmentArrays']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod']]/" + + "SLIST/VARIABLE_DEF[./IDENT[@text='doubleArray']]" + + "/ASSIGN/EXPR/LITERAL_NEW/ARRAY_INIT/EXPR/ASSIGN[./IDENT[@text='myDouble']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerTypeLastTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerTypeLastTest.java new file mode 100644 index 00000000000..0aef626e054 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInnerTypeLastTest.java @@ -0,0 +1,141 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck; + +public class XpathRegressionInnerTypeLastTest extends AbstractXpathTestSupport { + + private final String checkName = InnerTypeLastCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testOne() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathInnerTypeLastOne.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class); + + final String[] expectedViolations = { + "8:5: " + getCheckMessage(InnerTypeLastCheck.class, MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastOne']]" + + "/OBJBLOCK/CTOR_DEF" + + "[./IDENT[@text='InputXpathInnerTypeLastOne']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastOne']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastOne']]" + + "/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastOne']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastOne']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, + expectedXpathQueries); + } + + @Test + public void testTwo() throws Exception { + + final File fileToProcess = + new File(getPath("InputXpathInnerTypeLastTwo.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class); + + final String[] expectedViolations = { + "11:9: " + getCheckMessage(InnerTypeLastCheck.class, MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastTwo']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='innerMethod']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastTwo']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT" + + "[@text='innerMethod']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastTwo']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT" + + "[@text='innerMethod']]/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, + expectedXpathQueries); + + } + + @Test + public void testThree() throws Exception { + + final File fileToProcess = new File( + getPath("InputXpathInnerTypeLastThree.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(InnerTypeLastCheck.class); + + final String[] expectedViolations = { + "10:5: " + getCheckMessage(InnerTypeLastCheck.class, MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastThree']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastThree']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastThree']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastThree']]" + + "/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastThree']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathInnerTypeLastThree']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, + expectedXpathQueries); + + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java index 16110e0f7d0..fdbc451f70f 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceIsTypeTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testAllowMarker() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionInterfaceIsType1.java")); + "InputXpathInterfaceIsTypeAllowMarker.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InterfaceIsTypeCheck.class); @@ -52,11 +52,11 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionInterfaceIsType1']]", + + "@text='InputXpathInterfaceIsTypeAllowMarker']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionInterfaceIsType1']]/MODIFIERS", + + "@text='InputXpathInterfaceIsTypeAllowMarker']]/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionInterfaceIsType1']]" + + "@text='InputXpathInterfaceIsTypeAllowMarker']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -65,9 +65,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testAllowMarkerFalse() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionInterfaceIsType2.java")); + "InputXpathInterfaceIsType.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InterfaceIsTypeCheck.class); @@ -81,11 +81,11 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionInterfaceIsType2']]", + + "@text='InputXpathInterfaceIsType']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionInterfaceIsType2']]/MODIFIERS", + + "@text='InputXpathInterfaceIsType']]/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionInterfaceIsType2']]" + + "@text='InputXpathInterfaceIsType']]" + "/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceMemberImpliedModifierTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceMemberImpliedModifierTest.java index 269946f92b0..ed19e0b1b33 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceMemberImpliedModifierTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInterfaceMemberImpliedModifierTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,9 +36,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testField() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionInterfaceMemberImpliedModifier1.java") + getPath("InputXpathInterfaceMemberImpliedModifierField.java") ); final DefaultConfiguration moduleConfig = @@ -51,16 +51,16 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier1']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='str']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier1']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='str']]" + "/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier1']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierField']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='str']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -69,9 +69,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testMethod() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionInterfaceMemberImpliedModifier2.java") + getPath("InputXpathInterfaceMemberImpliedModifierMethod.java") ); final DefaultConfiguration moduleConfig = @@ -84,16 +84,16 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier2']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setData']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier2']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setData']]" + "/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier2']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='setData']]" + "/MODIFIERS/ABSTRACT" ); @@ -102,9 +102,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testInner() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionInterfaceMemberImpliedModifier3.java") + getPath("InputXpathInterfaceMemberImpliedModifierInner.java") ); final DefaultConfiguration moduleConfig = @@ -117,16 +117,16 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier3']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierInner']]" + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Data']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier3']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierInner']]" + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Data']]" + "/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInterfaceMemberImpliedModifier3']]" + + "[@text='InputXpathInterfaceMemberImpliedModifierInner']]" + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Data']]" + "/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInvalidJavadocPositionTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInvalidJavadocPositionTest.java index ddc9aaf5265..2cd24d78858 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInvalidJavadocPositionTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionInvalidJavadocPositionTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionOne.java")); + new File(getPath("InputXpathInvalidJavadocPositionOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionOne']]" + + "[./IDENT[@text='InputXpathInvalidJavadocPositionOne']]" + "/MODIFIERS/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text='* // warn\\n * Javadoc Comment\\n ']]" ); @@ -64,7 +64,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionTwo.java")); + new File(getPath("InputXpathInvalidJavadocPositionTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); @@ -76,7 +76,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionInvalidJavadocPositionTwo']]" + + "[@text='InputXpathInvalidJavadocPositionTwo']]" + "/OBJBLOCK/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text='* // warn\\n * Javadoc comment\\n ']]" ); @@ -88,7 +88,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionThree.java")); + new File(getPath("InputXpathInvalidJavadocPositionThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); @@ -100,7 +100,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionThree']]/" + + "[./IDENT[@text='InputXpathInvalidJavadocPositionThree']]/" + "OBJBLOCK/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text='* // warn\\n * Javadoc comment\\n ']]" ); @@ -112,7 +112,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionFour.java")); + new File(getPath("InputXpathInvalidJavadocPositionFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); @@ -124,7 +124,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionFour']]" + + "[./IDENT[@text='InputXpathInvalidJavadocPositionFour']]" + "/OBJBLOCK/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text='* // warn\\n * Javadoc Comment\\n ']]" ); @@ -136,7 +136,7 @@ public void testFour() throws Exception { @Test public void testFive() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionFive.java")); + new File(getPath("InputXpathInvalidJavadocPositionFive.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); @@ -148,7 +148,7 @@ public void testFive() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionFive']]" + + "[./IDENT[@text='InputXpathInvalidJavadocPositionFive']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text='* // warn\\n * Javadoc comment\\n ']]" @@ -161,7 +161,7 @@ public void testFive() throws Exception { @Test public void testSix() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionInvalidJavadocPositionSix.java")); + new File(getPath("InputXpathInvalidJavadocPositionSix.java")); final DefaultConfiguration moduleConfig = createModuleConfig(InvalidJavadocPositionCheck.class); @@ -173,7 +173,7 @@ public void testSix() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionInvalidJavadocPositionSix']]" + + "[./IDENT[@text='InputXpathInvalidJavadocPositionSix']]" + "/OBJBLOCK/BLOCK_COMMENT_BEGIN[./COMMENT_CONTENT" + "[@text='* // warn\\n * Javadoc Comment\\n ']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavaNCSSTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavaNCSSTest.java new file mode 100644 index 00000000000..441af676ead --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavaNCSSTest.java @@ -0,0 +1,122 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.metrics.JavaNCSSCheck; + +// -@cs[AbbreviationAsWordInName] Test should be named as its main class. +public class XpathRegressionJavaNCSSTest extends AbstractXpathTestSupport { + + private final String checkName = JavaNCSSCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testOne() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathJavaNCSSOne.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(JavaNCSSCheck.class); + + final String[] expectedViolation = { + "5:5: " + getCheckMessage(JavaNCSSCheck.class, + JavaNCSSCheck.MSG_METHOD, 51, 50), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathJavaNCSSOne']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", + + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathJavaNCSSOne']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", + + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathJavaNCSSOne']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testTwo() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathJavaNCSSTwo.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(JavaNCSSCheck.class); + + moduleConfig.addProperty("classMaximum", "50"); + + final String[] expectedViolation = { + "3:1: " + getCheckMessage(JavaNCSSCheck.class, + JavaNCSSCheck.MSG_CLASS, 51, 50), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathJavaNCSSTwo']]", + + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathJavaNCSSTwo']]/MODIFIERS", + + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathJavaNCSSTwo']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testThree() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathJavaNCSSThree.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(JavaNCSSCheck.class); + + moduleConfig.addProperty("fileMaximum", "50"); + + final String[] expectedViolation = { + "1:1: " + getCheckMessage(JavaNCSSCheck.class, + JavaNCSSCheck.MSG_FILE, 51, 50), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT", + "/COMPILATION_UNIT/PACKAGE_DEF" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocContentLocationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocContentLocationTest.java index eeb650ea07e..fc1f8fea74c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocContentLocationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocContentLocationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocContentLocationOne.java")); + new File(getPath("InputXpathJavadocContentLocationOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocContentLocationCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocContentLocationOne']]" + + "[./IDENT[@text='InputXpathJavadocContentLocationOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/BLOCK_COMMENT_BEGIN" + "[./COMMENT_CONTENT[@text='* Text. // warn\\n ']]" ); @@ -64,7 +64,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocContentLocationTwo.java")); + new File(getPath("InputXpathJavadocContentLocationTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocContentLocationCheck.class); @@ -78,7 +78,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionJavadocContentLocationTwo']]" + + "[@text='InputXpathJavadocContentLocationTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/BLOCK_COMMENT_BEGIN" + "[./COMMENT_CONTENT[@text='*\\n * Text.\\n ']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocMethodTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocMethodTest.java index d0578470a51..0f22c8da1e8 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocMethodTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocMethodTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -44,7 +44,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocMethodOne.java")); + new File(getPath("InputXpathJavadocMethodOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocMethodCheck.class); @@ -55,13 +55,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodOne']]" + + "[./IDENT[@text='InputXpathJavadocMethodOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='uninheritableMethod']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodOne']]" + + "[./IDENT[@text='InputXpathJavadocMethodOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='uninheritableMethod']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodOne']]" + + "[./IDENT[@text='InputXpathJavadocMethodOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='uninheritableMethod']]/MODIFIERS" + "/LITERAL_PRIVATE"); @@ -72,7 +72,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocMethodTwo.java")); + new File(getPath("InputXpathJavadocMethodTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocMethodCheck.class); @@ -84,7 +84,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodTwo']]" + + "[./IDENT[@text='InputXpathJavadocMethodTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkParam']]/PARAMETERS" + "/PARAMETER_DEF/IDENT[@text='x']"); @@ -95,7 +95,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocMethodThree.java")); + new File(getPath("InputXpathJavadocMethodThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocMethodCheck.class); @@ -107,11 +107,11 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodThree']]" + + "[./IDENT[@text='InputXpathJavadocMethodThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkTypeParam']]/TYPE_PARAMETERS" + "/TYPE_PARAMETER[./IDENT[@text='T']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodThree']]" + + "[./IDENT[@text='InputXpathJavadocMethodThree']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='checkTypeParam']]/TYPE_PARAMETERS" + "/TYPE_PARAMETER/IDENT[@text='T']"); @@ -122,7 +122,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocMethodFour.java")); + new File(getPath("InputXpathJavadocMethodFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocMethodCheck.class); @@ -136,7 +136,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodFour']]" + + "[./IDENT[@text='InputXpathJavadocMethodFour']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/LITERAL_THROWS/IDENT[@text='Exception']"); @@ -147,7 +147,7 @@ public void testFour() throws Exception { @Test public void testFive() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocMethodFive.java")); + new File(getPath("InputXpathJavadocMethodFive.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocMethodCheck.class); @@ -161,7 +161,7 @@ public void testFive() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocMethodFive']]" + + "[./IDENT[@text='InputXpathJavadocMethodFive']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='bar']]/SLIST" + "/LITERAL_THROW/EXPR/LITERAL_NEW" + "/DOT[./IDENT[@text='BuildException']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocTypeTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocTypeTest.java index d218f920862..f09b0d1798c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocTypeTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,9 +42,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testMissingTag() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocTypeOne.java")); + new File(getPath("InputXpathJavadocTypeMissingTag.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocTypeCheck.class); @@ -58,12 +58,12 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocTypeOne']]", + + "[./IDENT[@text='InputXpathJavadocTypeMissingTag']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocTypeOne']]" + + "[./IDENT[@text='InputXpathJavadocTypeMissingTag']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocTypeOne']]" + + "[./IDENT[@text='InputXpathJavadocTypeMissingTag']]" + "/MODIFIERS/LITERAL_PUBLIC"); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -71,9 +71,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testWrongFormat() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocTypeTwo.java")); + new File(getPath("InputXpathJavadocTypeWrongFormat.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocTypeCheck.class); @@ -87,11 +87,11 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionJavadocTypeTwo']]", + + "[@text='InputXpathJavadocTypeWrongFormat']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionJavadocTypeTwo']]/MODIFIERS", + + "[@text='InputXpathJavadocTypeWrongFormat']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionJavadocTypeTwo']]" + + "[@text='InputXpathJavadocTypeWrongFormat']]" + "/MODIFIERS/LITERAL_PUBLIC"); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -99,9 +99,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testIncomplete() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocTypeThree.java")); + new File(getPath("InputXpathJavadocTypeIncomplete.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocTypeCheck.class); @@ -113,12 +113,12 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocTypeThree']]", + + "[./IDENT[@text='InputXpathJavadocTypeIncomplete']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocTypeThree']]" + + "[./IDENT[@text='InputXpathJavadocTypeIncomplete']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocTypeThree']]" + + "[./IDENT[@text='InputXpathJavadocTypeIncomplete']]" + "/MODIFIERS/LITERAL_PUBLIC"); runVerifications(moduleConfig, fileToProcess, expectedViolation, diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocVariableTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocVariableTest.java index a7e0b143f90..3f90d4cb643 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocVariableTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionJavadocVariableTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testPrivateClassFields() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocVariableOne.java")); + new File(getPath("InputXpathJavadocVariablePrivateClassFields.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocVariableCheck.class); @@ -52,13 +52,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathJavadocVariablePrivateClassFields']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='age']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathJavadocVariablePrivateClassFields']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='age']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathJavadocVariablePrivateClassFields']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='age']]/MODIFIERS/LITERAL_PRIVATE" ); @@ -67,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testInnerClassFields() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionJavadocVariableTwo.java")); + new File(getPath("InputXpathJavadocVariableInnerClassFields.java")); final DefaultConfiguration moduleConfig = createModuleConfig(JavadocVariableCheck.class); @@ -81,15 +81,15 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathJavadocVariableInnerClassFields']]/OBJBLOCK" + "/CLASS_DEF[./IDENT[@text='InnerInner2']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='fData']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathJavadocVariableInnerClassFields']]/OBJBLOCK" + "/CLASS_DEF[./IDENT[@text='InnerInner2']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='fData']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionJavadocVariableTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathJavadocVariableInnerClassFields']]/OBJBLOCK" + "/CLASS_DEF[./IDENT[@text='InnerInner2']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='fData']]/MODIFIERS" + "/LITERAL_PUBLIC" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java index 2b98821dd09..2c9dec27152 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaBodyLengthTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,9 +40,9 @@ protected String getCheckName() { } @Test - public void testDefault() throws Exception { + public void testDefaultMax() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionLambdaBodyLength1.java")); + "InputXpathLambdaBodyLengthDefaultMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); final String[] expectedViolation = { "7:48: " + getCheckMessage(CLASS, LambdaBodyLengthCheck.MSG_KEY, 11, 10), @@ -50,7 +50,7 @@ public void testDefault() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaBodyLength1']]" + + "[./IDENT[@text='InputXpathLambdaBodyLengthDefaultMax']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='trimmer']]/ASSIGN/LAMBDA"); @@ -58,9 +58,9 @@ public void testDefault() throws Exception { } @Test - public void testMaxIsNotDefault() throws Exception { + public void testCustomMax() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionLambdaBodyLength2.java")); + "InputXpathLambdaBodyLengthCustomMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); moduleConfig.addProperty("max", "5"); final String[] expectedViolation = { @@ -69,7 +69,7 @@ public void testMaxIsNotDefault() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaBodyLength2']]" + + "[./IDENT[@text='InputXpathLambdaBodyLengthCustomMax']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='r']]/ASSIGN/LAMBDA"); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaParameterNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaParameterNameTest.java index d6da3398766..145dcbdb59c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaParameterNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLambdaParameterNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,13 +40,13 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionLambdaParameterName1.java")); + new File(getPath("InputXpathLambdaParameterNameDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(LambdaParameterNameCheck.class); - final String defaultPattern = "^[a-z][a-zA-Z0-9]*$"; + final String defaultPattern = "^([a-z][a-zA-Z0-9]*|_)$"; final String[] expectedViolation = { "7:44: " + getCheckMessage(LambdaParameterNameCheck.class, @@ -55,7 +55,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaParameterName1']]" + + "[./IDENT[@text='InputXpathLambdaParameterNameDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='trimmer']]/ASSIGN/LAMBDA/IDENT[@text='S']" ); @@ -65,9 +65,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testNonDefaultPattern() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionLambdaParameterName2.java")); + new File(getPath("InputXpathLambdaParameterNameNonDefaultPattern.java")); final String nonDefaultPattern = "^_[a-zA-Z0-9]*$"; @@ -82,30 +82,30 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaParameterName2']]" + + "[./IDENT[@text='InputXpathLambdaParameterNameNonDefaultPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + "VARIABLE_DEF[./IDENT[@text='trimmer']]/ASSIGN/LAMBDA/PARAMETERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaParameterName2']]" + + "[./IDENT[@text='InputXpathLambdaParameterNameNonDefaultPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + "VARIABLE_DEF[./IDENT[@text='trimmer']]/ASSIGN/LAMBDA/PARAMETERS" + "/PARAMETER_DEF[./IDENT[@text='s']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaParameterName2']]" + + "[./IDENT[@text='InputXpathLambdaParameterNameNonDefaultPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='trimmer']]/ASSIGN/LAMBDA/PARAMETERS" + "/PARAMETER_DEF[./IDENT[@text='s']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaParameterName2']]" + + "[./IDENT[@text='InputXpathLambdaParameterNameNonDefaultPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + "VARIABLE_DEF[./IDENT[@text='trimmer']]/ASSIGN/LAMBDA/PARAMETERS" + "/PARAMETER_DEF[./IDENT[@text='s']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLambdaParameterName2']]" + + "[./IDENT[@text='InputXpathLambdaParameterNameNonDefaultPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + "VARIABLE_DEF[./IDENT[@text='trimmer']]/ASSIGN/LAMBDA/PARAMETERS" + "/PARAMETER_DEF/IDENT[@text='s']" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLeftCurlyTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLeftCurlyTest.java index 6b621ae6e5b..a94af219be7 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLeftCurlyTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLeftCurlyTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionLeftCurlyOne.java")); + new File(getPath("InputXpathLeftCurlyOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(LeftCurlyCheck.class); @@ -54,9 +54,9 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLeftCurlyOne']]/OBJBLOCK", + + "[./IDENT[@text='InputXpathLeftCurlyOne']]/OBJBLOCK", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLeftCurlyOne']]/OBJBLOCK/LCURLY" + + "[./IDENT[@text='InputXpathLeftCurlyOne']]/OBJBLOCK/LCURLY" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -66,22 +66,22 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionLeftCurlyTwo.java")); + new File(getPath("InputXpathLeftCurlyTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(LeftCurlyCheck.class); moduleConfig.addProperty("option", LeftCurlyOption.NL.toString()); final String[] expectedViolation = { - "3:53: " + getCheckMessage(LeftCurlyCheck.class, - LeftCurlyCheck.MSG_KEY_LINE_NEW, "{", 53), + "3:37: " + getCheckMessage(LeftCurlyCheck.class, + LeftCurlyCheck.MSG_KEY_LINE_NEW, "{", 37), }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLeftCurlyTwo']]/OBJBLOCK", + + "[./IDENT[@text='InputXpathLeftCurlyTwo']]/OBJBLOCK", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLeftCurlyTwo']]/OBJBLOCK/LCURLY" + + "[./IDENT[@text='InputXpathLeftCurlyTwo']]/OBJBLOCK/LCURLY" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -91,7 +91,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionLeftCurlyThree.java")); + new File(getPath("InputXpathLeftCurlyThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(LeftCurlyCheck.class); @@ -103,7 +103,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionLeftCurlyThree']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathLeftCurlyThree']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sample']]/SLIST/LITERAL_IF/SLIST" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLocalFinalVariableNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLocalFinalVariableNameTest.java new file mode 100644 index 00000000000..5b20c6b4ce1 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionLocalFinalVariableNameTest.java @@ -0,0 +1,115 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.naming.LocalFinalVariableNameCheck.MSG_INVALID_PATTERN; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.naming.LocalFinalVariableNameCheck; + +public class XpathRegressionLocalFinalVariableNameTest extends AbstractXpathTestSupport { + + private final String checkName = LocalFinalVariableNameCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testResource() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathLocalFinalVariableNameResource.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(LocalFinalVariableNameCheck.class); + moduleConfig.addProperty("format", "^[A-Z][A-Z0-9]*$"); + moduleConfig.addProperty("tokens", "PARAMETER_DEF,RESOURCE"); + + final String[] expectedViolation = { + "7:21: " + getCheckMessage(LocalFinalVariableNameCheck.class, + MSG_INVALID_PATTERN, "scanner", "^[A-Z][A-Z0-9]*$"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathLocalFinalVariableNameResource']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='MyMethod']]/SLIST/LITERAL_TRY" + + "/RESOURCE_SPECIFICATION/RESOURCES/RESOURCE/IDENT[@text='scanner']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testVariable() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathLocalFinalVariableNameVar.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(LocalFinalVariableNameCheck.class); + moduleConfig.addProperty("format", "^[A-Z][a-z0-9]*$"); + + final String[] expectedViolation = { + "5:19: " + getCheckMessage(LocalFinalVariableNameCheck.class, + MSG_INVALID_PATTERN, "VAR1", "^[A-Z][a-z0-9]*$"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathLocalFinalVariableNameVar']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='MyMethod']]/SLIST/VARIABLE_DEF" + + "/IDENT[@text='VAR1']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testInnerClass() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathLocalFinalVariableNameInner.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(LocalFinalVariableNameCheck.class); + moduleConfig.addProperty("format", "^[A-Z][a-z0-9]*$"); + + final String[] expectedViolation = { + "8:23: " + getCheckMessage(LocalFinalVariableNameCheck.class, + MSG_INVALID_PATTERN, "VAR1", "^[A-Z][a-z0-9]*$"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathLocalFinalVariableNameInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='MyMethod']]/SLIST/VARIABLE_DEF" + + "/IDENT[@text='VAR1']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMagicNumberTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMagicNumberTest.java new file mode 100644 index 00000000000..9f74327746a --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMagicNumberTest.java @@ -0,0 +1,116 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck; + +public class XpathRegressionMagicNumberTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return MagicNumberCheck.class.getSimpleName(); + } + + @Test + public void testVariable() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMagicNumberVariable.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MagicNumberCheck.class); + + final String[] expectedViolation = { + "5:13: " + getCheckMessage(MagicNumberCheck.class, MagicNumberCheck.MSG_KEY, "5"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMagicNumberVariable']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='d']]" + + "/ASSIGN/EXPR[./NUM_INT[@text='5']]", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMagicNumberVariable']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='d']]" + + "/ASSIGN/EXPR/NUM_INT[@text='5']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testMethodDef() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMagicNumberMethodDef.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MagicNumberCheck.class); + + final String[] expectedViolation = { + "5:17: " + getCheckMessage(MagicNumberCheck.class, MagicNumberCheck.MSG_KEY, "20"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMagicNumberMethodDef']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodWithMagicNumber']]" + + "/SLIST/VARIABLE_DEF[./IDENT[@text='x']]/ASSIGN/EXPR[./" + + "NUM_INT[@text='20']]", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMagicNumberMethodDef']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodWithMagicNumber']]" + + "/SLIST/VARIABLE_DEF[./IDENT[@text='x']]/ASSIGN/EXPR/NU" + + "M_INT[@text='20']" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testAnotherVariable() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMagicNumberAnotherVariable.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MagicNumberCheck.class); + + final String[] expectedViolation = { + "13:21: " + getCheckMessage(MagicNumberCheck.class, MagicNumberCheck.MSG_KEY, "20"), + }; + + final List expectedXpathQueries = List.of( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMagicNumberAnotherVariable']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='performOperation']]" + + "/SLIST/LITERAL_TRY/LITERAL_CATCH/SLIST/LITERAL_IF" + + "/LITERAL_ELSE/SLIST/EXPR/ASSIGN" + + "[./IDENT[@text='a']]/NUM_INT[@text='20']" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMatchXpathTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMatchXpathTest.java index 182aea9a446..a01131fc02a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMatchXpathTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMatchXpathTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathOne.java")); + new File(getPath("InputXpathMatchXpathOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MatchXpathCheck.class); @@ -53,11 +53,11 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMatchXpathOne']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathMatchXpathOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMatchXpathOne']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathMatchXpathOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMatchXpathOne']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathMatchXpathOne']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -68,7 +68,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathTwo.java")); + new File(getPath("InputXpathMatchXpathTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MatchXpathCheck.class); @@ -81,7 +81,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathTwo']]" + + "[./IDENT[@text='InputXpathMatchXpathTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='func1']]" + "/LITERAL_THROWS[./IDENT[@text='RuntimeException']]" ); @@ -93,7 +93,7 @@ public void testTwo() throws Exception { @Test public void testEncodedQuoteString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedQuoteString.java")); + new File(getPath("InputXpathMatchXpathEncodedQuoteString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -106,11 +106,11 @@ public void testEncodedQuoteString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedQuoteString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedQuoteString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='quoteChar']]/ASSIGN/EXPR" + "[./STRING_LITERAL[@text='\\"testOne\\"']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedQuoteString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedQuoteString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='quoteChar']]/ASSIGN/EXPR" + "/STRING_LITERAL[@text='\\"testOne\\"']" ); @@ -122,7 +122,7 @@ public void testEncodedQuoteString() throws Exception { @Test public void testEncodedLessString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedLessString.java")); + new File(getPath("InputXpathMatchXpathEncodedLessString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -135,11 +135,11 @@ public void testEncodedLessString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedLessString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedLessString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='lessChar']]/ASSIGN/EXPR" + "[./STRING_LITERAL[@text='<testTwo']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedLessString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedLessString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='lessChar']]/ASSIGN/EXPR/" + "STRING_LITERAL[@text='<testTwo']" ); @@ -151,7 +151,7 @@ public void testEncodedLessString() throws Exception { @Test public void testEncodedNewLineString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedNewLineString.java")); + new File(getPath("InputXpathMatchXpathEncodedNewLineString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -164,11 +164,11 @@ public void testEncodedNewLineString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedNewLineString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedNewLineString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='newLineChar']]/ASSIGN/EXPR" + "[./STRING_LITERAL[@text='testFive\\n']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedNewLineString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedNewLineString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='newLineChar']]/ASSIGN/EXPR" + "/STRING_LITERAL[@text='testFive\\n']" ); @@ -180,7 +180,7 @@ public void testEncodedNewLineString() throws Exception { @Test public void testGreaterString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedGreaterString.java")); + new File(getPath("InputXpathMatchXpathEncodedGreaterString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -193,11 +193,11 @@ public void testGreaterString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedGreaterString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedGreaterString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='greaterChar']]/ASSIGN/EXPR" + "[./STRING_LITERAL[@text='>testFour']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedGreaterString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedGreaterString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='greaterChar']]/ASSIGN/EXPR" + "/STRING_LITERAL[@text='>testFour']" ); @@ -209,7 +209,7 @@ public void testGreaterString() throws Exception { @Test public void testEncodedAmpString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedAmpString.java")); + new File(getPath("InputXpathMatchXpathEncodedAmpString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -222,11 +222,11 @@ public void testEncodedAmpString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAmpString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAmpString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='ampersandChar']]/ASSIGN/EXPR" + "[./STRING_LITERAL[@text='&testThree']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAmpString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAmpString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='ampersandChar']]/ASSIGN/EXPR" + "/STRING_LITERAL[@text='&testThree']" ); @@ -238,7 +238,7 @@ public void testEncodedAmpString() throws Exception { @Test public void testEncodedAposString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedAposString.java")); + new File(getPath("InputXpathMatchXpathEncodedAposString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -251,11 +251,11 @@ public void testEncodedAposString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAposString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAposString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='aposChar']]/ASSIGN/EXPR" + "[./STRING_LITERAL[@text='''SingleQuoteOnBothSide''']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAposString']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAposString']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='aposChar']]/ASSIGN/EXPR" + "/STRING_LITERAL[@text='''SingleQuoteOnBothSide''']" ); @@ -267,7 +267,7 @@ public void testEncodedAposString() throws Exception { @Test public void testEncodedCarriageString() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedCarriageString.java")); + new File(getPath("InputXpathMatchXpathEncodedCarriageString.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -280,12 +280,12 @@ public void testEncodedCarriageString() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedCarriage" - + "String']]/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='carriageChar']]/ASSIGN" + + "[./IDENT[@text='InputXpathMatchXpathEncodedCarriageString" + + "']]/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='carriageChar']]/ASSIGN" + "/EXPR[./STRING_LITERAL[@text='carriageCharAtEnd\\r']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedCarriage" - + "String']]/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='carriageChar']]/ASSIGN" + + "[./IDENT[@text='InputXpathMatchXpathEncodedCarriageString" + + "']]/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='carriageChar']]/ASSIGN" + "/EXPR/STRING_LITERAL[@text='carriageCharAtEnd\\r']" ); @@ -296,7 +296,7 @@ public void testEncodedCarriageString() throws Exception { @Test public void testEncodedAmpersandChars() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedAmpChar.java")); + new File(getPath("InputXpathMatchXpathEncodedAmpChar.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -309,11 +309,11 @@ public void testEncodedAmpersandChars() throws Exception { final List expectedXpathQueriesForAmpersand = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAmpChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAmpChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='ampChar']]/ASSIGN/EXPR" + "[./CHAR_LITERAL[@text='''&''']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAmpChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAmpChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='ampChar']]/ASSIGN/EXPR" + "/CHAR_LITERAL[@text='''&''']" ); @@ -325,7 +325,7 @@ public void testEncodedAmpersandChars() throws Exception { @Test public void testEncodedQuoteChar() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedQuotChar.java")); + new File(getPath("InputXpathMatchXpathEncodedQuoteChar.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -338,11 +338,11 @@ public void testEncodedQuoteChar() throws Exception { final List expectedXpathQueriesForQuote = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedQuotChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedQuoteChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='quotChar']]/ASSIGN/EXPR" + "[./CHAR_LITERAL[@text='''\\"''']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedQuotChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedQuoteChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='quotChar']]/ASSIGN/EXPR/" + "CHAR_LITERAL[@text='''\\"''']" ); @@ -354,7 +354,7 @@ public void testEncodedQuoteChar() throws Exception { @Test public void testEncodedLessChar() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedLessChar.java")); + new File(getPath("InputXpathMatchXpathEncodedLessChar.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -367,11 +367,11 @@ public void testEncodedLessChar() throws Exception { final List expectedXpathQueriesForLess = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedLessChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedLessChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='lessChar']]/ASSIGN/EXPR" + "[./CHAR_LITERAL[@text='''<''']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedLessChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedLessChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='lessChar']]/ASSIGN/EXPR/" + "CHAR_LITERAL[@text='''<''']" ); @@ -383,7 +383,7 @@ public void testEncodedLessChar() throws Exception { @Test public void testEncodedAposChar() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedAposChar.java")); + new File(getPath("InputXpathMatchXpathEncodedAposChar.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -396,11 +396,11 @@ public void testEncodedAposChar() throws Exception { final List expectedXpathQueriesForApos = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAposChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAposChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='aposChar']]/ASSIGN/EXPR" + "[./CHAR_LITERAL[@text='''\\''''']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncodedAposChar']]/" + + "[./IDENT[@text='InputXpathMatchXpathEncodedAposChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='aposChar']]/ASSIGN/EXPR/" + "CHAR_LITERAL[@text='''\\''''']" ); @@ -412,7 +412,7 @@ public void testEncodedAposChar() throws Exception { @Test public void testEncodedGreaterChar() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathEncodedGreaterChar.java")); + new File(getPath("InputXpathMatchXpathEncodedGreaterChar.java")); final DefaultConfiguration moduleConfig = createModuleConfig(IllegalTokenCheck.class); @@ -425,13 +425,13 @@ public void testEncodedGreaterChar() throws Exception { final List expectedXpathQueriesForGreater = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncoded" - + "GreaterChar']]/" + + "[./IDENT[@text='" + + "InputXpathMatchXpathEncodedGreaterChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='greaterChar']]/ASSIGN/EXPR" + "[./CHAR_LITERAL[@text='''>''']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMatchXpathEncoded" - + "GreaterChar']]/" + + "[./IDENT[@text='" + + "InputXpathMatchXpathEncodedGreaterChar']]/" + "OBJBLOCK/VARIABLE_DEF[./IDENT[@text='greaterChar']]/ASSIGN/EXPR/" + "CHAR_LITERAL[@text='''>''']" ); @@ -443,7 +443,7 @@ public void testEncodedGreaterChar() throws Exception { @Test public void testFollowing() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMatchXpathThree.java")); + new File(getPath("InputXpathMatchXpathThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MatchXpathCheck.class); @@ -456,7 +456,7 @@ public void testFollowing() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionMatchXpathThree']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathMatchXpathThree']]" + "/OBJBLOCK/RCURLY" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMemberNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMemberNameTest.java index 88b74c37232..4c1e4f3137f 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMemberNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMemberNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void test1() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMemberName1.java")); + new File(getPath("InputXpathMemberNameDefault.java")); final String pattern = "^[a-z][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -55,7 +55,7 @@ public void test1() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionMemberName1']]" + + "='InputXpathMemberNameDefault']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='NUM2']" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -63,9 +63,9 @@ public void test1() throws Exception { } @Test - public void test2() throws Exception { + public void testIgnoreProtected() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMemberName2.java")); + new File(getPath("InputXpathMemberNameIgnoreProtected.java")); final String pattern = "^m[A-Z][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -82,7 +82,7 @@ public void test2() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionMemberName2']]" + + "='InputXpathMemberNameIgnoreProtected']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]" + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='NUM1']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java index f9dea22d252..895d09ecc60 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodCountTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,9 +36,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMethodCount1.java") + getPath("InputXpathMethodCountDefault.java") ); final DefaultConfiguration moduleConfig = @@ -52,14 +52,14 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount1']]", + + "[./IDENT[@text='InputXpathMethodCountDefault']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount1']]" + + "[./IDENT[@text='InputXpathMethodCountDefault']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount1']]" + + "[./IDENT[@text='InputXpathMethodCountDefault']]" + "/LITERAL_CLASS" ); @@ -67,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testPrivate() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMethodCount2.java") + getPath("InputXpathMethodCountPrivate.java") ); final DefaultConfiguration moduleConfig = @@ -83,14 +83,14 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount2']]", + + "[./IDENT[@text='InputXpathMethodCountPrivate']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount2']]" + + "[./IDENT[@text='InputXpathMethodCountPrivate']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount2']]" + + "[./IDENT[@text='InputXpathMethodCountPrivate']]" + "/LITERAL_CLASS" ); @@ -98,9 +98,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testPackage() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMethodCount1.java") + getPath("InputXpathMethodCountDefault.java") ); final DefaultConfiguration moduleConfig = @@ -114,14 +114,14 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount1']]", + + "[./IDENT[@text='InputXpathMethodCountDefault']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount1']]" + + "[./IDENT[@text='InputXpathMethodCountDefault']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount1']]" + + "[./IDENT[@text='InputXpathMethodCountDefault']]" + "/LITERAL_CLASS" ); @@ -129,9 +129,9 @@ public void testThree() throws Exception { } @Test - public void testFour() throws Exception { + public void testProtected() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMethodCount3.java") + getPath("InputXpathMethodCountProtected.java") ); final DefaultConfiguration moduleConfig = @@ -145,14 +145,14 @@ public void testFour() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount3']]", + + "[./IDENT[@text='InputXpathMethodCountProtected']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount3']]" + + "[./IDENT[@text='InputXpathMethodCountProtected']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount3']]" + + "[./IDENT[@text='InputXpathMethodCountProtected']]" + "/LITERAL_CLASS" ); @@ -160,9 +160,9 @@ public void testFour() throws Exception { } @Test - public void testFive() throws Exception { + public void testPublic() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMethodCount4.java") + getPath("InputXpathMethodCountPublic.java") ); final DefaultConfiguration moduleConfig = @@ -176,14 +176,14 @@ public void testFive() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount4']]", + + "[./IDENT[@text='InputXpathMethodCountPublic']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount4']]" + + "[./IDENT[@text='InputXpathMethodCountPublic']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMethodCount4']]" + + "[./IDENT[@text='InputXpathMethodCountPublic']]" + "/LITERAL_CLASS" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodLengthTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodLengthTest.java new file mode 100644 index 00000000000..dafebfd929c --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodLengthTest.java @@ -0,0 +1,138 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.sizes.MethodLengthCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.sizes.MethodLengthCheck; + +public class XpathRegressionMethodLengthTest extends AbstractXpathTestSupport { + + private final String checkName = MethodLengthCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testSimple() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMethodLengthSimple.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(MethodLengthCheck.class); + moduleConfig.addProperty("max", "10"); + + final String[] expectedViolations = { + "4:5: " + getCheckMessage(MethodLengthCheck.class, MSG_KEY, + 11, 10, "InputXpathMethodLengthSimple"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSimple']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSimple']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSimple']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSimple']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSimple']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSimple']]" + + "/MODIFIERS/LITERAL_PROTECTED" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testNoEmptyLines() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMethodLengthNoEmptyLines.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(MethodLengthCheck.class); + moduleConfig.addProperty("max", "5"); + moduleConfig.addProperty("countEmpty", "false"); + moduleConfig.addProperty("tokens", "METHOD_DEF"); + + final String[] expectedViolations = { + "15:5: " + getCheckMessage(MethodLengthCheck.class, MSG_KEY, 6, 5, "methodOne"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthNoEmptyLines']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthNoEmptyLines']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthNoEmptyLines']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]" + + "/MODIFIERS/LITERAL_PROTECTED" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testSingleToken() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathMethodLengthSingleToken.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(MethodLengthCheck.class); + moduleConfig.addProperty("max", "1"); + moduleConfig.addProperty("tokens", "METHOD_DEF"); + + final String[] expectedViolations = { + "9:9: " + getCheckMessage(MethodLengthCheck.class, MSG_KEY, 3, 1, "methodOne"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSingleToken']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]/ASSIGN/EXPR/LITERAL_NEW" + + "[./IDENT[@text='InputXpathMethodLengthSingleToken']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSingleToken']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]/ASSIGN/EXPR/LITERAL_NEW" + + "[./IDENT[@text='InputXpathMethodLengthSingleToken']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodLengthSingleToken']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]/ASSIGN/EXPR/LITERAL_NEW" + + "[./IDENT[@text='InputXpathMethodLengthSingleToken']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='methodOne']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodNameTest.java index bc0ec2bfd08..5892d062882 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void test1() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMethodName1.java")); + new File(getPath("InputXpathMethodNameDefault.java")); final String pattern = "^[a-z][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -55,7 +55,7 @@ public void test1() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionMethodName1']]" + + "='InputXpathMethodNameDefault']]" + "/OBJBLOCK/METHOD_DEF/IDENT[@text='SecondMethod']" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -63,9 +63,9 @@ public void test1() throws Exception { } @Test - public void test2() throws Exception { + public void testInnerClass() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMethodName2.java")); + new File(getPath("InputXpathMethodNameInner.java")); final String pattern = "^[a-z](_?[a-zA-Z0-9]+)*$"; final DefaultConfiguration moduleConfig = @@ -80,7 +80,7 @@ public void test2() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionMethodName2']]" + + "='InputXpathMethodNameInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]" + "/OBJBLOCK/METHOD_DEF/IDENT[@text='MyMethod2']" ); @@ -89,9 +89,9 @@ public void test2() throws Exception { } @Test - public void test3() throws Exception { + public void testCustomProperties() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMethodName3.java")); + new File(getPath("InputXpathMethodNameCustomProperties.java")); final String pattern = "^[a-z](_?[a-zA-Z0-9]+)*$"; final DefaultConfiguration moduleConfig = diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodParamPadTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodParamPadTest.java index 07be430b5fd..fa761b4cf99 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodParamPadTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodParamPadTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMethodParamPadOne.java")); + new File(getPath("InputXpathMethodParamPadOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MethodParamPadCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMethodParamPadOne']]/OBJBLOCK" + + "[@text='InputXpathMethodParamPadOne']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='InputMethodParamPad']]/LPAREN" ); @@ -63,7 +63,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMethodParamPadTwo.java")); + new File(getPath("InputXpathMethodParamPadTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MethodParamPadCheck.class); @@ -75,7 +75,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMethodParamPadTwo']]/OBJBLOCK" + + "[@text='InputXpathMethodParamPadTwo']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sayHello']]/LPAREN" ); @@ -86,7 +86,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMethodParamPadThree.java")); + new File(getPath("InputXpathMethodParamPadThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MethodParamPadCheck.class); @@ -99,7 +99,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMethodParamPadThree']]/OBJBLOCK" + + "[@text='InputXpathMethodParamPadThree']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sayHello']]/LPAREN" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodTypeParameterNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodTypeParameterNameTest.java new file mode 100644 index 00000000000..4ab22b258d1 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMethodTypeParameterNameTest.java @@ -0,0 +1,126 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterNameCheck.MSG_INVALID_PATTERN; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.naming.MethodTypeParameterNameCheck; + +public class XpathRegressionMethodTypeParameterNameTest extends AbstractXpathTestSupport { + + private final String checkName = MethodTypeParameterNameCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void test1() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMethodTypeParameterNameDefault.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MethodTypeParameterNameCheck.class); + + final String[] expectedViolation = { + "4:11: " + getCheckMessage(MethodTypeParameterNameCheck.class, + MSG_INVALID_PATTERN, "TT", "^[A-Z]$"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./" + + "IDENT[@text='InputXpathMethodTypeParameterNameDefault']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/TYPE_PARAMETERS" + + "/TYPE_PARAMETER[./IDENT[@text='TT']]", "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[" + + "@text='InputXpathMethodTypeParameterNameDefault']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + + "/TYPE_PARAMETERS/TYPE_PARAMETER/IDENT[@text='TT']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void test2() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMethodTypeParameterNameInner.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MethodTypeParameterNameCheck.class); + moduleConfig.addProperty("format", "^foo$"); + + final String[] expectedViolation = { + "6:10: " + getCheckMessage(MethodTypeParameterNameCheck.class, + MSG_INVALID_PATTERN, "fo_", "^foo$"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathMethodTypeParameterNameInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Junk']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='foo']]/TYPE_PARAMETERS" + + "/TYPE_PARAMETER[./IDENT[@text='fo_']]", "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text=" + + "'InputXpathMethodTypeParameterNameInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Junk']]/OBJBLOCK" + + "/METHOD_DEF[./IDENT[@text='foo']]/TYPE_PARAMETERS" + + "/TYPE_PARAMETER/IDENT[@text='fo_']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void test3() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathMethodTypeParameterNameLowercase.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MethodTypeParameterNameCheck.class); + moduleConfig.addProperty("format", "^[a-z]$"); + + final String[] expectedViolation = { + "7:6: " + getCheckMessage(MethodTypeParameterNameCheck.class, + MSG_INVALID_PATTERN, "a_a", "^[a-z]$"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMethodTypeParameterNameLowercase']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myMethod']]/TYPE_PARAMETERS" + + "/TYPE_PARAMETER[./IDENT[@text='a_a']]", "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text=" + + "'InputXpathMethodTypeParameterNameLowercase']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myMethod']]" + + "/TYPE_PARAMETERS/TYPE_PARAMETER/IDENT[@text='a_a']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingCtorTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingCtorTest.java index e382799c7b5..dc0fb2d7114 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingCtorTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingCtorTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testMissingCtor() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingCtor1.java")); + "InputXpathMissingCtor.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingCtorCheck.class); @@ -52,11 +52,11 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingCtor1']]", + + "[./IDENT[@text='InputXpathMissingCtor']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingCtor1']]/MODIFIERS", + + "[./IDENT[@text='InputXpathMissingCtor']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMissingCtor1']]/MODIFIERS/LITERAL_PUBLIC" + + "@text='InputXpathMissingCtor']]/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -64,9 +64,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testInnerClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingCtor2.java")); + "InputXpathMissingCtorInner.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingCtorCheck.class); @@ -78,13 +78,13 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMissingCtor2']]" + + "@text='InputXpathMissingCtorInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMissingCtor2']]" + + "@text='InputXpathMissingCtorInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMissingCtor2']]" + + "@text='InputXpathMissingCtorInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/LITERAL_CLASS" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocMethodTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocMethodTest.java index b9da91959db..d8a546d8f88 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocMethodTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocMethodTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,9 +36,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testMissingJavadocMethodCtor() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMissingJavadocMethod1.java") + getPath("InputXpathMissingJavadocMethodCtor.java") ); final DefaultConfiguration moduleConfig = @@ -52,20 +52,20 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingJavadocMethod1']]" + + "[@text='InputXpathMissingJavadocMethodCtor']]" + "/OBJBLOCK/CTOR_DEF[." - + "/IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]", + + "/IDENT[@text='InputXpathMissingJavadocMethodCtor']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]" + + "[./IDENT[@text='InputXpathMissingJavadocMethodCtor']]" + "/OBJBLOCK/CTOR_DEF[." - + "/IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]" + + "/IDENT[@text='InputXpathMissingJavadocMethodCtor']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]" + + "[./IDENT[@text='InputXpathMissingJavadocMethodCtor']]" + "/OBJBLOCK/CTOR_DEF[." - + "/IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod1']]" + + "/IDENT[@text='InputXpathMissingJavadocMethodCtor']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -73,9 +73,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testMissingJavadocMethod() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMissingJavadocMethod2.java") + getPath("InputXpathMissingJavadocMethod.java") ); final DefaultConfiguration moduleConfig = @@ -89,16 +89,16 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod2']]" + + "[./IDENT[@text='InputXpathMissingJavadocMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod2']]" + + "[./IDENT[@text='InputXpathMissingJavadocMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocMethod2']]" + + "[./IDENT[@text='InputXpathMissingJavadocMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocPackageTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocPackageTest.java index 2e1238ddc7e..3caadb6f6a2 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocPackageTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocPackageTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java index f6853f293f1..f5917ae8521 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingJavadocTypeTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingJavadocTypeClass.java" + "InputXpathMissingJavadocTypeClass.java" )); final DefaultConfiguration moduleConfig = @@ -54,12 +54,12 @@ public void testClass() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeClass']]", + + "[./IDENT[@text='InputXpathMissingJavadocTypeClass']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeClass']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeClass']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeClass']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeClass']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -69,7 +69,7 @@ public void testClass() throws Exception { @Test public void testScope() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingJavadocTypeScope.java" + "InputXpathMissingJavadocTypeScope.java" )); final DefaultConfiguration moduleConfig = @@ -84,13 +84,13 @@ public void testScope() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeScope']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeScope']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeScope']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeScope']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeScope']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeScope']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS/LITERAL_PRIVATE" ); @@ -100,7 +100,7 @@ public void testScope() throws Exception { @Test public void testExcluded() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingJavadocTypeExcluded.java" + "InputXpathMissingJavadocTypeExcluded.java" )); final DefaultConfiguration moduleConfig = @@ -116,13 +116,13 @@ public void testExcluded() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeExcluded']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeExcluded']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeExcluded']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeExcluded']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingJavadocTypeExcluded']]" + + "[./IDENT[@text='InputXpathMissingJavadocTypeExcluded']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Test']]/MODIFIERS/LITERAL_PRIVATE" ); @@ -132,7 +132,7 @@ public void testExcluded() throws Exception { @Test public void testAnnotation() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingJavadocTypeAnnotation.java" + "InputXpathMissingJavadocTypeAnnotation.java" )); final DefaultConfiguration moduleConfig = @@ -147,17 +147,17 @@ public void testAnnotation() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]" + + "'InputXpathMissingJavadocTypeAnnotation']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]" + + "'InputXpathMissingJavadocTypeAnnotation']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]" + + "'InputXpathMissingJavadocTypeAnnotation']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='TestAnnotation2']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeAnnotation']]" + + "'InputXpathMissingJavadocTypeAnnotation']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='innerClass']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='TestAnnotation2']]/AT" ); @@ -168,7 +168,7 @@ public void testAnnotation() throws Exception { @Test public void testToken() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingJavadocTypeToken.java" + "InputXpathMissingJavadocTypeToken.java" )); final DefaultConfiguration moduleConfig = @@ -183,12 +183,12 @@ public void testToken() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeToken']]", + + "'InputXpathMissingJavadocTypeToken']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeToken']]" + + "'InputXpathMissingJavadocTypeToken']]" + "/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionMissingJavadocTypeToken']]" + + "'InputXpathMissingJavadocTypeToken']]" + "/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingNullCaseInSwitchTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingNullCaseInSwitchTest.java new file mode 100644 index 00000000000..9f6ed25ccc1 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingNullCaseInSwitchTest.java @@ -0,0 +1,88 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.MissingNullCaseInSwitchCheck; + +public class XpathRegressionMissingNullCaseInSwitchTest + extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return MissingNullCaseInSwitchCheck.class.getSimpleName(); + } + + @Test + public void testSimple() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathMissingNullCaseInSwitchSimple.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MissingNullCaseInSwitchCheck.class); + final String[] expectedViolation = { + "8:9: " + getCheckMessage(MissingNullCaseInSwitchCheck.class, + MissingNullCaseInSwitchCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMissingNullCaseInSwitchSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testNestedExpression() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath("InputXpathMissingNullCaseInSwitchNested.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MissingNullCaseInSwitchCheck.class); + final String[] expectedViolation = { + "11:25: " + getCheckMessage(MissingNullCaseInSwitchCheck.class, + MissingNullCaseInSwitchCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMissingNullCaseInSwitchNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='x']]/ASSIGN/EXPR/LITERAL_SWITCH/SWITCH_RULE/SLIST" + + "/VARIABLE_DEF[./IDENT[@text='y']]/ASSIGN/EXPR", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMissingNullCaseInSwitchNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='x']]/ASSIGN/EXPR/LITERAL_SWITCH" + + "/SWITCH_RULE/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='y']]/ASSIGN/EXPR/LITERAL_SWITCH" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java index 0d6b4e0b5c7..58ca781698f 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingOverrideTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testClass() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideClass.java")); + "InputXpathMissingOverrideClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -52,13 +52,13 @@ public void testClass() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideClass']]" + + "[./IDENT[@text='InputXpathMissingOverrideClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideClass']]" + + "[./IDENT[@text='InputXpathMissingOverrideClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideClass']]" + + "[./IDENT[@text='InputXpathMissingOverrideClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -71,7 +71,7 @@ public void testClass() throws Exception { @Test public void testInterface() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideInterface.java")); + "InputXpathMissingOverrideInterface.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -83,16 +83,16 @@ public void testInterface() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/LITERAL_BOOLEAN" ); @@ -105,7 +105,7 @@ public void testInterface() throws Exception { @Test public void testAnonymous() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideAnonymous.java")); + "InputXpathMissingOverrideAnonymous.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -117,17 +117,17 @@ public void testAnonymous() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideAnonymous']]" + + "[@text='InputXpathMissingOverrideAnonymous']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='r']]/ASSIGN/EXPR/" + "LITERAL_NEW[./IDENT[@text='Runnable']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='run']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideAnonymous']]" + + "[./IDENT[@text='InputXpathMissingOverrideAnonymous']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='r']]/ASSIGN/EXPR/" + "LITERAL_NEW[./IDENT[@text='Runnable']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='run']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideAnonymous']]" + + "[./IDENT[@text='InputXpathMissingOverrideAnonymous']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='r']]/ASSIGN/EXPR/" + "LITERAL_NEW[./IDENT[@text='Runnable']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='run']]/MODIFIERS/LITERAL_PUBLIC" @@ -140,9 +140,9 @@ public void testAnonymous() throws Exception { } @Test - public void testInheritDocInvalid1() throws Exception { + public void testInheritDocInvalidPrivateMethod() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideInheritDocInvalid1.java")); + "InputXpathMissingOverrideInheritDocInvalidPrivateMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -154,13 +154,13 @@ public void testInheritDocInvalid1() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInheritDocInvalid1']]" + + "[@text='InputXpathMissingOverrideInheritDocInvalidPrivateMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInheritDocInvalid1']]" + + "[@text='InputXpathMissingOverrideInheritDocInvalidPrivateMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInheritDocInvalid1']]" + + "[@text='InputXpathMissingOverrideInheritDocInvalidPrivateMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PRIVATE" ); @@ -171,9 +171,9 @@ public void testInheritDocInvalid1() throws Exception { } @Test - public void testInheritDocInvalid2() throws Exception { + public void testInheritDocInvalidPublicMethod() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideInheritDocInvalid2.java")); + "InputXpathMissingOverrideInheritDocInvalidPublicMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -185,13 +185,13 @@ public void testInheritDocInvalid2() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInheritDocInvalid2']]" + + "[@text='InputXpathMissingOverrideInheritDocInvalidPublicMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInheritDocInvalid2']]" + + "[@text='InputXpathMissingOverrideInheritDocInvalidPublicMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInheritDocInvalid2']]" + + "[@text='InputXpathMissingOverrideInheritDocInvalidPublicMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -202,9 +202,9 @@ public void testInheritDocInvalid2() throws Exception { } @Test - public void testJavaFiveCompatibility1() throws Exception { + public void testJavaFiveCompatibilityOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideClass.java")); + "InputXpathMissingOverrideClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -217,13 +217,13 @@ public void testJavaFiveCompatibility1() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideClass']]" + + "[./IDENT[@text='InputXpathMissingOverrideClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideClass']]" + + "[./IDENT[@text='InputXpathMissingOverrideClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingOverrideClass']]" + + "[./IDENT[@text='InputXpathMissingOverrideClass']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='equals']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -234,9 +234,9 @@ public void testJavaFiveCompatibility1() throws Exception { } @Test - public void testJavaFiveCompatibility2() throws Exception { + public void testJavaFiveCompatibilityTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionMissingOverrideInterface.java")); + "InputXpathMissingOverrideInterface.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MissingOverrideCheck.class); @@ -249,16 +249,16 @@ public void testJavaFiveCompatibility2() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE", "/COMPILATION_UNIT/INTERFACE_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionMissingOverrideInterface']]" + + "[@text='InputXpathMissingOverrideInterface']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/TYPE/LITERAL_BOOLEAN" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingSwitchDefaultTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingSwitchDefaultTest.java index d23e4418f59..bb1d58d0881 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingSwitchDefaultTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMissingSwitchDefaultTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testSimple() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMissingSwitchDefaultOne.java")); + new File(getPath("InputXpathMissingSwitchDefaultSimple.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clss); final String[] expectedViolation = { @@ -50,7 +50,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingSwitchDefaultOne']]" + + "[./IDENT[@text='InputXpathMissingSwitchDefaultSimple']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test1']]" + "/SLIST/LITERAL_SWITCH" ); @@ -59,9 +59,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testNested() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionMissingSwitchDefaultTwo.java")); + new File(getPath("InputXpathMissingSwitchDefaultNested.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clss); @@ -71,11 +71,11 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingSwitchDefaultTwo']]" + + "[./IDENT[@text='InputXpathMissingSwitchDefaultNested']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]" + "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionMissingSwitchDefaultTwo']]" + + "[./IDENT[@text='InputXpathMissingSwitchDefaultNested']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]" + "/SLIST/LITERAL_SWITCH/CASE_GROUP/SLIST/" + "LITERAL_SWITCH" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionModifierOrderTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionModifierOrderTest.java index 409f389cbad..70f2241e0a5 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionModifierOrderTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionModifierOrderTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testMethod() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionModifierOrderMethod.java")); + getPath("InputXpathModifierOrderMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -52,11 +52,11 @@ public void testMethod() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionModifierOrderMethod']]" + + "[@text='InputXpathModifierOrderMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='MethodAnnotation']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionModifierOrderMethod']]" + + "[@text='InputXpathModifierOrderMethod']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/MODIFIERS" + "/ANNOTATION[./IDENT[@text='MethodAnnotation']]/AT"); @@ -66,7 +66,7 @@ public void testMethod() throws Exception { @Test public void testVariable() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionModifierOrderVariable.java")); + getPath("InputXpathModifierOrderVariable.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -77,7 +77,7 @@ public void testVariable() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionModifierOrderVariable']]" + + "[@text='InputXpathModifierOrderVariable']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='var']]/MODIFIERS/LITERAL_PRIVATE"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); @@ -86,7 +86,7 @@ public void testVariable() throws Exception { @Test public void testAnnotation() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionModifierOrderAnnotation.java")); + getPath("InputXpathModifierOrderAnnotation.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -97,10 +97,10 @@ public void testAnnotation() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/ANNOTATION_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionModifierOrderAnnotation']]" + + "[@text='InputXpathModifierOrderAnnotation']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='InterfaceAnnotation']]", "/COMPILATION_UNIT/ANNOTATION_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionModifierOrderAnnotation']]" + + "[@text='InputXpathModifierOrderAnnotation']]" + "/MODIFIERS/ANNOTATION[./IDENT[@text='InterfaceAnnotation']]/AT"); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleStringLiteralsTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleStringLiteralsTest.java new file mode 100644 index 00000000000..43f14d838b8 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleStringLiteralsTest.java @@ -0,0 +1,147 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.coding.MultipleStringLiteralsCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.MultipleStringLiteralsCheck; + +public class XpathRegressionMultipleStringLiteralsTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + + return MultipleStringLiteralsCheck.class.getSimpleName(); + } + + @Test + public void testDefault() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathMultipleStringLiteralsDefault.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MultipleStringLiteralsCheck.class); + + final String[] expectedViolations = { + "4:16: " + getCheckMessage(MultipleStringLiteralsCheck.class, + MSG_KEY, "\"StringContents\"", 2), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMultipleStringLiteralsDefault']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]" + + "/ASSIGN/EXPR[./STRING_LITERAL[@text='StringContents']]", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathMultipleStringLiteralsDefault']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]" + + "/ASSIGN/EXPR/STRING_LITERAL[@text='StringContents']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testAllowDuplicates() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathMultipleStringLiteralsAllowDuplicates.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MultipleStringLiteralsCheck.class); + moduleConfig.addProperty("allowedDuplicates", "2"); + + final String[] expectedViolations = { + "8:19: " + getCheckMessage(MultipleStringLiteralsCheck.class, + MSG_KEY, "\", \"", 3), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMultipleStringLiteralsAllowDuplicates']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myTest']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='a5']]/ASSIGN/EXPR/PLUS[./STRING_LITERAL[@text=', ']]" + + "/PLUS/STRING_LITERAL[@text=', ']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testIgnoreRegexp() throws Exception { + final File fileToProcess = new File( + getPath("InputXpathMultipleStringLiteralsIgnoreRegexp.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MultipleStringLiteralsCheck.class); + moduleConfig.addProperty("ignoreStringsRegexp", "((\"\")|(\", \"))$"); + + final String[] expectedViolations = { + "7:19: " + getCheckMessage(MultipleStringLiteralsCheck.class, + MSG_KEY, "\"DoubleString\"", 2), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathMultipleStringLiteralsIgnoreRegexp']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myTest']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='a3']]/ASSIGN/EXPR/PLUS/STRING_LITERAL[@text='DoubleString']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testIgnoreOccurrenceContext() throws Exception { + final String filePath = + "InputXpathMultipleStringLiteralsIgnoreOccurrenceContext.java"; + final File fileToProcess = new File(getPath(filePath)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(MultipleStringLiteralsCheck.class); + moduleConfig.addProperty("ignoreOccurrenceContext", ""); + + final String[] expectedViolations = { + "5:17: " + getCheckMessage(MultipleStringLiteralsCheck.class, + MSG_KEY, "\"unchecked\"", 3), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" + + "'InputXpathMultipleStringLiteralsIgnoreOccurrenceContext']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a1']]" + + "/ASSIGN/EXPR[./STRING_LITERAL[@text='unchecked']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" + + "'InputXpathMultipleStringLiteralsIgnoreOccurrenceContext']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a1']]" + + "/ASSIGN/EXPR/STRING_LITERAL[@text='unchecked']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleVariableDeclarationsTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleVariableDeclarationsTest.java index 053e5f03681..8955720a1fc 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleVariableDeclarationsTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionMultipleVariableDeclarationsTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testCommaSeparator() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMultipleVariableDeclarationsOne.java")); + getPath("InputXpathMultipleVariableDeclarationsCommaSeparator.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MultipleVariableDeclarationsCheck.class); @@ -52,28 +52,28 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i']]/TYPE/LITERAL_INT", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='j']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='j']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='j']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsOne']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarationsCommaSeparator']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='j']]/TYPE/LITERAL_INT" ); @@ -82,9 +82,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testMultipleVariableDeclarations() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionMultipleVariableDeclarationsTwo.java")); + getPath("InputXpathMultipleVariableDeclarations.java")); final DefaultConfiguration moduleConfig = createModuleConfig(MultipleVariableDeclarationsCheck.class); @@ -96,16 +96,16 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsTwo']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarations']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i1']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsTwo']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarations']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i1']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsTwo']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarations']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i1']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionMultipleVariableDeclarationsTwo']]/OBJBLOCK" + + "@text='InputXpathMultipleVariableDeclarations']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='i1']]/TYPE/LITERAL_INT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNPathComplexityTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNPathComplexityTest.java index ecdf28f718f..b791c19108a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNPathComplexityTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNPathComplexityTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,9 +40,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testMethod() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNPathComplexityOne.java")); + new File(getPath("InputXpathNPathComplexityMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NPathComplexityCheck.class); @@ -55,13 +55,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNPathComplexityOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNPathComplexityMethod']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNPathComplexityOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNPathComplexityMethod']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNPathComplexityOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNPathComplexityMethod']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -70,9 +70,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testStaticBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNPathComplexityTwo.java")); + new File(getPath("InputXpathNPathComplexityStaticBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NPathComplexityCheck.class); @@ -85,7 +85,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNPathComplexityTwo']]" + + "[./IDENT[@text='InputXpathNPathComplexityStaticBlock']]" + "/OBJBLOCK/STATIC_INIT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java index c6bd9c3640d..00c146c5579 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNeedBracesTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testDo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNeedBracesDo.java")); + "InputXpathNeedBracesDo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NeedBracesCheck.class); @@ -52,7 +52,7 @@ public void testDo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNeedBracesDo']]" + + "[./IDENT[@text='InputXpathNeedBracesDo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_DO" ); @@ -63,7 +63,7 @@ public void testDo() throws Exception { @Test public void testSingleLine() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNeedBracesSingleLine.java")); + "InputXpathNeedBracesSingleLine.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NeedBracesCheck.class); @@ -75,7 +75,7 @@ public void testSingleLine() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNeedBracesSingleLine']]" + + "[./IDENT[@text='InputXpathNeedBracesSingleLine']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF" ); @@ -86,7 +86,7 @@ public void testSingleLine() throws Exception { @Test public void testSingleLineLambda() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNeedBracesSingleLineLambda.java")); + "InputXpathNeedBracesSingleLineLambda.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NeedBracesCheck.class); @@ -99,7 +99,7 @@ public void testSingleLineLambda() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNeedBracesSingleLineLambda']]" + + "[./IDENT[@text='InputXpathNeedBracesSingleLineLambda']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='r3']]/ASSIGN/LAMBDA" ); @@ -110,7 +110,7 @@ public void testSingleLineLambda() throws Exception { @Test public void testEmptyLoopBody() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNeedBracesEmptyLoopBody.java")); + "InputXpathNeedBracesEmptyLoopBody.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NeedBracesCheck.class); @@ -121,7 +121,7 @@ public void testEmptyLoopBody() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNeedBracesEmptyLoopBody']]" + + "[./IDENT[@text='InputXpathNeedBracesEmptyLoopBody']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_WHILE" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedForDepthTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedForDepthTest.java index e9166e16404..55e7d299346 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedForDepthTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedForDepthTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testCorrect() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNestedForDepth.java")); + new File(getPath("InputXpathNestedForDepth.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NestedForDepthCheck.class); @@ -52,7 +52,7 @@ public void testCorrect() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNestedForDepth']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNestedForDepth']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_FOR" + "/SLIST/LITERAL_FOR/SLIST/LITERAL_FOR" ); @@ -64,7 +64,7 @@ public void testCorrect() throws Exception { @Test public void testMax() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNestedForDepthMax.java")); + new File(getPath("InputXpathNestedForDepthMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NestedForDepthCheck.class); @@ -77,7 +77,7 @@ public void testMax() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNestedForDepthMax']]" + + "[./IDENT[@text='InputXpathNestedForDepthMax']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/LITERAL_FOR/" + "SLIST/LITERAL_FOR/" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedIfDepthTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedIfDepthTest.java index 4977b550ab5..3f7f2246de2 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedIfDepthTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedIfDepthTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testCorrect() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNestedIfDepth.java")); + new File(getPath("InputXpathNestedIfDepth.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NestedIfDepthCheck.class); @@ -52,7 +52,7 @@ public void testCorrect() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNestedIfDepth']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNestedIfDepth']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF" + "/SLIST/LITERAL_IF/SLIST/LITERAL_IF" ); @@ -64,7 +64,7 @@ public void testCorrect() throws Exception { @Test public void testMax() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNestedIfDepthMax.java")); + new File(getPath("InputXpathNestedIfDepthMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NestedIfDepthCheck.class); @@ -77,7 +77,7 @@ public void testMax() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNestedIfDepthMax']]" + + "[./IDENT[@text='InputXpathNestedIfDepthMax']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/LITERAL_IF/" + "SLIST/LITERAL_IF/" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedTryDepthTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedTryDepthTest.java index 4f8a260db4c..0b809ce7cac 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedTryDepthTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNestedTryDepthTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testCorrect() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNestedTryDepth.java")); + new File(getPath("InputXpathNestedTryDepth.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NestedTryDepthCheck.class); @@ -52,7 +52,7 @@ public void testCorrect() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNestedTryDepth']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNestedTryDepth']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY/SLIST" + "/LITERAL_TRY/SLIST/LITERAL_TRY" ); @@ -64,7 +64,7 @@ public void testCorrect() throws Exception { @Test public void testMax() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNestedTryDepthMax.java")); + new File(getPath("InputXpathNestedTryDepthMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NestedTryDepthCheck.class); @@ -77,7 +77,7 @@ public void testMax() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNestedTryDepthMax']]" + + "[./IDENT[@text='InputXpathNestedTryDepthMax']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/LITERAL_TRY" + "/SLIST/LITERAL_TRY" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoArrayTrailingCommaTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoArrayTrailingCommaTest.java index 0ec07ca862d..3244fb771ed 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoArrayTrailingCommaTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoArrayTrailingCommaTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoArrayTrailingCommaOne.java")); + new File(getPath("InputXpathNoArrayTrailingCommaOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoArrayTrailingCommaCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionNoArrayTrailingCommaOne']]" + + "[@text='InputXpathNoArrayTrailingCommaOne']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='t1']]/ASSIGN/EXPR" + "/LITERAL_NEW/ARRAY_INIT/COMMA[4]" ); @@ -64,7 +64,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoArrayTrailingCommaTwo.java")); + new File(getPath("InputXpathNoArrayTrailingCommaTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoArrayTrailingCommaCheck.class); @@ -76,7 +76,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoArrayTrailingCommaTwo']]" + + "[./IDENT[@text='InputXpathNoArrayTrailingCommaTwo']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='t4']]" + "/ASSIGN/EXPR/LITERAL_NEW/ARRAY_INIT/COMMA" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoCloneTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoCloneTest.java index 210619d68ba..bcea4e6bac8 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoCloneTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoCloneTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testMethod() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoCloneOne.java")); + new File(getPath("InputXpathNoCloneMethod.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoCloneCheck.class); @@ -51,13 +51,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoCloneOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNoCloneMethod']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='clone']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoCloneOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNoCloneMethod']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='clone']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoCloneOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNoCloneMethod']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='clone']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -68,7 +68,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoCloneTwo.java")); + new File(getPath("InputXpathNoCloneInnerClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoCloneCheck.class); @@ -78,15 +78,15 @@ public void testTwo() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionNoCloneTwo']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathNoCloneInnerClass']]" + "/OBJBLOCK" + "/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='clone']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionNoCloneTwo']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathNoCloneInnerClass']]" + "/OBJBLOCK" + "/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='clone']]/MODIFIERS", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionNoCloneTwo']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathNoCloneInnerClass']]" + "/OBJBLOCK" + "/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='clone']]/MODIFIERS/LITERAL_PUBLIC" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoEnumTrailingCommaTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoEnumTrailingCommaTest.java index 830cf98ac11..b2a12ddca0f 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoEnumTrailingCommaTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoEnumTrailingCommaTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNoEnumTrailingCommaOne.java")); + "InputXpathNoEnumTrailingCommaOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoEnumTrailingCommaCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoEnumTrailingCommaOne']]" + + "[./IDENT[@text='InputXpathNoEnumTrailingCommaOne']]" + "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Foo3']]/OBJBLOCK/COMMA[2]" ); @@ -62,7 +62,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNoEnumTrailingCommaTwo.java")); + "InputXpathNoEnumTrailingCommaTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoEnumTrailingCommaCheck.class); @@ -74,7 +74,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoEnumTrailingCommaTwo']]" + + "[./IDENT[@text='InputXpathNoEnumTrailingCommaTwo']]" + "/OBJBLOCK/ENUM_DEF[./IDENT[@text='Foo6']]/OBJBLOCK/COMMA[2]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java index cd0bd5fba70..90dc6f46f30 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoFinalizerTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,9 +36,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testMain() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionNoFinalizer1.java")); + getPath("InputXpathNoFinalizerMain.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoFinalizerCheck.class); @@ -50,13 +50,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer1']]" + + "[./IDENT[@text='InputXpathNoFinalizerMain']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='finalize']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer1']]" + + "[./IDENT[@text='InputXpathNoFinalizerMain']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer1']]" + + "[./IDENT[@text='InputXpathNoFinalizerMain']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS/LITERAL_PROTECTED" ); @@ -65,9 +65,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testInner() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionNoFinalizer2.java")); + getPath("InputXpathNoFinalizerInner.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoFinalizerCheck.class); @@ -79,20 +79,20 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]" + + "[./IDENT[@text='InputXpathNoFinalizerInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='finalize']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]" + + "[./IDENT[@text='InputXpathNoFinalizerInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]" + + "[./IDENT[@text='InputXpathNoFinalizerInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS/" + "ANNOTATION[./IDENT[@text='Override']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoFinalizer2']]" + + "[./IDENT[@text='InputXpathNoFinalizerInner']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='finalize']]/MODIFIERS/" + "ANNOTATION[./IDENT[@text='Override']]/AT" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoLineWrapTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoLineWrapTest.java index 63621e91753..86be6f22fac 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoLineWrapTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoLineWrapTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,9 +36,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionNoLineWrap1.java") + getPath("InputXpathNoLineWrapDefault.java") ); final DefaultConfiguration moduleConfig = @@ -57,9 +57,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testMethodDef() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionNoLineWrap2.java") + getPath("InputXpathNoLineWrapTokensMethodDef.java") ); final DefaultConfiguration moduleConfig = @@ -73,16 +73,16 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionNoLineWrap2']]" + + "[@text='InputXpathNoLineWrapTokensMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionNoLineWrap2']]" + + "[@text='InputXpathNoLineWrapTokensMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionNoLineWrap2']]" + + "[@text='InputXpathNoLineWrapTokensMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test2']]" + "/MODIFIERS/LITERAL_PUBLIC" @@ -92,9 +92,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testTokensCtorDef() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionNoLineWrap3.java") + getPath("InputXpathNoLineWrapTokensCtorDef.java") ); final DefaultConfiguration moduleConfig = @@ -108,17 +108,17 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]" - + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]", + + "[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]" - + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]" + + "[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoLineWrap3']]" - + "/OBJBLOCK/CTOR_DEF/IDENT[@text='SuppressionXpathRegressionNoLineWrap3']" + + "[./IDENT[@text='InputXpathNoLineWrapTokensCtorDef']]" + + "/OBJBLOCK/CTOR_DEF/IDENT[@text='InputXpathNoLineWrapTokensCtorDef']" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceAfterTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceAfterTest.java index 175232a0b6e..fc7cbd4da5a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceAfterTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceAfterTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testNoWhitespaceAfter() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoWhitespaceAfter.java")); + new File(getPath("InputXpathNoWhitespaceAfter.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceAfterCheck.class); @@ -53,10 +53,10 @@ public void testNoWhitespaceAfter() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfter']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNoWhitespaceAfter']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfter']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNoWhitespaceAfter']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/UNARY_MINUS[" + "./NUM_INT[@text='1']]" ); @@ -68,7 +68,7 @@ public void testNoWhitespaceAfter() throws Exception { @Test public void testTokens() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoWhitespaceAfterTokens.java")); + new File(getPath("InputXpathNoWhitespaceAfterTokens.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceAfterCheck.class); @@ -81,7 +81,7 @@ public void testTokens() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterTokens']]" + + "[./IDENT[@text='InputXpathNoWhitespaceAfterTokens']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/TYPE/DOT[./IDENT[@text='String']]" + "/DOT[./IDENT[@text='java']]" @@ -94,7 +94,7 @@ public void testTokens() throws Exception { @Test public void testAllowLineBreaks() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoWhitespaceAfterLineBreaks.java")); + new File(getPath("InputXpathNoWhitespaceAfterLineBreaks.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceAfterCheck.class); @@ -107,20 +107,20 @@ public void testAllowLineBreaks() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]" + + "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]" + + "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]" + + "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceAfterLineBreaks']]" + + "[./IDENT[@text='InputXpathNoWhitespaceAfterLineBreaks']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='s']]" + "/TYPE/DOT[./IDENT[@text='String']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeCaseDefaultColonTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeCaseDefaultColonTest.java index 96bf40cd534..57fbe7f115a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeCaseDefaultColonTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeCaseDefaultColonTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne.java")); + "InputXpathNoWhitespaceBeforeCaseDefaultColonOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCaseDefaultColonCheck.class); @@ -54,7 +54,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne']]" + + "'InputXpathNoWhitespaceBeforeCaseDefaultColonOne']]" + "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP/LITERAL_CASE/COLON" ); @@ -66,7 +66,7 @@ public void testOne() throws Exception { public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo.java")); + "InputXpathNoWhitespaceBeforeCaseDefaultColonTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCaseDefaultColonCheck.class); @@ -78,7 +78,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo']]" + + "'InputXpathNoWhitespaceBeforeCaseDefaultColonTwo']]" + "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP" + "/LITERAL_DEFAULT/COLON" ); @@ -91,7 +91,7 @@ public void testTwo() throws Exception { public void testThree() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree.java")); + "InputXpathNoWhitespaceBeforeCaseDefaultColonThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCaseDefaultColonCheck.class); @@ -103,7 +103,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree']]" + + "'InputXpathNoWhitespaceBeforeCaseDefaultColonThree']]" + "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP" + "/LITERAL_CASE/COLON" ); @@ -116,7 +116,7 @@ public void testThree() throws Exception { public void testFour() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour.java")); + "InputXpathNoWhitespaceBeforeCaseDefaultColonFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCaseDefaultColonCheck.class); @@ -128,7 +128,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour']]" + + "'InputXpathNoWhitespaceBeforeCaseDefaultColonFour']]" + "/OBJBLOCK/INSTANCE_INIT/SLIST/LITERAL_SWITCH/CASE_GROUP" + "/LITERAL_DEFAULT/COLON" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeTest.java index 211c2a763d3..65816fd555b 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionNoWhitespaceBeforeTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testNoWhitespaceBefore() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoWhitespaceBefore.java")); + new File(getPath("InputXpathNoWhitespaceBefore.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCheck.class); @@ -52,7 +52,7 @@ public void testNoWhitespaceBefore() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceBefore']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathNoWhitespaceBefore']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/SEMI" ); @@ -63,7 +63,7 @@ public void testNoWhitespaceBefore() throws Exception { @Test public void testTokens() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoWhitespaceBeforeTokens.java")); + new File(getPath("InputXpathNoWhitespaceBeforeTokens.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCheck.class); @@ -76,7 +76,7 @@ public void testTokens() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceBeforeTokens']]" + + "[./IDENT[@text='InputXpathNoWhitespaceBeforeTokens']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/TYPE/DOT[./IDENT[@text='String']]" + "/DOT[./IDENT[@text='java']]" @@ -89,7 +89,7 @@ public void testTokens() throws Exception { @Test public void testAllowLineBreaks() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks.java")); + new File(getPath("InputXpathNoWhitespaceBeforeLineBreaks.java")); final DefaultConfiguration moduleConfig = createModuleConfig(NoWhitespaceBeforeCheck.class); @@ -102,7 +102,7 @@ public void testAllowLineBreaks() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks']]" + + "[./IDENT[@text='InputXpathNoWhitespaceBeforeLineBreaks']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='array']]" + "/ASSIGN/ARRAY_INIT/COMMA" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneStatementPerLineTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneStatementPerLineTest.java index b36cf561348..d7af3fe0ccf 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneStatementPerLineTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneStatementPerLineTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testClassFields() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOneStatementPerLineOne.java")); + new File(getPath("InputXpathOneStatementPerLineClassFields.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OneStatementPerLineCheck.class); @@ -52,7 +52,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionOneStatementPerLineOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathOneStatementPerLineClassFields']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='j']]/SEMI" ); @@ -61,9 +61,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testForLoopBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOneStatementPerLineTwo.java")); + new File(getPath("InputXpathOneStatementPerLineForLoopBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OneStatementPerLineCheck.class); @@ -75,7 +75,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionOneStatementPerLineTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathOneStatementPerLineForLoopBlock']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='foo5']]/SLIST/LITERAL_FOR/SLIST/SEMI[2]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneTopLevelClassTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneTopLevelClassTest.java index 144ec2db537..9574853414b 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneTopLevelClassTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOneTopLevelClassTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOneTopLevelClassFirst.java")); + new File(getPath("InputXpathOneTopLevelClassFirst.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OneTopLevelClassCheck.class); @@ -63,7 +63,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOneTopLevelClassSecond.java")); + new File(getPath("InputXpathOneTopLevelClassSecond.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OneTopLevelClassCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOperatorWrapTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOperatorWrapTest.java index 34713562d1f..28f799392bd 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOperatorWrapTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOperatorWrapTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOperatorWrapNewLine() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOperatorWrapNewLine.java")); + new File(getPath("InputXpathOperatorWrapNewLine.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OperatorWrapCheck.class); @@ -53,7 +53,7 @@ public void testOperatorWrapNewLine() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionOperatorWrapNewLine']]" + + "='InputXpathOperatorWrapNewLine']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='x']]" + "/ASSIGN/EXPR/MINUS[./NUM_INT[@text='4']]" @@ -67,7 +67,7 @@ public void testOperatorWrapNewLine() throws Exception { @Test public void testOperatorWrapPreviousLine() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOperatorWrapPreviousLine.java")); + new File(getPath("InputXpathOperatorWrapPreviousLine.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OperatorWrapCheck.class); @@ -81,7 +81,7 @@ public void testOperatorWrapPreviousLine() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionOperatorWrapPreviousLine']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathOperatorWrapPreviousLine']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='b']]" + "/ASSIGN" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeFilenameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeFilenameTest.java index 95b287be431..b4cc2d80eda 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeFilenameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeFilenameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testNoPublic() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionOuterTypeFilename1.java")); + "InputXpathOuterTypeFilenameOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OuterTypeFilenameCheck.class); @@ -63,7 +63,7 @@ public void testNoPublic() throws Exception { @Test public void testNested() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionOuterTypeFilename2.java")); + "InputXpathOuterTypeFilenameTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OuterTypeFilenameCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java index e0637f4e3ef..4ad21fad172 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOuterTypeNumberTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOuterTypeNumberDefault.java")); + new File(getPath("InputXpathOuterTypeNumberDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OuterTypeNumberCheck.class); @@ -61,7 +61,7 @@ public void testDefault() throws Exception { @Test public void testMax() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionOuterTypeNumber.java")); + new File(getPath("InputXpathOuterTypeNumber.java")); final DefaultConfiguration moduleConfig = createModuleConfig(OuterTypeNumberCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOverloadMethodsDeclarationOrderTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOverloadMethodsDeclarationOrderTest.java index 0245e3d9e18..170432f7933 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOverloadMethodsDeclarationOrderTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionOverloadMethodsDeclarationOrderTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionOverloadMethodsDeclarationOrder1.java")); + getPath("InputXpathOverloadMethodsDeclarationOrderDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -52,13 +52,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]" + + "[@text='InputXpathOverloadMethodsDeclarationOrderDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]" + + "[@text='InputXpathOverloadMethodsDeclarationOrderDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT" - + "[@text='SuppressionXpathRegressionOverloadMethodsDeclarationOrder1']]" + + "[@text='InputXpathOverloadMethodsDeclarationOrderDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -67,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testAnonymous() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionOverloadMethodsDeclarationOrder2.java")); + getPath("InputXpathOverloadMethodsDeclarationOrderAnonymous.java")); final DefaultConfiguration moduleConfig = createModuleConfig(clazz); @@ -80,19 +80,19 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]" + + "'InputXpathOverloadMethodsDeclarationOrderAnonymous']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text=" - + "'MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]" + + "'MyInputXpathOverloadMethodsDeclarationOrderAnonymous']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]" + + "'InputXpathOverloadMethodsDeclarationOrderAnonymous']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text=" - + "'MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]" + + "'MyInputXpathOverloadMethodsDeclarationOrderAnonymous']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]" + + "'InputXpathOverloadMethodsDeclarationOrderAnonymous']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text=" - + "'MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2']]" + + "'MyInputXpathOverloadMethodsDeclarationOrderAnonymous']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='overloadMethod']]" + "/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageAnnotationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageAnnotationTest.java index 016dddd58d8..72dc53cfc8c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageAnnotationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageAnnotationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { public void testOne() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionPackageAnnotationOne.java")); + "InputXpathPackageAnnotationOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageAnnotationCheck.class); @@ -62,7 +62,7 @@ public void testOne() throws Exception { public void testTwo() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionPackageAnnotationTwo.java")); + "InputXpathPackageAnnotationTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageAnnotationCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageDeclarationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageDeclarationTest.java index bf36bc68798..44d90d015e3 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageDeclarationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageDeclarationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void test1() throws Exception { + public void testWrongPackage() throws Exception { final File fileToProcess = - new File(getNonCompilablePath("SuppressionXpathRegression1.java")); + new File(getNonCompilablePath("InputXpathWrongPackage.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageDeclarationCheck.class); @@ -59,9 +59,9 @@ public void test1() throws Exception { } @Test - public void test2() throws Exception { + public void testMissingPackage() throws Exception { final File fileToProcess = - new File(getNonCompilablePath("SuppressionXpathRegression2.java")); + new File(getNonCompilablePath("InputXpathMissingPackage.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PackageDeclarationCheck.class); @@ -73,11 +73,11 @@ public void test2() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRegression2']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathMissingPackage']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegression2']]/MODIFIERS", + + "[./IDENT[@text='InputXpathMissingPackage']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegression2']]/MODIFIERS/LITERAL_PUBLIC" + + "[./IDENT[@text='InputXpathMissingPackage']]/MODIFIERS/LITERAL_PUBLIC" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageNameTest.java new file mode 100644 index 00000000000..11feafb1fef --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPackageNameTest.java @@ -0,0 +1,124 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck.MSG_KEY; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck; + +public class XpathRegressionPackageNameTest extends AbstractXpathTestSupport { + + private final String checkName = PackageNameCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testOne() throws Exception { + + final File fileToProcess = + new File(getPath("InputXpathPackageNameOne.java")); + + final String pattern = "[A-Z]+"; + + final DefaultConfiguration moduleConfig = createModuleConfig(PackageNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final String[] expectedViolation = { + "1:9: " + getCheckMessage(PackageNameCheck.class, MSG_KEY, + "org.checkstyle.suppressionxpathfilter.packagename", + pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/PACKAGE_DEF/DOT" + + "[./IDENT[@text='packagename']]/DOT" + + "[./IDENT[@text='suppressionxpathfilter']]" + + "/DOT/IDENT[@text='org']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + + } + + @Test + public void testThree() throws Exception { + + final File fileToProcess = + new File(getNonCompilablePath("InputXpathPackageNameThree.java")); + + final String pattern = "^[a-z]+(\\.[a-z][a-z0-9]*)*$"; + + final DefaultConfiguration moduleConfig = createModuleConfig(PackageNameCheck.class); + moduleConfig.addProperty("format", pattern); + final String[] expectedViolations = { + "1:9: " + getCheckMessage(PackageNameCheck.class, MSG_KEY, + "org.checkstyle.suppressionxpathfilter.PACKAGENAME", + pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/PACKAGE_DEF/DOT[./IDENT" + + "[@text='PACKAGENAME']]/DOT[./IDENT" + + "[@text='suppressionxpathfilter']]" + + "/DOT/IDENT[@text='org']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, + expectedXpathQueries); + } + + @Test + public void testTwo() throws Exception { + + final File fileToProcess = + new File(getPath("InputXpathPackageNameTwo.java")); + + final String pattern = "[A-Z]+"; + + final DefaultConfiguration moduleConfig = createModuleConfig(PackageNameCheck.class); + moduleConfig.addProperty("format", pattern); + + final String[] expectedViolation = { + "2:9: " + getCheckMessage(PackageNameCheck.class, MSG_KEY, + "org.checkstyle.suppressionxpathfilter.packagename", + pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/PACKAGE_DEF/DOT" + + "[./IDENT[@text='packagename']]/DOT" + + "[./IDENT[@text='suppressionxpathfilter']]" + + "/DOT/IDENT[@text='org']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterAssignmentTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterAssignmentTest.java new file mode 100644 index 00000000000..578924da6e4 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterAssignmentTest.java @@ -0,0 +1,124 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.coding.ParameterAssignmentCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.ParameterAssignmentCheck; + +public class XpathRegressionParameterAssignmentTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return ParameterAssignmentCheck.class.getSimpleName(); + } + + @Test + public void testMethods() throws Exception { + final String filePath = + getPath("InputXpathParameterAssignmentMethods.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = + createModuleConfig(ParameterAssignmentCheck.class); + + final String[] expectedViolations = { + "9:15: " + getCheckMessage(ParameterAssignmentCheck.class, MSG_KEY, "field"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentMethods']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='Test1']]/SLIST/EXPR" + + "[./PLUS_ASSIGN/IDENT[@text='field']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentMethods']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='Test1']]" + + "/SLIST/EXPR/PLUS_ASSIGN[./IDENT[@text='field']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + + } + + @Test + public void testLambdas() throws Exception { + final String filePath = + getPath("InputXpathParameterAssignmentLambdas.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = + createModuleConfig(ParameterAssignmentCheck.class); + + final String[] expectedViolations = { + "9:32: " + getCheckMessage(ParameterAssignmentCheck.class, MSG_KEY, "q"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentLambdas']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='obj1']]" + + "/ASSIGN/LAMBDA[./IDENT[@text='q']]/EXPR", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentLambdas']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='obj1']]/ASSIGN/LAMBDA[./IDENT[" + + "@text='q']]/EXPR/POST_INC[./IDENT[@text='q']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testCtor() throws Exception { + final String filePath = + getPath("InputXpathParameterAssignmentCtor.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = + createModuleConfig(ParameterAssignmentCheck.class); + + final String[] expectedViolations = { + "9:15: " + getCheckMessage(ParameterAssignmentCheck.class, MSG_KEY, "field"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentCtor']]" + + "/SLIST/EXPR[./PLUS_ASSIGN/IDENT[@text='field']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[" + + "@text='InputXpathParameterAssignmentCtor']]" + + "/SLIST/EXPR/PLUS_ASSIGN[./IDENT[@text='field']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNameTest.java index 9739fe18e37..9c58147781a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testDefaultPattern() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParameterNameDefaultPattern.java")); + new File(getPath("InputXpathParameterNameDefaultPattern.java")); final String pattern = "^[a-z][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -55,7 +55,7 @@ public void testDefaultPattern() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionParameterNameDefaultPattern']]" + + "='InputXpathParameterNameDefaultPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method1']]" + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='v_1']" ); @@ -66,7 +66,7 @@ public void testDefaultPattern() throws Exception { @Test public void testDifferentPattern() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParameterNameDifferentPattern.java")); + new File(getPath("InputXpathParameterNameDifferentPattern.java")); final String pattern = "^[a-z][_a-zA-Z0-9]+$"; final DefaultConfiguration moduleConfig = @@ -81,7 +81,7 @@ public void testDifferentPattern() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionParameterNameDifferentPattern']]" + + "='InputXpathParameterNameDifferentPattern']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]" + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='V2']" ); @@ -92,7 +92,7 @@ public void testDifferentPattern() throws Exception { @Test public void testIgnoreOverridden() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParameterNameIgnoreOverridden.java")); + new File(getPath("InputXpathParameterNameIgnoreOverridden.java")); final String pattern = "^[a-z][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -107,7 +107,7 @@ public void testIgnoreOverridden() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionParameterNameIgnoreOverridden']]" + + "='InputXpathParameterNameIgnoreOverridden']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]" + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='V2']" ); @@ -118,7 +118,7 @@ public void testIgnoreOverridden() throws Exception { @Test public void testAccessModifiers() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParameterNameAccessModifier.java")); + new File(getPath("InputXpathParameterNameAccessModifier.java")); final String pattern = "^[a-z][a-z0-9][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -134,7 +134,7 @@ public void testAccessModifiers() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionParameterNameAccessModifier']]" + + "='InputXpathParameterNameAccessModifier']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method2']]" + "/PARAMETERS/PARAMETER_DEF/IDENT[@text='b']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java new file mode 100644 index 00000000000..6e110fd7e2c --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParameterNumberTest.java @@ -0,0 +1,132 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck.MSG_KEY; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck; + +public class XpathRegressionParameterNumberTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return ParameterNumberCheck.class.getSimpleName(); + } + + @Test + public void testDefault() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathParameterNumberDefault.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class); + + final String[] expectedViolations = { + "5:10: " + getCheckMessage(ParameterNumberCheck.class, MSG_KEY, 7, 11), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathParameterNumberDefault']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='myMethod']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + + } + + @Test + public void testMethods() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathParameterNumberMethods.java")); + + final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class); + moduleConfig.addProperty("max", "10"); + moduleConfig.addProperty("tokens", "METHOD_DEF"); + + final String[] expectedViolations = { + "7:10: " + getCheckMessage(ParameterNumberCheck.class, MSG_KEY, 10, 11), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathParameterNumberMethods']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='myMethod']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testIgnoreOverriddenMethods() throws Exception { + final String filePath = + getPath("InputXpathParameterNumberIgnoreOverriddenMethods.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class); + moduleConfig.addProperty("ignoreOverriddenMethods", "true"); + + final String[] expectedViolations = { + "6:13: " + getCheckMessage(ParameterNumberCheck.class, MSG_KEY, 7, 8), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathParameterNumberIgnoreOverriddenMethods']]" + + "/OBJBLOCK/CTOR_DEF/IDENT" + + "[@text='InputXpathParameterNumberIgnoreOverriddenMethods']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } + + @Test + public void testIgnoreAnnotatedBy() throws Exception { + final String filePath = + getPath("InputXpathParameterNumberIgnoreAnnotatedBy.java"); + final File fileToProcess = new File(filePath); + + final DefaultConfiguration moduleConfig = createModuleConfig(ParameterNumberCheck.class); + moduleConfig.addProperty("ignoreAnnotatedBy", "MyAnno"); + moduleConfig.addProperty("max", "2"); + + final String[] expectedViolations = { + "15:34: " + getCheckMessage(ParameterNumberCheck.class, MSG_KEY, 2, 3), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathParameterNumberIgnoreAnnotatedBy']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]" + + "/OBJBLOCK/STATIC_INIT/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='Object']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]" + + "/SLIST/LITERAL_IF/SLIST/EXPR/LITERAL_NEW[./IDENT[@text='Object']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='checkedMethod']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParenPadTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParenPadTest.java index 9435a63a72e..4f8c22931e9 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParenPadTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionParenPadTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testLeftFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParenPadLeftFollowed.java")); + new File(getPath("InputXpathParenPadLeftFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ParenPadCheck.class); @@ -54,7 +54,7 @@ public void testLeftFollowed() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionParenPadLeftFollowed']]" + + "[./IDENT[@text='InputXpathParenPadLeftFollowed']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/LPAREN" ); @@ -65,7 +65,7 @@ public void testLeftFollowed() throws Exception { @Test public void testLeftNotFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParenPadLeftNotFollowed.java")); + new File(getPath("InputXpathParenPadLeftNotFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ParenPadCheck.class); @@ -78,7 +78,7 @@ public void testLeftNotFollowed() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionParenPadLeftNotFollowed']]" + + "[./IDENT[@text='InputXpathParenPadLeftNotFollowed']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/LPAREN" ); @@ -89,7 +89,7 @@ public void testLeftNotFollowed() throws Exception { @Test public void testRightPreceded() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParenPadRightPreceded.java")); + new File(getPath("InputXpathParenPadRightPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ParenPadCheck.class); @@ -101,7 +101,7 @@ public void testRightPreceded() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionParenPadRightPreceded']]" + + "[./IDENT[@text='InputXpathParenPadRightPreceded']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/RPAREN" ); @@ -112,7 +112,7 @@ public void testRightPreceded() throws Exception { @Test public void testRightNotPreceded() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionParenPadRightNotPreceded.java")); + new File(getPath("InputXpathParenPadRightNotPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ParenPadCheck.class); @@ -125,7 +125,7 @@ public void testRightNotPreceded() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionParenPadRightNotPreceded']]" + + "[./IDENT[@text='InputXpathParenPadRightNotPreceded']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='method']]/SLIST/LITERAL_IF/RPAREN" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPatternVariableNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPatternVariableNameTest.java index 5886fca71e3..c8b6e2cd780 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPatternVariableNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionPatternVariableNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,11 +42,11 @@ protected String getCheckName() { public void testOne() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionPatternVariableName1.java")); + "InputXpathPatternVariableNameOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(PatternVariableNameCheck.class); - final String defaultPattern = "^[a-z][a-zA-Z0-9]*$"; + final String defaultPattern = "^([a-z][a-zA-Z0-9]*|_)$"; final String[] expectedViolation = { "6:33: " + getCheckMessage(PatternVariableNameCheck.class, @@ -56,7 +56,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionPatternVariableName1']]" + + "[./IDENT[@text='InputXpathPatternVariableNameOne']]" + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='MyClass']]/SLIST/LITERAL_IF/EXPR/" + "LITERAL_INSTANCEOF[./IDENT[@text='o1']]/PATTERN_VARIABLE_DEF/" + "IDENT[@text='STRING1']" @@ -70,7 +70,7 @@ public void testOne() throws Exception { public void testTwo() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionPatternVariableName2.java")); + "InputXpathPatternVariableNameTwo.java")); final String nonDefaultPattern = "^_[a-zA-Z0-9]*$"; @@ -85,7 +85,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionPatternVariableName2']]" + + "[./IDENT[@text='InputXpathPatternVariableNameTwo']]" + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='MyClass']]/SLIST/LITERAL_IF/EXPR/" + "LITERAL_INSTANCEOF[./IDENT[@text='o1']]/" + "PATTERN_VARIABLE_DEF/IDENT[@text='s']" @@ -99,7 +99,7 @@ public void testTwo() throws Exception { public void testThree() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionPatternVariableName3.java")); + "InputXpathPatternVariableNameThree.java")); final String nonDefaultPattern = "^[a-z](_?[a-zA-Z0-9]+)*$"; @@ -114,7 +114,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionPatternVariableName3']]" + + "[./IDENT[@text='InputXpathPatternVariableNameThree']]" + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='MyClass']]/SLIST/LITERAL_IF/" + "EXPR/LITERAL_INSTANCEOF[./IDENT[@text='o1']]/" + "PATTERN_VARIABLE_DEF/IDENT[@text='STR']" @@ -128,7 +128,7 @@ public void testThree() throws Exception { public void testFour() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionPatternVariableName4.java")); + "InputXpathPatternVariableNameFour.java")); final String nonDefaultPattern = "^[a-z][_a-zA-Z0-9]{2,}$"; @@ -143,7 +143,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionPatternVariableName1']]" + + "[./IDENT[@text='InputXpathPatternVariableNameFour']]" + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='MyClass']]/SLIST/LITERAL_IF/EXPR/" + "LITERAL_INSTANCEOF[./IDENT[@text='o1']]/" + "PATTERN_VARIABLE_DEF/IDENT[@text='st']" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNameTest.java index 561e3d2a7a4..29a365b56df 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRecordComponentName1.java")); + "InputXpathRecordComponentNameDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RecordComponentNameCheck.class); @@ -53,7 +53,7 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='SuppressionXpathRecordComponentName1']]" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='InputXpathRecordComponentNameDefault']]" + "/RECORD_COMPONENTS/RECORD_COMPONENT_DEF/IDENT[@text='_value']" ); @@ -62,9 +62,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testFormat() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRecordComponentName2.java")); + "InputXpathRecordComponentNameFormat.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RecordComponentNameCheck.class); @@ -78,7 +78,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRecordComponentName2']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRecordComponentNameFormat']]/OBJBLOCK" + "/RECORD_DEF[./IDENT[@text='MyRecord']]" + "/RECORD_COMPONENTS/RECORD_COMPONENT_DEF/IDENT[@text='otherValue']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNumberTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNumberTest.java index a87a7044018..7ccafe659e8 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNumberTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordComponentNumberTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRecordComponentNumber1.java")); + "InputXpathRecordComponentNumberDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RecordComponentNumberCheck.class); @@ -52,10 +52,10 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='SuppressionXpathRecordComponentNumber1']]", - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='SuppressionXpathRecordComponentNumber1']]" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='InputXpathRecordComponentNumberDefault']]", + "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='InputXpathRecordComponentNumberDefault']]" + "/MODIFIERS", - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='SuppressionXpathRecordComponentNumber1']]" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='InputXpathRecordComponentNumberDefault']]" + "/MODIFIERS/LITERAL_PUBLIC" ); @@ -64,9 +64,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testCustomMax() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRecordComponentNumber2.java")); + "InputXpathRecordComponentNumberCustomMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RecordComponentNumberCheck.class); @@ -79,11 +79,11 @@ public void testTwo() throws Exception { }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRecordComponentNumber2']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathRecordComponentNumberCustomMax']]" + "/OBJBLOCK/RECORD_DEF[./IDENT[@text='MyRecord']]", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRecordComponentNumber2']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathRecordComponentNumberCustomMax']]" + "/OBJBLOCK/RECORD_DEF[./IDENT[@text='MyRecord']]/MODIFIERS", - "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='SuppressionXpathRecordComponentNumber2']]" + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathRecordComponentNumberCustomMax']]" + "/OBJBLOCK/RECORD_DEF[./IDENT[@text='MyRecord']]/MODIFIERS" + "/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordTypeParameterNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordTypeParameterNameTest.java index b1562cacb84..441e96a20c2 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordTypeParameterNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRecordTypeParameterNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testTypeDeclared() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionRecordTypeParameterName1.java")); + "InputXpathRecordTypeParameterNameTypeDeclared.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RecordTypeParameterNameCheck.class); @@ -49,14 +49,16 @@ public void testOne() throws Exception { final String pattern = "^[A-Z]$"; final String[] expectedViolation = { - "7:15: " + getCheckMessage(RecordTypeParameterNameCheck.class, + "7:55: " + getCheckMessage(RecordTypeParameterNameCheck.class, AbstractNameCheck.MSG_INVALID_PATTERN, "foo", pattern), }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='Other']]/" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='" + + "InputXpathRecordTypeParameterNameTypeDeclared']]/" + "TYPE_PARAMETERS/TYPE_PARAMETER[./IDENT[@text='foo']]", - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='Other']]/TYPE_PARAMETERS/" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='" + + "InputXpathRecordTypeParameterNameTypeDeclared']]/TYPE_PARAMETERS/" + "TYPE_PARAMETER/IDENT[@text='foo']" ); @@ -65,9 +67,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testTypeDefault() throws Exception { final File fileToProcess = new File(getNonCompilablePath( - "SuppressionXpathRegressionRecordTypeParameterName2.java")); + "InputXpathRecordTypeParameterNameTypeDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RecordTypeParameterNameCheck.class); @@ -75,14 +77,16 @@ public void testTwo() throws Exception { final String pattern = "^[A-Z]$"; final String[] expectedViolation = { - "4:44: " + getCheckMessage(RecordTypeParameterNameCheck.class, + "4:60: " + getCheckMessage(RecordTypeParameterNameCheck.class, AbstractNameCheck.MSG_INVALID_PATTERN, "t", pattern), }; final List expectedXpathQueries = Arrays.asList( - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='InputRecordTypeParameterName']]" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT" + + "[@text='InputXpathRecordTypeParameterNameTypeDefault']]" + "/TYPE_PARAMETERS/TYPE_PARAMETER[./IDENT[@text='t']]", - "/COMPILATION_UNIT/RECORD_DEF[./IDENT[@text='InputRecordTypeParameterName']]" + "/COMPILATION_UNIT/RECORD_DEF[./IDENT" + + "[@text='InputXpathRecordTypeParameterNameTypeDefault']]" + "/TYPE_PARAMETERS/TYPE_PARAMETER/IDENT[@text='t']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRedundantImportTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRedundantImportTest.java index 811a33c17af..92660e2b8ad 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRedundantImportTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRedundantImportTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,15 +38,15 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testInternal() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRedundantImport1.java")); + new File(getPath("InputXpathRedundantImportInternal.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RedundantImportCheck.class); final String[] expectedViolation = { "3:1: " + getCheckMessage(RedundantImportCheck.class, RedundantImportCheck.MSG_SAME, "org.checkstyle.suppressionxpathfilter" - + ".redundantimport.SuppressionXpathRegressionRedundantImport1"), + + ".redundantimport.InputXpathRedundantImportInternal"), }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/IMPORT"); @@ -56,9 +56,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testLibrary() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRedundantImport2.java")); + new File(getPath("InputXpathRedundantImportLibrary.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RedundantImportCheck.class); final String[] expectedViolation = { @@ -73,9 +73,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testDuplicate() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRedundantImport3.java")); + new File(getPath("InputXpathRedundantImportDuplicate.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RedundantImportCheck.class); final String[] expectedViolation = { diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRequireThisTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRequireThisTest.java index adae07eb709..44ddf2e7158 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRequireThisTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRequireThisTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRequireThisOne.java")); + new File(getPath("InputXpathRequireThisOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RequireThisCheck.class); @@ -53,7 +53,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionRequireThisOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRequireThisOne']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='changeAge']]/SLIST/EXPR/ASSIGN" + "/IDENT[@text='age']" ); @@ -65,7 +65,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRequireThisTwo.java")); + new File(getPath("InputXpathRequireThisTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RequireThisCheck.class); @@ -78,7 +78,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionRequireThisTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRequireThisTwo']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='method2']]/SLIST/EXPR" + "/METHOD_CALL/IDENT[@text='method1']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionReturnCountTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionReturnCountTest.java index 5e2fae8cd76..ebaa7c8bbab 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionReturnCountTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionReturnCountTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -36,9 +36,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testVoid() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionReturnCount1.java") + getPath("InputXpathReturnCountVoid.java") ); final DefaultConfiguration moduleConfig = @@ -51,16 +51,16 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE/LITERAL_VOID" ); @@ -68,9 +68,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testCustomMaxForVoid() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionReturnCount1.java") + getPath("InputXpathReturnCountVoid.java") ); final DefaultConfiguration moduleConfig = @@ -85,16 +85,16 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount1']]" + + "[./IDENT[@text='InputXpathReturnCountVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testVoid']]/TYPE/LITERAL_VOID" ); @@ -102,9 +102,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testNonVoid() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionReturnCount2.java") + getPath("InputXpathReturnCountNonVoid.java") ); final DefaultConfiguration moduleConfig = @@ -117,16 +117,16 @@ public void testThree() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE/LITERAL_BOOLEAN" ); @@ -134,9 +134,9 @@ public void testThree() throws Exception { } @Test - public void testFour() throws Exception { + public void testCustomMax() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionReturnCount2.java") + getPath("InputXpathReturnCountNonVoid.java") ); final DefaultConfiguration moduleConfig = @@ -151,16 +151,16 @@ public void testFour() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount2']]" + + "[./IDENT[@text='InputXpathReturnCountNonVoid']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testNonVoid']]/TYPE/LITERAL_BOOLEAN" ); @@ -168,9 +168,9 @@ public void testFour() throws Exception { } @Test - public void testFive() throws Exception { + public void testCtor() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionReturnCount3.java") + getPath("InputXpathReturnCountCtor.java") ); final DefaultConfiguration moduleConfig = @@ -183,24 +183,24 @@ public void testFive() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]" - + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]", + + "[./IDENT[@text='InputXpathReturnCountCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathReturnCountCtor']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]" - + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]" + + "[./IDENT[@text='InputXpathReturnCountCtor']]" + + "/OBJBLOCK/CTOR_DEF[./IDENT[@text='InputXpathReturnCountCtor']]" + "/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount3']]" - + "/OBJBLOCK/CTOR_DEF/IDENT[@text='SuppressionXpathRegressionReturnCount3']" + + "[./IDENT[@text='InputXpathReturnCountCtor']]" + + "/OBJBLOCK/CTOR_DEF/IDENT[@text='InputXpathReturnCountCtor']" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); } @Test - public void testSix() throws Exception { + public void testLambda() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionReturnCount4.java") + getPath("InputXpathReturnCountLambda.java") ); final DefaultConfiguration moduleConfig = @@ -213,7 +213,7 @@ public void testSix() throws Exception { final List expectedXpathQueries = List.of( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionReturnCount4']]" + + "[./IDENT[@text='InputXpathReturnCountLambda']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testLambda']]/SLIST" + "/VARIABLE_DEF[./IDENT[@text='a']]/ASSIGN/LAMBDA[./IDENT[@text='i']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRightCurlyTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRightCurlyTest.java index f379b3910f4..015aad489e0 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRightCurlyTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionRightCurlyTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,7 +41,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRightCurlyOne.java")); + new File(getPath("InputXpathRightCurlyOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RightCurlyCheck.class); @@ -53,7 +53,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionRightCurlyOne']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRightCurlyOne']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/SLIST/RCURLY" ); @@ -64,7 +64,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRightCurlyTwo.java")); + new File(getPath("InputXpathRightCurlyTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RightCurlyCheck.class); @@ -77,7 +77,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionRightCurlyTwo']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRightCurlyTwo']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='fooMethod']]/SLIST/LITERAL_TRY/SLIST/RCURLY" ); @@ -88,7 +88,7 @@ public void testTwo() throws Exception { @Test public void testThree() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRightCurlyThree.java")); + new File(getPath("InputXpathRightCurlyThree.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RightCurlyCheck.class); @@ -101,7 +101,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionRightCurlyThree']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRightCurlyThree']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sample']]/SLIST/LITERAL_IF/SLIST/RCURLY" ); @@ -112,7 +112,7 @@ public void testThree() throws Exception { @Test public void testFour() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionRightCurlyFour.java")); + new File(getPath("InputXpathRightCurlyFour.java")); final DefaultConfiguration moduleConfig = createModuleConfig(RightCurlyCheck.class); @@ -125,7 +125,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionRightCurlyFour']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathRightCurlyFour']]/OBJBLOCK" + "/METHOD_DEF[./IDENT[@text='sample']]/SLIST/LITERAL_IF/SLIST/RCURLY" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSealedShouldHavePermitsListTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSealedShouldHavePermitsListTest.java new file mode 100644 index 00000000000..f48fc74b6b5 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSealedShouldHavePermitsListTest.java @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.design.SealedShouldHavePermitsListCheck; + +public class XpathRegressionSealedShouldHavePermitsListTest extends AbstractXpathTestSupport { + + private final String checkName = SealedShouldHavePermitsListCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testInner() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath("InputXpathSealedShouldHavePermitsListInner.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SealedShouldHavePermitsListCheck.class); + + final String[] expectedViolation = { + "5:4: " + getCheckMessage(SealedShouldHavePermitsListCheck.class, + SealedShouldHavePermitsListCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSealedShouldHavePermitsListInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='A']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSealedShouldHavePermitsListInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='A']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSealedShouldHavePermitsListInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='A']]/MODIFIERS/LITERAL_SEALED" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testTopLevel() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathSealedShouldHavePermitsListTopLevel.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SealedShouldHavePermitsListCheck.class); + + final String[] expectedViolation = { + "4:1: " + getCheckMessage(SealedShouldHavePermitsListCheck.class, + SealedShouldHavePermitsListCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSealedShouldHavePermitsListTopLevel']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSealedShouldHavePermitsListTopLevel']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSealedShouldHavePermitsListTopLevel']]" + + "/MODIFIERS/LITERAL_PUBLIC" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanExpressionTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanExpressionTest.java new file mode 100644 index 00000000000..6c92201aedc --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanExpressionTest.java @@ -0,0 +1,114 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck.MSG_KEY; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck; + +public class XpathRegressionSimplifyBooleanExpressionTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return SimplifyBooleanExpressionCheck.class.getSimpleName(); + } + + @Test + public void testSimple() throws Exception { + final String fileName = "InputXpathSimplifyBooleanExpressionSimple.java"; + final File fileToProcess = new File(getPath(fileName)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SimplifyBooleanExpressionCheck.class); + + final String[] expectedViolations = { + "8:13: " + getCheckMessage(SimplifyBooleanExpressionCheck.class, MSG_KEY), + }; + + final List expectedXpathQuery = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSimplifyBooleanExpressionSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/EXPR", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSimplifyBooleanExpressionSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_IF/EXPR/LNOT" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQuery); + } + + @Test + public void testAnonymous() throws Exception { + final String fileName = + "InputXpathSimplifyBooleanExpressionAnonymous.java"; + final File fileToProcess = new File(getPath(fileName)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SimplifyBooleanExpressionCheck.class); + + final String[] expectedViolations = { + "8:19: " + getCheckMessage(SimplifyBooleanExpressionCheck.class, MSG_KEY), + }; + + final List expectedXpathQuery = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSimplifyBooleanExpressionAnonymous']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='test']]/SLIST/LITERAL_IF/EXPR", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSimplifyBooleanExpressionAnonymous']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Inner']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='test']]/SLIST/LITERAL_IF/EXPR/EQUAL[./IDENT[@text='a']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQuery); + } + + @Test + public void testInterface() throws Exception { + final String fileName = + "InputXpathSimplifyBooleanExpressionInterface.java"; + final File fileToProcess = new File(getPath(fileName)); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SimplifyBooleanExpressionCheck.class); + + final String[] expectedViolations = { + "7:20: " + getCheckMessage(SimplifyBooleanExpressionCheck.class, MSG_KEY), + }; + + final List expectedXpathQuery = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathSimplifyBooleanExpressionInterface']]" + + "/OBJBLOCK/INTERFACE_DEF[./IDENT[@text='Inner']]/OBJBLOCK/METHOD_DEF[./IDENT" + + "[@text='test']]/SLIST/LITERAL_IF/EXPR/LNOT/NOT_EQUAL[./IDENT[@text='b']]" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolations, expectedXpathQuery); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanReturnTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanReturnTest.java index 809805372a7..ded114ed26f 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanReturnTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSimplifyBooleanReturnTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -44,7 +44,7 @@ protected String getCheckName() { public void testIfBooleanEqualsBoolean() throws Exception { final File fileToProcess = new File( getPath( - "SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanEqualsBoolean.java")); + "InputXpathSimplifyBooleanReturnIfBooleanEqualsBoolean.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -54,7 +54,7 @@ public void testIfBooleanEqualsBoolean() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanEqualsBoolean']]" + + "'InputXpathSimplifyBooleanReturnIfBooleanEqualsBoolean']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='toTest']]/SLIST/LITERAL_IF" ); @@ -66,7 +66,7 @@ public void testIfBooleanEqualsBoolean() throws Exception { public void testIfBooleanReturnBoolean() throws Exception { final File fileToProcess = new File( getPath( - "SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanReturnBoolean.java" + "InputXpathSimplifyBooleanReturnIfBooleanReturnBoolean.java" )); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); @@ -77,7 +77,7 @@ public void testIfBooleanReturnBoolean() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanReturnBoolean']]" + + "'InputXpathSimplifyBooleanReturnIfBooleanReturnBoolean']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='toTest']]/SLIST/EXPR/METHOD_CALL/ELIST" + "/LAMBDA[./IDENT[@text='statement']]/SLIST/LITERAL_IF" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSingleSpaceSeparatorTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSingleSpaceSeparatorTest.java index 145646de771..e5ce112504f 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSingleSpaceSeparatorTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSingleSpaceSeparatorTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testSingleSpaceSeparator() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionSingleSpaceSeparator.java")); + new File(getPath("InputXpathSingleSpaceSeparator.java")); final DefaultConfiguration moduleConfig = createModuleConfig(SingleSpaceSeparatorCheck.class); @@ -52,7 +52,7 @@ public void testSingleSpaceSeparator() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionSingleSpaceSeparator']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathSingleSpaceSeparator']]/OBJBLOCK" + "/VARIABLE_DEF/IDENT[@text='bad']" ); @@ -63,7 +63,7 @@ public void testSingleSpaceSeparator() throws Exception { @Test public void testValidateComments() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionSingleSpaceSeparatorValidateComments.java" + "InputXpathSingleSpaceSeparatorValidateComments.java" )); final DefaultConfiguration moduleConfig = @@ -77,7 +77,7 @@ public void testValidateComments() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[." - + "/IDENT[@text='SuppressionXpathRegressionSingleSpaceSeparatorValidateComments']]" + + "/IDENT[@text='InputXpathSingleSpaceSeparatorValidateComments']]" + "/OBJBLOCK/SINGLE_LINE_COMMENT[./COMMENT_CONTENT" + "[@text=' an invalid comment // warn\\n']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStaticVariableNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStaticVariableNameTest.java new file mode 100644 index 00000000000..f52d8c7dbf3 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStaticVariableNameTest.java @@ -0,0 +1,117 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck; +import com.puppycrawl.tools.checkstyle.checks.naming.StaticVariableNameCheck; + +public class XpathRegressionStaticVariableNameTest extends AbstractXpathTestSupport { + + private final String checkName = StaticVariableNameCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testStaticVariableName() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathStaticVariableName.java")); + + final String pattern = "^[a-z][a-zA-Z0-9]*$"; + final DefaultConfiguration moduleConfig = + createModuleConfig(StaticVariableNameCheck.class); + + final String[] expectedViolation = { + "6:24: " + getCheckMessage(StaticVariableNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "NUM2", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text" + + "='InputXpathStaticVariableName']]" + + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='NUM2']" + + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testInnerClassField() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathStaticVariableNameInnerClassField.java")); + + final String pattern = "^[a-z][a-zA-Z0-9]*$"; + final DefaultConfiguration moduleConfig = + createModuleConfig(StaticVariableNameCheck.class); + + final String[] expectedViolation = { + "14:24: " + getCheckMessage(StaticVariableNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "NUM3", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text" + + "='InputXpathStaticVariableNameInnerClassField']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='outerMethod']]" + + "/SLIST/CLASS_DEF[./IDENT[@text='MyLocalClass']]" + + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='NUM3']" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testNoAccessModifier() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathStaticVariableNameNoAccessModifier.java")); + + final String pattern = "^[a-z][a-zA-Z0-9]*$"; + final DefaultConfiguration moduleConfig = + createModuleConfig(StaticVariableNameCheck.class); + + final String[] expectedViolation = { + "6:19: " + getCheckMessage(StaticVariableNameCheck.class, + AbstractNameCheck.MSG_INVALID_PATTERN, "NUM3", pattern), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT" + + "/CLASS_DEF[./IDENT[@text" + + "='InputXpathStaticVariableNameNoAccessModifier']]" + + "/OBJBLOCK/INSTANCE_INIT/SLIST/VARIABLE_DEF/IDENT[@text='NUM3']" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStringLiteralEqualityTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStringLiteralEqualityTest.java index 289dd0c0572..9a742742bf8 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStringLiteralEqualityTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionStringLiteralEqualityTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testEqualityTrue() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionStringLiteralEquality.java")); + new File(getPath("InputXpathStringLiteralEqualityTrue.java")); final DefaultConfiguration moduleConfig = createModuleConfig(StringLiteralEqualityCheck.class); final String[] expectedViolation = { @@ -50,11 +50,11 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionStringLiteralEquality']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathStringLiteralEqualityTrue']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/SLIST/LITERAL_IF/EXPR", "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionStringLiteralEquality']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathStringLiteralEqualityTrue']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/SLIST/LITERAL_IF/EXPR/EQUAL[./IDENT[@text='foo']]" @@ -65,9 +65,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testEqualityFalse() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionStringLiteralEquality1.java")); + new File(getPath("InputXpathStringLiteralEqualityFalse.java")); final DefaultConfiguration moduleConfig = createModuleConfig(StringLiteralEqualityCheck.class); final String[] expectedViolation = { @@ -76,11 +76,11 @@ public void testTwo() throws Exception { }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionStringLiteralEquality1']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathStringLiteralEqualityFalse']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/SLIST/LITERAL_WHILE/EXPR", "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionStringLiteralEquality1']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathStringLiteralEqualityFalse']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/SLIST/LITERAL_WHILE/EXPR/NOT_EQUAL[./IDENT[@text='foo']]" @@ -91,9 +91,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testEqualityExp() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionStringLiteralEquality2.java")); + new File(getPath("InputXpathStringLiteralEqualityExp.java")); final DefaultConfiguration moduleConfig = createModuleConfig(StringLiteralEqualityCheck.class); final String[] expectedViolation = { @@ -102,7 +102,7 @@ public void testThree() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionStringLiteralEquality2']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathStringLiteralEqualityExp']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='flag']]" + "/ASSIGN/EXPR/EQUAL[./IDENT[@text='foo']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSuperCloneTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSuperCloneTest.java new file mode 100644 index 00000000000..0e06c358ebf --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionSuperCloneTest.java @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.AbstractSuperCheck; +import com.puppycrawl.tools.checkstyle.checks.coding.SuperCloneCheck; + +public class XpathRegressionSuperCloneTest extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return SuperCloneCheck.class.getSimpleName(); + } + + @Test + public void testInnerClone() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathSuperCloneInnerClone.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SuperCloneCheck.class); + + final String[] expectedViolation = { + "6:23: " + getCheckMessage(SuperCloneCheck.class, AbstractSuperCheck.MSG_KEY, "clone"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathSuperCloneInnerClone']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClone']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='clone']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testNoSuperClone() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathSuperCloneNoSuperClone.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SuperCloneCheck.class); + + final String[] expectedViolation = { + "6:23: " + getCheckMessage(SuperCloneCheck.class, AbstractSuperCheck.MSG_KEY, "clone"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathSuperCloneNoSuperClone']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='NoSuperClone']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='clone']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testPlainAndSubclasses() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathSuperClonePlainAndSubclasses.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(SuperCloneCheck.class); + + final String[] expectedViolation = { + "4:19: " + getCheckMessage(SuperCloneCheck.class, AbstractSuperCheck.MSG_KEY, "clone"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathSuperClonePlainAndSubclasses']]" + + "/OBJBLOCK/METHOD_DEF/IDENT[@text='clone']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java index f9f2c28c20b..7a107eef2d0 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionThrowsCountTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionThrowsCount1.java")); + new File(getPath("InputXpathThrowsCountDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ThrowsCountCheck.class); final String[] expectedViolation = { @@ -49,7 +49,7 @@ public void testOne() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionThrowsCount1']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathThrowsCountDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/LITERAL_THROWS[./IDENT[@text='CloneNotSupportedException']]" @@ -60,9 +60,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testCustomMax() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionThrowsCount2.java")); + new File(getPath("InputXpathThrowsCountCustomMax.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ThrowsCountCheck.class); @@ -74,7 +74,7 @@ public void testTwo() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/INTERFACE_DEF[./IDENT[@text='SuppressionXpathRegressionThrowsCount2']]" + + "/INTERFACE_DEF[./IDENT[@text='InputXpathThrowsCountCustomMax']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunction']]" + "/LITERAL_THROWS[./IDENT[@text='IllegalStateException']]" @@ -85,9 +85,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testPrivateMethods() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionThrowsCount3.java")); + new File(getPath("InputXpathThrowsCountPrivateMethods.java")); final DefaultConfiguration moduleConfig = createModuleConfig(ThrowsCountCheck.class); @@ -99,7 +99,7 @@ public void testThree() throws Exception { }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" - + "/CLASS_DEF[./IDENT[@text='SuppressionXpathRegressionThrowsCount3']]" + + "/CLASS_DEF[./IDENT[@text='InputXpathThrowsCountPrivateMethods']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='myFunc']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='foo']]" + "/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='myClass']]" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTodoCommentTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTodoCommentTest.java index 98e99995656..00d612b4c1a 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTodoCommentTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTodoCommentTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testSingleLine() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTodoCommentOne.java")); + new File(getPath("InputXpathTodoCommentSingleLine.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TodoCommentCheck.class); @@ -53,7 +53,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionTodoCommentOne']]/OBJBLOCK/" + + "'InputXpathTodoCommentSingleLine']]/OBJBLOCK/" + "SINGLE_LINE_COMMENT/COMMENT_CONTENT[@text=' warn FIXME:\\n']"); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -61,9 +61,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testBlock() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTodoCommentTwo.java")); + new File(getPath("InputXpathTodoCommentBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TodoCommentCheck.class); @@ -75,7 +75,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionTodoCommentTwo']]/" + + "'InputXpathTodoCommentBlock']]/" + "OBJBLOCK/BLOCK_COMMENT_BEGIN/COMMENT_CONTENT" + "[@text=' // warn\\n * FIXME:\\n * TODO\\n ']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTrailingCommentTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTrailingCommentTest.java index 4682a4bfe7c..cf2f64c3736 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTrailingCommentTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTrailingCommentTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,9 +37,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testSingleLine() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionTrailingComment1.java")); + "InputXpathTrailingCommentSingleLine.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TrailingCommentCheck.class); @@ -51,7 +51,7 @@ public void testOne() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTrailingComment1']]/" + + "[./IDENT[@text='InputXpathTrailingCommentSingleLine']]/" + "OBJBLOCK/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' don'" + "'t use trailing comments :) // warn\\n']]" ); @@ -61,9 +61,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testBlock() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionTrailingComment2.java")); + "InputXpathTrailingCommentBlock.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TrailingCommentCheck.class); @@ -75,7 +75,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTrailingComment2']]" + + "[./IDENT[@text='InputXpathTrailingCommentBlock']]" + "/OBJBLOCK/SINGLE_LINE_COMMENT[./COMMENT_CONTENT[@text=' warn\\n']]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypeNameTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypeNameTest.java index 8c9c9b6e976..4d32dda1cf1 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypeNameTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypeNameTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void test1() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTypeName1.java")); + new File(getPath("InputXpathTypeNameDefault.java")); final String pattern = "^[A-Z][a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -55,7 +55,7 @@ public void test1() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionTypeName1']]" + + "='InputXpathTypeNameDefault']]" + "/OBJBLOCK/CLASS_DEF/IDENT[@text='SecondName_']" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, @@ -63,9 +63,9 @@ public void test1() throws Exception { } @Test - public void test2() throws Exception { + public void testInterfaceDef() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTypeName2.java")); + new File(getPath("InputXpathTypeNameInterfaceDef.java")); final String pattern = "^I_[a-zA-Z0-9]*$"; final DefaultConfiguration moduleConfig = @@ -81,7 +81,7 @@ public void test2() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT" + "/CLASS_DEF[./IDENT[@text" - + "='SuppressionXpathRegressionTypeName2']]" + + "='InputXpathTypeNameInterfaceDef']]" + "/OBJBLOCK/INTERFACE_DEF/IDENT[@text='SecondName']" ); runVerifications(moduleConfig, fileToProcess, expectedViolation, diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypecastParenPadTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypecastParenPadTest.java index e844579d33f..2aaa3b68848 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypecastParenPadTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionTypecastParenPadTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -43,7 +43,7 @@ protected String getCheckName() { @Test public void testLeftFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTypecastParenPadLeftFollowed.java")); + new File(getPath("InputXpathTypecastParenPadLeftFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TypecastParenPadCheck.class); @@ -55,10 +55,10 @@ public void testLeftFollowed() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTypecastParenPadLeftFollowed']]" + + "[./IDENT[@text='InputXpathTypecastParenPadLeftFollowed']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTypecastParenPadLeftFollowed']]" + + "[./IDENT[@text='InputXpathTypecastParenPadLeftFollowed']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST" ); @@ -69,7 +69,7 @@ public void testLeftFollowed() throws Exception { @Test public void testLeftNotFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTypecastParenPadLeftNotFollowed.java")); + new File(getPath("InputXpathTypecastParenPadLeftNotFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TypecastParenPadCheck.class); @@ -82,10 +82,10 @@ public void testLeftNotFollowed() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTypecastParenPadLeftNotFollowed']]" + + "[./IDENT[@text='InputXpathTypecastParenPadLeftNotFollowed']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTypecastParenPadLeftNotFollowed']]" + + "[./IDENT[@text='InputXpathTypecastParenPadLeftNotFollowed']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST" ); @@ -96,7 +96,7 @@ public void testLeftNotFollowed() throws Exception { @Test public void testRightPreceded() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionTypecastParenPadRightPreceded.java")); + new File(getPath("InputXpathTypecastParenPadRightPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TypecastParenPadCheck.class); @@ -108,7 +108,7 @@ public void testRightPreceded() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionTypecastParenPadRightPreceded']]" + + "[./IDENT[@text='InputXpathTypecastParenPadRightPreceded']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST/RPAREN" ); @@ -119,7 +119,7 @@ public void testRightPreceded() throws Exception { @Test public void testRightNotPreceded() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionTypecastParenPadRightNotPreceded.java")); + getPath("InputXpathTypecastParenPadRightNotPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(TypecastParenPadCheck.class); @@ -132,7 +132,7 @@ public void testRightNotPreceded() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionTypecastParenPadRightNotPreceded']]" + + "@text='InputXpathTypecastParenPadRightNotPreceded']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST/RPAREN" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUncommentedMainTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUncommentedMainTest.java index 5cc11af187f..f85d40b8e36 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUncommentedMainTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUncommentedMainTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,9 +39,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testDefault() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUncommentedMain.java")); + new File(getPath("InputXpathUncommentedMainDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UncommentedMainCheck.class); @@ -53,13 +53,13 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUncommentedMain']]" + + "[./IDENT[@text='InputXpathUncommentedMainDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUncommentedMain']]" + + "[./IDENT[@text='InputXpathUncommentedMainDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUncommentedMain']]" + + "[./IDENT[@text='InputXpathUncommentedMainDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]/MODIFIERS/LITERAL_PUBLIC" ); @@ -68,9 +68,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testInStaticClass() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUncommentedMainTwo.java")); + new File(getPath("InputXpathUncommentedMainInStaticClass.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UncommentedMainCheck.class); @@ -82,15 +82,15 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUncommentedMainTwo']]" + + "[./IDENT[@text='InputXpathUncommentedMainInStaticClass']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Launcher']" + "]/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUncommentedMainTwo']]" + + "[./IDENT[@text='InputXpathUncommentedMainInStaticClass']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Launcher']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUncommentedMainTwo']]" + + "[./IDENT[@text='InputXpathUncommentedMainInStaticClass']]" + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='Launcher']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='main']]/MODIFIERS/LITERAL_PUBLIC" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessaryParenthesesTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessaryParenthesesTest.java index 0fcb550d8da..8b12a683d97 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessaryParenthesesTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessaryParenthesesTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,9 +37,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testClassFields() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses1.java") + getPath("InputXpathUnnecessaryParenthesesClassFields.java") ); final DefaultConfiguration moduleConfig = @@ -52,12 +52,12 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses1']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesClassFields']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]" + "/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses1']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesClassFields']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='a']]" + "/ASSIGN/EXPR/LPAREN" ); @@ -66,9 +66,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testConditionals() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses2.java") + getPath("InputXpathUnnecessaryParenthesesConditionals.java") ); final DefaultConfiguration moduleConfig = @@ -81,12 +81,12 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses2']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesConditionals']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/LITERAL_IF/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses2']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesConditionals']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/LITERAL_IF/EXPR/LPAREN" ); @@ -95,9 +95,9 @@ public void testTwo() throws Exception { } @Test - public void testThree() throws Exception { + public void testLambdas() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses3.java") + getPath("InputXpathUnnecessaryParenthesesLambdas.java") ); final DefaultConfiguration moduleConfig = @@ -110,7 +110,7 @@ public void testThree() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses3']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesLambdas']]" + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='predicate']]" + "/ASSIGN/LAMBDA" ); @@ -119,9 +119,9 @@ public void testThree() throws Exception { } @Test - public void testFour() throws Exception { + public void testLocalVariables() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses4.java") + getPath("InputXpathUnnecessaryParenthesesLocalVariables.java") ); final DefaultConfiguration moduleConfig = @@ -134,7 +134,7 @@ public void testFour() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses4']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesLocalVariables']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='b']]" + "/ASSIGN/EXPR/PLUS/IDENT[@text='a']" @@ -144,9 +144,9 @@ public void testFour() throws Exception { } @Test - public void testFive() throws Exception { + public void testStringLiteral() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses5.java") + getPath("InputXpathUnnecessaryParenthesesStringLiteral.java") ); final DefaultConfiguration moduleConfig = @@ -159,7 +159,7 @@ public void testFive() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses5']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesStringLiteral']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='str']]" + "/ASSIGN/EXPR/PLUS/STRING_LITERAL[@text='Checkstyle']" @@ -169,9 +169,9 @@ public void testFive() throws Exception { } @Test - public void testSix() throws Exception { + public void testMethodDef() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses6.java") + getPath("InputXpathUnnecessaryParenthesesMethodDef.java") ); final DefaultConfiguration moduleConfig = @@ -184,7 +184,7 @@ public void testSix() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses6']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesMethodDef']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='a']]" + "/ASSIGN/EXPR/PLUS/NUM_INT[@text='10']" @@ -194,9 +194,9 @@ public void testSix() throws Exception { } @Test - public void testSeven() throws Exception { + public void testReturnExpr() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses7.java") + getPath("InputXpathUnnecessaryParenthesesReturnExpr.java") ); final DefaultConfiguration moduleConfig = @@ -209,12 +209,12 @@ public void testSeven() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses7']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesReturnExpr']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/LITERAL_RETURN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses7']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesReturnExpr']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/LITERAL_RETURN/EXPR/LPAREN" ); @@ -223,9 +223,9 @@ public void testSeven() throws Exception { } @Test - public void testEight() throws Exception { + public void testExprWithMethodParam() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessaryParentheses8.java") + getPath("InputXpathUnnecessaryParenthesesExprWithMethodParam.java") ); final DefaultConfiguration moduleConfig = @@ -238,13 +238,13 @@ public void testEight() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses8']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesExprWithMethodParam']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='c']]" + "/ASSIGN/EXPR", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUnnecessaryParentheses8']]" + + "[./IDENT[@text='InputXpathUnnecessaryParenthesesExprWithMethodParam']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='c']]" + "/ASSIGN/EXPR/LPAREN" diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationTest.java index 938eec46e88..43e2eb212fe 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,9 +40,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testSimple() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration.java")); + "InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationSimple.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); final String[] expectedViolation = { "5:2: " + getCheckMessage(CLASS, @@ -56,9 +56,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testInnerTypes() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes" + "InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes" + ".java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); final String[] expectedViolation = { diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java index 332c70d1212..71d5fb1a40c 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ protected String getCheckName() { @Test public void testDefault() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration.java")); + "InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); final String[] expectedViolation = { "4:20: " + getCheckMessage(CLASS, @@ -52,7 +52,7 @@ public void testDefault() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + "[@text=" - + "'SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration']]" + + "'InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault']]" + "/OBJBLOCK/SEMI" ); @@ -62,7 +62,7 @@ public void testDefault() throws Exception { @Test public void testTokens() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens" + "InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens" + ".java")); final DefaultConfiguration moduleConfig = createModuleConfig(CLASS); moduleConfig.addProperty("tokens", "METHOD_DEF"); @@ -74,7 +74,7 @@ public void testTokens() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[." - + "/IDENT[@text='SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMember" + + "/IDENT[@text='InputXpathUnnecessarySemicolonAfterTypeMember" + "DeclarationTokens']]" + "/OBJBLOCK/SEMI[1]" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInEnumerationTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInEnumerationTest.java index ccffd3a8821..022428d1f52 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInEnumerationTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInEnumerationTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,9 +40,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testSimple() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessarySemicolonInEnumeration.java")); + getPath("InputXpathUnnecessarySemicolonInEnumerationSimple.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UnnecessarySemicolonInEnumerationCheck.class); @@ -60,9 +60,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testAll() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll.java" + "InputXpathUnnecessarySemicolonInEnumerationAll.java" )); final DefaultConfiguration moduleConfig = @@ -75,7 +75,7 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/ENUM_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll']]" + + "'InputXpathUnnecessarySemicolonInEnumerationAll']]" + "/OBJBLOCK/SEMI" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java index 08f2d01f1d1..68d0f716ccf 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnnecessarySemicolonInTryWithResourcesTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,18 +42,16 @@ protected String getCheckName() { @Test public void testDefault() throws Exception { final File fileToProcess = new File( - getPath("SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources.java")); + getPath("InputXpathUnnecessarySemicolonInTryWithResourcesDefault.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UnnecessarySemicolonInTryWithResourcesCheck.class); final String[] expectedViolation = { - "11:43: " + getCheckMessage(UnnecessarySemicolonInTryWithResourcesCheck.class, - UnnecessarySemicolonInTryWithResourcesCheck.MSG_SEMI), - "12:76: " + getCheckMessage(UnnecessarySemicolonInTryWithResourcesCheck.class, + "11:76: " + getCheckMessage(UnnecessarySemicolonInTryWithResourcesCheck.class, UnnecessarySemicolonInTryWithResourcesCheck.MSG_SEMI), }; final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources']]" + + "'InputXpathUnnecessarySemicolonInTryWithResourcesDefault']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='m']]/SLIST/LITERAL_TRY" + "/RESOURCE_SPECIFICATION/SEMI" ); @@ -61,9 +59,9 @@ public void testDefault() throws Exception { } @Test - public void testAllowWhenNoBraceAfterSemicolon() throws Exception { + public void testNoBrace() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace.java" + "InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace.java" )); final DefaultConfiguration moduleConfig = @@ -77,7 +75,7 @@ public void testAllowWhenNoBraceAfterSemicolon() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace']]" + + "'InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/LITERAL_TRY/RESOURCE_SPECIFICATION/SEMI" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedCatchParameterShouldBeUnnamedTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedCatchParameterShouldBeUnnamedTest.java new file mode 100644 index 00000000000..118b3e7c0dd --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedCatchParameterShouldBeUnnamedTest.java @@ -0,0 +1,122 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.UnusedCatchParameterShouldBeUnnamedCheck; + +public class XpathRegressionUnusedCatchParameterShouldBeUnnamedTest + extends AbstractXpathTestSupport { + + private final String checkName = UnusedCatchParameterShouldBeUnnamedCheck.class + .getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testSimple() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathUnusedCatchParameterShouldBeUnnamedSimple.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(UnusedCatchParameterShouldBeUnnamedCheck.class); + + final String[] expectedViolation = { + "10:16: " + getCheckMessage(UnusedCatchParameterShouldBeUnnamedCheck.class, + UnusedCatchParameterShouldBeUnnamedCheck.MSG_UNUSED_CATCH_PARAMETER, + "e"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathUnusedCatchParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY/" + + "LITERAL_CATCH/PARAMETER_DEF[./IDENT[@text='e']]", + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedCatchParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + + "LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF[./IDENT[@text='e']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedCatchParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY/" + + "LITERAL_CATCH/PARAMETER_DEF[./IDENT[@text='e']]" + + "/TYPE[./IDENT[@text='Exception']]", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathUnusedCatchParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY" + + "/LITERAL_CATCH/PARAMETER_DEF[./IDENT[@text='e']]" + + "/TYPE/IDENT[@text='Exception']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testNested() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathUnusedCatchParameterShouldBeUnnamedNested.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(UnusedCatchParameterShouldBeUnnamedCheck.class); + + final String[] expectedViolation = { + "14:20: " + getCheckMessage(UnusedCatchParameterShouldBeUnnamedCheck.class, + UnusedCatchParameterShouldBeUnnamedCheck.MSG_UNUSED_CATCH_PARAMETER, + "exception"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedCatchParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY/" + + "LITERAL_CATCH/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF" + + "[./IDENT[@text='exception']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathUnusedCatchParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY" + + "/LITERAL_CATCH/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF[" + + "./IDENT[@text='exception']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathUnusedCatchParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY/" + + "LITERAL_CATCH/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF" + + "[./IDENT[@text='exception']]/TYPE[./IDENT[@text='Exception']]", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathUnusedCatchParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_TRY" + + "/LITERAL_CATCH/SLIST/LITERAL_TRY/LITERAL_CATCH/PARAMETER_DEF" + + "[./IDENT[@text='exception']]/TYPE/IDENT[@text='Exception']" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java index b63d65adbb5..4e0ecc79226 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedImportsTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,9 +38,9 @@ protected String getCheckName() { } @Test - public void testOne() throws Exception { + public void testUnusedImports() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUnusedImportsOne.java")); + new File(getPath("InputXpathUnusedImports.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UnusedImportsCheck.class); @@ -58,9 +58,9 @@ public void testOne() throws Exception { } @Test - public void testTwo() throws Exception { + public void testStatic() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUnusedImportsTwo.java")); + new File(getPath("InputXpathUnusedImportsStatic.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UnusedImportsCheck.class); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLambdaParameterShouldBeUnnamedTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLambdaParameterShouldBeUnnamedTest.java new file mode 100644 index 00000000000..f0a9ec0414b --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLambdaParameterShouldBeUnnamedTest.java @@ -0,0 +1,131 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.UnusedLambdaParameterShouldBeUnnamedCheck; + +public class XpathRegressionUnusedLambdaParameterShouldBeUnnamedTest + extends AbstractXpathTestSupport { + + private final String checkName = UnusedLambdaParameterShouldBeUnnamedCheck.class + .getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testSimple() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathUnusedLambdaParameterShouldBeUnnamedSimple.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(UnusedLambdaParameterShouldBeUnnamedCheck.class); + + final String[] expectedViolation = { + "9:41: " + getCheckMessage(UnusedLambdaParameterShouldBeUnnamedCheck.class, + UnusedLambdaParameterShouldBeUnnamedCheck.MSG_UNUSED_LAMBDA_PARAMETER, + "x"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[" + + "@text='f']]/ASSIGN/LAMBDA/PARAMETERS", + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[" + + "./IDENT[@text='f']]/ASSIGN/LAMBDA/PARAMETERS/PARAMETER_DEF[./IDENT[@text='x']]", + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f']]/ASSIGN/LAMBDA/PARAMETERS" + + "/PARAMETER_DEF[./IDENT[@text='x']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f']]/ASSIGN/LAMBDA/PARAMETERS/" + + "PARAMETER_DEF[./IDENT[@text='x']]/TYPE", + "/COMPILATION_UNIT/CLASS_DEF[" + + "./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f']]/ASSIGN/LAMBDA/PARAMETERS/PARAMETER_DEF/IDENT[@text='x']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } + + @Test + public void testNested() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathUnusedLambdaParameterShouldBeUnnamedNested.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(UnusedLambdaParameterShouldBeUnnamedCheck.class); + + final String[] expectedViolation = { + "10:45: " + getCheckMessage(UnusedLambdaParameterShouldBeUnnamedCheck.class, + UnusedLambdaParameterShouldBeUnnamedCheck.MSG_UNUSED_LAMBDA_PARAMETER, + "y"), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f1']]/ASSIGN/LAMBDA/SLIST/VARIABLE_DEF[./IDENT[@text='f']]" + + "/ASSIGN/LAMBDA/PARAMETERS", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f1']]/ASSIGN/LAMBDA/SLIST/VARIABLE_DEF[./IDENT[@text='f']]" + + "/ASSIGN/LAMBDA/PARAMETERS/PARAMETER_DEF[./IDENT[@text='y']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT" + + "[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f1']]/ASSIGN/LAMBDA/SLIST/VARIABLE_DEF[./IDENT[@text='f']]" + + "/ASSIGN/LAMBDA/PARAMETERS/PARAMETER_DEF[./IDENT[@text='y']]/MODIFIERS", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT" + + "[@text='f1']]/ASSIGN/LAMBDA/SLIST/VARIABLE_DEF[./IDENT[@text='f']]/ASSIGN" + + "/LAMBDA/PARAMETERS/PARAMETER_DEF[./IDENT[@text='y']]/TYPE", + "/COMPILATION_UNIT/CLASS_DEF" + + "[./IDENT[@text='InputXpathUnusedLambdaParameterShouldBeUnnamedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[" + + "./IDENT[@text='f1']]/ASSIGN/LAMBDA/SLIST/VARIABLE_DEF[" + + "./IDENT[@text='f']]/ASSIGN/LAMBDA/PARAMETERS/PARAMETER_DEF/IDENT[@text='y']" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, + expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java index 50b22a9416b..ad88391bd45 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUnusedLocalVariableTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,30 +39,30 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnusedLocalVariableOne.java")); + "InputXpathUnusedLocalVariableOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UnusedLocalVariableCheck.class); final String[] expectedViolation = { "6:9: " + getCheckMessage(UnusedLocalVariableCheck.class, - UnusedLocalVariableCheck.MSG_UNUSED_LOCAL_VARIABLE, "a"), + UnusedLocalVariableCheck.MSG_UNUSED_NAMED_LOCAL_VARIABLE, "a"), }; final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[./IDENT[@text='a']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='a']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='a']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableOne']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableOne']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='a']]/TYPE/LITERAL_INT" ); @@ -74,10 +74,11 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionUnusedLocalVariableTwo.java")); + "InputXpathUnusedLocalVariableTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UnusedLocalVariableCheck.class); + moduleConfig.addProperty("allowUnnamedVariables", "false"); final String[] expectedViolation = { "10:9: " + getCheckMessage(UnusedLocalVariableCheck.class, @@ -86,17 +87,17 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableTwo']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[./IDENT[@text='b']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableTwo']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='b']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/OBJBLOCK/" + + "@text='InputXpathUnusedLocalVariableTwo']]/OBJBLOCK/" + "METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='b']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[" - + "./IDENT[@text='SuppressionXpathRegressionUnusedLocalVariableTwo']]/" + + "./IDENT[@text='InputXpathUnusedLocalVariableTwo']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='foo']]/SLIST/VARIABLE_DEF[" + "./IDENT[@text='b']]/TYPE/LITERAL_INT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java index 361a7834219..c5d640d38df 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionUpperEllTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testUpperEllOne() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUpperEllFirst.java")); + new File(getPath("InputXpathUpperEllOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UpperEllCheck.class); @@ -52,10 +52,10 @@ public void testUpperEllOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUpperEllFirst']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathUpperEllOne']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR[./NUM_LONG[@text='0l']]", "/COMPILATION_UNIT/CLASS_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUpperEllFirst']]/OBJBLOCK" + + "[./IDENT[@text='InputXpathUpperEllOne']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR" + "/NUM_LONG[@text='0l']" ); @@ -67,7 +67,7 @@ public void testUpperEllOne() throws Exception { @Test public void testUpperEllTwo() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionUpperEllSecond.java")); + new File(getPath("InputXpathUpperEllTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(UpperEllCheck.class); @@ -79,11 +79,11 @@ public void testUpperEllTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUpperEllSecond']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='InputXpathUpperEllTwo']]/OBJBLOCK/METHOD_DEF" + "[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[@text='var2']]/ASSIGN/EXPR" + "[./NUM_LONG[@text='508987l']]", "/COMPILATION_UNIT/INTERFACE_DEF" - + "[./IDENT[@text='SuppressionXpathRegressionUpperEllSecond']]/OBJBLOCK/METHOD_DEF" + + "[./IDENT[@text='InputXpathUpperEllTwo']]/OBJBLOCK/METHOD_DEF" + "[./IDENT[@text='test']]/SLIST/VARIABLE_DEF[./IDENT[@text='var2']]/ASSIGN/EXPR" + "/NUM_LONG[@text='508987l']" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java index dca8b14968c..07d70a1879b 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVariableDeclarationUsageDistanceTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,7 +39,7 @@ protected String getCheckName() { @Test public void testOne() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionVariableDeclarationUsageDistance1.java")); + "InputXpathVariableDeclarationUsageDistanceOne.java")); final DefaultConfiguration moduleConfig = createModuleConfig(VariableDeclarationUsageDistanceCheck.class); @@ -55,19 +55,19 @@ public void testOne() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/" + + "'InputXpathVariableDeclarationUsageDistanceOne']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/" + + "'InputXpathVariableDeclarationUsageDistanceOne']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/" + + "'InputXpathVariableDeclarationUsageDistanceOne']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance1']]/" + + "'InputXpathVariableDeclarationUsageDistanceOne']]/" + "OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='temp']]/TYPE/LITERAL_INT" ); @@ -79,7 +79,7 @@ public void testOne() throws Exception { @Test public void testTwo() throws Exception { final File fileToProcess = new File(getPath( - "SuppressionXpathRegressionVariableDeclarationUsageDistance2.java")); + "InputXpathVariableDeclarationUsageDistanceTwo.java")); final DefaultConfiguration moduleConfig = createModuleConfig(VariableDeclarationUsageDistanceCheck.class); @@ -96,19 +96,19 @@ public void testTwo() throws Exception { final List expectedXpathQueries = Arrays.asList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]" + + "'InputXpathVariableDeclarationUsageDistanceTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]" + + "'InputXpathVariableDeclarationUsageDistanceTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]/MODIFIERS", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]" + + "'InputXpathVariableDeclarationUsageDistanceTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]/TYPE", "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text=" - + "'SuppressionXpathRegressionVariableDeclarationUsageDistance2']]" + + "'InputXpathVariableDeclarationUsageDistanceTwo']]" + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='testMethod2']]" + "/SLIST/VARIABLE_DEF[./IDENT[@text='count']]/TYPE/LITERAL_INT" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVisibilityModifierTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVisibilityModifierTest.java new file mode 100644 index 00000000000..181e5ff8b48 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionVisibilityModifierTest.java @@ -0,0 +1,130 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import static com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck.MSG_KEY; + +import java.io.File; +import java.util.Collections; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck; + +public class XpathRegressionVisibilityModifierTest extends AbstractXpathTestSupport { + + private final String checkName = VisibilityModifierCheck.class.getSimpleName(); + + @Override + protected String getCheckName() { + return checkName; + } + + @Test + public void testDefaultModifier() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathVisibilityModifierDefault.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(VisibilityModifierCheck.class); + + final String[] expectedViolation = { + "6:9: " + getCheckMessage(VisibilityModifierCheck.class, MSG_KEY, "field"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathVisibilityModifierDefault']]" + + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='field']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testAnnotation() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathVisibilityModifierAnnotation.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(VisibilityModifierCheck.class); + moduleConfig.addProperty("ignoreAnnotationCanonicalNames", "Deprecated"); + + final String[] expectedViolation = { + "5:12: " + getCheckMessage(VisibilityModifierCheck.class, MSG_KEY, + "annotatedString"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathVisibilityModifierAnnotation']]" + + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='annotatedString']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testAnonymousClass() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathVisibilityModifierAnonymous.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(VisibilityModifierCheck.class); + + final String[] expectedViolation = { + "6:23: " + getCheckMessage(VisibilityModifierCheck.class, MSG_KEY, "field1"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathVisibilityModifierAnonymous']]" + + "/OBJBLOCK/VARIABLE_DEF[./IDENT[@text='runnable']]" + + "/ASSIGN/EXPR/LITERAL_NEW[./IDENT[@text='Runnable']]" + + "/OBJBLOCK/VARIABLE_DEF/IDENT[@text='field1']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testInnerClass() throws Exception { + final File fileToProcess = + new File(getPath("InputXpathVisibilityModifierInner.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(VisibilityModifierCheck.class); + + final String[] expectedViolation = { + "7:20: " + getCheckMessage(VisibilityModifierCheck.class, MSG_KEY, "field2"), + }; + + final List expectedXpathQueries = Collections.singletonList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" + + "@text='InputXpathVisibilityModifierInner']]" + + "/OBJBLOCK/CLASS_DEF[./IDENT[@text='InnerClass']]/OBJBLOCK/" + + "VARIABLE_DEF/IDENT[@text='field2']" + ); + + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhenShouldBeUsedTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhenShouldBeUsedTest.java new file mode 100644 index 00000000000..76e45b9e391 --- /dev/null +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhenShouldBeUsedTest.java @@ -0,0 +1,91 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.coding.WhenShouldBeUsedCheck; + +public class XpathRegressionWhenShouldBeUsedTest + extends AbstractXpathTestSupport { + + @Override + protected String getCheckName() { + return WhenShouldBeUsedCheck.class.getSimpleName(); + } + + @Test + public void testSimple() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathWhenShouldBeUsedSimple.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(WhenShouldBeUsedCheck.class); + final String[] expectedViolation = { + "7:13: " + getCheckMessage(WhenShouldBeUsedCheck.class, + WhenShouldBeUsedCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathWhenShouldBeUsedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/LITERAL_SWITCH/SWITCH_RULE" + + "[./LITERAL_CASE/PATTERN_VARIABLE_DEF/IDENT[@text='s']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathWhenShouldBeUsedSimple']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + + "LITERAL_SWITCH/SWITCH_RULE/LITERAL_CASE" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } + + @Test + public void testNested() throws Exception { + final File fileToProcess = + new File(getNonCompilablePath( + "InputXpathWhenShouldBeUsedNested.java")); + + final DefaultConfiguration moduleConfig = + createModuleConfig(WhenShouldBeUsedCheck.class); + final String[] expectedViolation = { + "10:21: " + getCheckMessage(WhenShouldBeUsedCheck.class, + WhenShouldBeUsedCheck.MSG_KEY), + }; + + final List expectedXpathQueries = Arrays.asList( + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathWhenShouldBeUsedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/" + + "VARIABLE_DEF[./IDENT[@text='x']]/ASSIGN/EXPR/LITERAL_SWITCH" + + "/SWITCH_RULE/SLIST/" + + "LITERAL_SWITCH/SWITCH_RULE[./LITERAL_CASE/PATTERN_VARIABLE_DEF/" + + "IDENT[@text='_']]", + "/COMPILATION_UNIT/CLASS_DEF[./IDENT[@text='InputXpathWhenShouldBeUsedNested']]" + + "/OBJBLOCK/METHOD_DEF[./IDENT[@text='test']]/SLIST/VARIABLE_DEF" + + "[./IDENT[@text='x']]/ASSIGN/EXPR/LITERAL_SWITCH/" + + "SWITCH_RULE/SLIST/" + + "LITERAL_SWITCH/SWITCH_RULE/LITERAL_CASE" + ); + runVerifications(moduleConfig, fileToProcess, expectedViolation, expectedXpathQueries); + } +} diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java index 91af949f296..2fe07e74e42 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAfterTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testWhitespaceAfterTypecast() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAfterTypecast.java")); + new File(getPath("InputXpathWhitespaceAfterTypecast.java")); final DefaultConfiguration moduleConfig = createModuleConfig(WhitespaceAfterCheck.class); @@ -52,7 +52,7 @@ public void testWhitespaceAfterTypecast() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAfterTypecast']]/OBJBLOCK" + + "@text='InputXpathWhitespaceAfterTypecast']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/EXPR/TYPECAST/RPAREN" ); @@ -63,7 +63,7 @@ public void testWhitespaceAfterTypecast() throws Exception { @Test public void testWhitespaceAfterNotFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAfterNotFollowed.java")); + new File(getPath("InputXpathWhitespaceAfterNotFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(WhitespaceAfterCheck.class); @@ -75,7 +75,7 @@ public void testWhitespaceAfterNotFollowed() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAfterNotFollowed']]/OBJBLOCK" + + "@text='InputXpathWhitespaceAfterNotFollowed']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN/ARRAY_INIT/COMMA" ); diff --git a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java index 2166a8072d8..03457f1b5d2 100644 --- a/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java +++ b/src/it/java/org/checkstyle/suppressionxpathfilter/XpathRegressionWhitespaceAroundTest.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ protected String getCheckName() { @Test public void testWhitespaceAroundNotPreceded() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAroundNotPreceded.java")); + new File(getPath("InputXpathWhitespaceAroundNotPreceded.java")); final DefaultConfiguration moduleConfig = createModuleConfig(WhitespaceAroundCheck.class); @@ -52,7 +52,7 @@ public void testWhitespaceAroundNotPreceded() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAroundNotPreceded']]/OBJBLOCK" + + "@text='InputXpathWhitespaceAroundNotPreceded']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN" ); @@ -63,7 +63,7 @@ public void testWhitespaceAroundNotPreceded() throws Exception { @Test public void testWhitespaceAroundNotFollowed() throws Exception { final File fileToProcess = - new File(getPath("SuppressionXpathRegressionWhitespaceAroundNotFollowed.java")); + new File(getPath("InputXpathWhitespaceAroundNotFollowed.java")); final DefaultConfiguration moduleConfig = createModuleConfig(WhitespaceAroundCheck.class); @@ -75,7 +75,7 @@ public void testWhitespaceAroundNotFollowed() throws Exception { final List expectedXpathQueries = Collections.singletonList( "/COMPILATION_UNIT/CLASS_DEF[./IDENT[" - + "@text='SuppressionXpathRegressionWhitespaceAroundNotFollowed']]/OBJBLOCK" + + "@text='InputXpathWhitespaceAroundNotFollowed']]/OBJBLOCK" + "/VARIABLE_DEF[./IDENT[@text='bad']]/ASSIGN" ); diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadsNeverSplitRecords.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadsNeverSplitRecords.java new file mode 100644 index 00000000000..20ac7fa8817 --- /dev/null +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadsNeverSplitRecords.java @@ -0,0 +1,99 @@ +// non-compiled with javac: Compilable with Java17 + +package com.puppycrawl.tools.checkstyle.checks.coding.constructorsdeclarationgrouping; + +/** Some javadoc. */ +public class InputOverloadsNeverSplitRecords { + /** Some javadoc. */ + public record MyRecord1(int x, int y) { + public MyRecord1(int a) { + this(a, a); + } + + void foo() {} + + void foo2() {} + + public MyRecord1 {} // violation 'Constructors should be grouped together.*' + + public MyRecord1(int a, int b, int c, int d) { + // violation above 'Constructors should be grouped together.*' + this(a + b, c + d); + } + + public MyRecord1(int x, int y, int z) { + // violation above 'Constructors should be grouped together.*' + this(x + y, z); + } + } + + class MyClass { + int xyz = 20; + + MyClass() {} + + MyClass(String s) {} + + String[] str; + + String[] str2; + + MyClass(int a) {} // violation 'Constructors should be grouped together.*' + } + + /** Some javadoc. */ + public record MyRecord2(double d) { + public MyRecord2(double a, double b, double c) { + this(a + b + c); + } + + public MyRecord2 {} + + public MyRecord2(double a, double b) { + this(a + b); + } + } + + /** Some javadoc. */ + public record MyRecord3(float f) { + public MyRecord3(float a, float b, float c) { + this(a + b + c); + } + } + + /** Some javadoc. */ + public record MyRecord4(String str) { + public MyRecord4 {} + } + + /** Some javadoc. */ + public record MyRecord5(long l) { + void test() {} + + void test2() {} + + void test3() {} + } + + /** Some javadoc. */ + public record MyRecord6(String str, int x) {} + + public void overloadMethod(int i) { + // some foo code + } + + public void overloadMethod(String s) { + // some foo code + } + + public void overloadMethod(boolean b) { + // some foo code + } + + public void fooMethod() {} + + // violation below 'All overloaded methods should be placed next to each other. .* '89' + public void overloadMethod(String s, Boolean b, int i) { + // some foo code + } +} diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java index d170f8aac0f..1f5384c7708 100644 --- a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java @@ -1,62 +1,83 @@ //non-compiled with eclipse: extra semicolumn in imports + package com.puppycrawl.tools.checkstyle.checks.coding.onestatementperline; -/** +/* * This file contains test inputs for InputOneStatementPerLine * which cause compilation problem in Eclipse 4.2.2 but still must be tested. */ -/** +/* * Two import statements and one 'empty' statement * which are not on the same line are legal. */ import java.awt.event.ActionEvent; +import java.lang.Integer; +import java.lang.String; import java.lang.annotation.Annotation; ; // non-compilable by eclipse -import java.lang.String; -import java.lang.Integer; +// violation above '';' should be separated from previous line.' import java.util.LinkedList; import java.util.List; import java.util.concurrent.Callable; import java.util.stream.Collectors; - import javax.swing.JCheckBox; +/** Some javadoc. */ public class InputOneStatementPerLine { - /** - * According to java language specifications, - * statements end with ';'. That is why ';;' - * may be considered as two empty statements on the same line - * and rises violation. - */ - ;; //warn - static { - new JCheckBox().addActionListener((final ActionEvent e) -> {good();}); - List ints = new LinkedList(); - ints.stream().map( t -> { return t * 2;} ).filter( t -> { return false;}); - ints.stream().map( t -> { int m = t * 2; return m; } ); //warn - ints.stream().map( t -> { int m = t * 2; return m; } ); int i = 3; //warn - ints.stream().map( t -> t * 2); int k = 4; //warn - ints.stream().map( t -> t * 2); - List ints2 = new LinkedList(); - ints.stream().map( t -> { return ints2.stream().map(w -> { return w * 2; });}); - ints.stream().map( t -> { return ints2.stream().map(w -> { int m=w; return m; });}); //warn - ints.stream().map( t -> { - return ints2.stream().map( - w -> { - int m = w * 2; - return m; - }); - }); - ints.stream().map( t -> { - int l = 0; - for (int j = 0;j < 10;j++) { - l = j + l; - } - return l; + /* + * According to java language specifications, + * statements end with ';'. That is why ';;' + * may be considered as two empty statements on the same line + * and rises violation. + */ + ;; // violation 'Only one statement per line allowed.' + static { + new JCheckBox().addActionListener((final ActionEvent e) -> { good(); }); + // violation above ''{' at column 64 should have line break after.' + List ints = new LinkedList(); + ints.stream().map(t -> { return t * 2; }).filter(t -> { return false; }); + // 2 violations above: + // ''{' at column 28 should have line break after.' + // ''{' at column 59 should have line break after.' + ints.stream().map(t -> { int m = t * 2; return m; }); + // 2 violations above: + // ''{' at column 28 should have line break after.' + // 'Only one statement per line allowed.' + ints.stream().map(t -> { int m = t * 2; return m; }); int i = 3; + // 3 violations above: + // ''{' at column 28 should have line break after.' + // 'Only one statement per line allowed.' + // 'Only one statement per line allowed.' + ints.stream().map(t -> t * 2); int k = 4; + // violation above 'Only one statement per line allowed.' + ints.stream().map(t -> t * 2); + List ints2 = new LinkedList(); + ints.stream().map(t -> { return ints2.stream().map(w -> { return w * 2; }); }); + // 2 violations above: + // ''{' at column 28 should have line break after.' + // ''{' at column 61 should have line break after.' + ints.stream().map(t -> { return ints2.stream().map(w -> { int m = w; return m; }); }); + // 3 violations above: + // ''{' at column 28 should have line break after.' + // ''{' at column 61 should have line break after.' + // 'Only one statement per line allowed.' + + ints.stream().map(t -> { + return ints2.stream().map( + w -> { + int m = w * 2; + return m; }); - } + }); + ints.stream().map(t -> { + int l = 0; + for (int j = 0; j < 10; j++) { + l = j + l; + } + return l; + }); + } - private static void good() { - } + private static void good() {} } diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundWhen.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundWhen.java new file mode 100644 index 00000000000..1424e992aca --- /dev/null +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundWhen.java @@ -0,0 +1,91 @@ +// non-compiled with javac: Compilable with Java21 + +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +class InputFormattedWhitespaceAroundWhen { + + /** method. */ + void test(Object o) { + switch (o) { + case Integer i when (i == 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case String s when (s.equals("a")) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case Point(int x, int y) when !(x >= 0 && y >= 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + default -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + } + + switch (o) { + case Point(int x, int y) when (x < 9 && y >= 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case Point(int x, int y) when (x >= 0 && y >= 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case Point(int x, int y) when !(x >= 0 && y >= 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + default -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + } + } + + /** method. */ + void test2(Object o) { + + switch (o) { + case Integer i when (i == 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case String s when (s.equals("a")) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case Point(int x, int y) when (x >= 0 && y >= 0) -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + default -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + } + + switch (o) { + case Integer i when i == 0 -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case String s when s.equals("a") -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + case Point(int x, int y) when x >= 0 && y >= 0 -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + default -> {} + // 2 violations above: + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + } + } + + record Point(int x, int y) {} +} diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundWhen.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundWhen.java new file mode 100644 index 00000000000..615a9031ac7 --- /dev/null +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundWhen.java @@ -0,0 +1,78 @@ +//non-compiled with javac: Compilable with Java21 + +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +class InputWhitespaceAroundWhen { + + /** method. */ + void test(Object o) { + switch (o) { + case Integer i when(i == 0) -> { + } + // 2 violations 2 lines above: + // ''when' is not followed by whitespace.' + // ''when' is not followed by whitespace.' + case String s when( + // 2 violations above: + // ''when' is not followed by whitespace' + // ''when' is not followed by whitespace' + s.equals("a")) -> { + } + case Point(int x, int y) when!(x >= 0 && y >= 0) -> { + } + // 2 violations 2 lines above: + // ''when' is not followed by whitespace.' + // ''when' is not followed by whitespace.' + default -> { + } + } + + switch (o) { + case Point(int x, int y)when (x < 9 && y >= 0) -> { + } // violation above, ''when' is not preceded with whitespace.' + case Point(int x, int y)when(x >= 0 && y >= 0) -> { + } + // 3 violations 2 lines above: + // ''when' is not followed by whitespace.' + // ''when' is not followed by whitespace.' + // ''when' is not preceded with whitespace.' + case Point(int x, int y)when!(x >= 0 && y >= 0) -> { + } + // 3 violations 2 lines above: + // ''when' is not followed by whitespace.' + // ''when' is not followed by whitespace.' + // ''when' is not preceded with whitespace.' + default -> { + } + } + } + + /** method. */ + void test2(Object o) { + + switch (o) { + case Integer i when (i == 0) -> { + } + case String s when (s.equals("a")) -> { + } + case Point(int x, int y) when (x >= 0 && y >= 0) -> { + } + default -> { + } + } + + switch (o) { + case Integer i when i == 0 -> { + } + case String s when s.equals("a") -> { + } + case Point(int x, int y) when x >= 0 && y >= 0 -> { + } + default -> { + } + } + } + + record Point(int x, int y) { + } +} diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputRecordComponentName.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputRecordComponentName.java index 77e64cac15e..28999f6cc78 100644 --- a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputRecordComponentName.java +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputRecordComponentName.java @@ -1,13 +1,17 @@ -//non-compiled with javac: Compilable with Java14 +// non-compiled with javac: Compilable with Java17 + package com.puppycrawl.tools.checkstyle.checks.naming.recordcomponentname; -/* Config: +/** + * some javadoc. + * Config: * format = "^[a-z]([a-z0-9][a-zA-Z0-9]*)?$" * */ -public record InputRecordComponentName(int _componentName, // warn - String componentName2) { -} +public record InputRecordComponentName(int _componentName, String componentName2) {} +// violation above 'Record component name '_componentName' must match pattern' -record InputRecordComponentName(int Capital) { // warn -} +record InputRecordComponentName(int Capital) {} +// 2 violations above: +// 'Top-level class InputRecordComponentName has to reside in its own source file.' +// 'Record component name 'Capital' must match pattern' diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputPatternVariableNameEnhancedInstanceofTestDefault.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputPatternVariableNameEnhancedInstanceofTestDefault.java index f294a515bfe..c247c0a098e 100644 --- a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputPatternVariableNameEnhancedInstanceofTestDefault.java +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputPatternVariableNameEnhancedInstanceofTestDefault.java @@ -1,79 +1,100 @@ -//non-compiled with javac: Compilable with Java14 +// non-compiled with javac: Compilable with Java17 + package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; import java.util.ArrayList; +import java.util.List; import java.util.Locale; +/** some javadoc. */ public class InputPatternVariableNameEnhancedInstanceofTestDefault { - private Object obj; - - static boolean doStuff(Object obj) { - return obj instanceof Integer OTHER && OTHER > 0; // warn - } + private Object obj; - static { - Object o = ""; - if (o instanceof String s) { - System.out.println(s.toLowerCase(Locale.forLanguageTag(s))); - boolean stringCheck = "test".equals(s); - } + static boolean doStuff(Object obj) { + return obj instanceof Integer OTHER && OTHER > 0; + // 2 violations above: + // 'Abbreviation in name 'OTHER' must contain no more than '1' consecutive capital letters.' + // 'Pattern variable name 'OTHER' must match pattern' + } - if (o instanceof Integer Count) { // warn - int value = Count.byteValue(); - if (Count.equals(value)) { - value = 25; - } - } + static { + Object o = ""; + if (o instanceof String s) { + System.out.println(s.toLowerCase(Locale.forLanguageTag(s))); + boolean stringCheck = "test".equals(s); } - interface VoidPredicate { - public boolean get(); + if (o instanceof Integer Count) { + // violation above 'Pattern variable name 'Count' must match pattern' + int value = Count.byteValue(); + if (Count.equals(value)) { + value = 25; + } } + } - public void t(Object o1, Object o2) { - Object b; - Object c; - if (!(o1 instanceof String aA) // warn - && (o2 instanceof String a1_a)) { // warn - } + interface VoidPredicate { + public boolean get(); + } - if (o1 instanceof String A_A // warn - || !(o2 instanceof String aa2_a)) { // warn - } - b = ((VoidPredicate) () -> o1 instanceof String s).get(); + /** some javadoc. */ + public void testing(Object o1, Object o2) { + Object b; + Object c; + if (!(o1 instanceof String aA) + // violation above 'Pattern variable name 'aA' must match pattern' + && (o2 instanceof String a1_a)) { + // violation above 'Pattern variable name 'a1_a' must match pattern' + } - ArrayList arrayList = new ArrayList(); - if (arrayList instanceof ArrayList ai) { - System.out.println("Blah"); - } + if (o1 instanceof String A_A + // violation above 'Pattern variable name 'A_A' must match pattern' + || !(o2 instanceof String aa2_a)) { + // violation above 'Pattern variable name 'aa2_a' must match pattern' + } + b = ((VoidPredicate) () -> o1 instanceof String s).get(); - boolean result = (o1 instanceof String a) ? - (o1 instanceof String x) : (!(o1 instanceof String y)); + List arrayList = new ArrayList(); + if (arrayList instanceof ArrayList ai) { + System.out.println("Blah"); + } - if (!(o1 instanceof Integer _a) ? // warn - false : _a > 0) { - System.out.println("done"); - } + boolean result = + (o1 instanceof String a) ? (o1 instanceof String x) : (!(o1 instanceof String y)); - { - while (!(o1 instanceof String _aa)) { // warn - L3: - break L3; - } - while (o1 instanceof String aa_) { // warn - aa_.length(); - } - } + // violation below 'Pattern variable name '_a' must match pattern' + if (!(o1 instanceof Integer _a) + ? + false + : _a > 0) { + System.out.println("done"); + } - int x = o1 instanceof String aaa$aaa ? aaa$aaa.length() : 2; // warn - x = !(o1 instanceof String $aaaaaa) ? 2 : $aaaaaa.length(); // warn - for (; o1 instanceof String aaaaaa$; aaaaaa$.length()) { // warn - System.out.println(aaaaaa$); + { + while (!(o1 instanceof String _aa)) { + // violation above 'Pattern variable name '_aa' must match pattern' + L3: + break L3; } + while (o1 instanceof String aa_) { + // violation above 'Pattern variable name 'aa_' must match pattern' + aa_.length(); + } + } - do { - L4: - break L4; - } while (!(o1 instanceof String _A_aa_B)); // warn + int x = o1 instanceof String aaa$aaa ? aaa$aaa.length() : 2; + // violation above 'Pattern variable name .* must match pattern' + x = !(o1 instanceof String $aaaaaa) ? 2 : $aaaaaa.length(); + // violation above 'Pattern variable name .* must match pattern' + for (; o1 instanceof String aaaaaa$; aaaaaa$.length()) { + // violation above 'Pattern variable name .* must match pattern' + System.out.println(aaaaaa$); } + + do { + L4: + break L4; + } while (!(o1 instanceof String _A_aa_B)); + // violation above 'Pattern variable name '_A_aa_B' must match pattern' + } } diff --git a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputRecordTypeParameterName.java b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputRecordTypeParameterName.java index fe5c31fe0c1..1401bea2f81 100644 --- a/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputRecordTypeParameterName.java +++ b/src/it/resources-noncompilable/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputRecordTypeParameterName.java @@ -1,58 +1,52 @@ -//non-compiled with javac: Compilable with Java14 +// non-compiled with javac: Compilable with Java17 + package com.puppycrawl.tools.checkstyle.checks.naming.recordtypeparametername; import java.io.Serializable; import java.util.LinkedHashMap; - import org.w3c.dom.Node; -/* Config: - * pattern = "(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" - * - */ -public record InputRecordTypeParameterName(Integer x, String str) { // warn - public void foo() { } +/** some javadoc. Config: pattern = "(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)" */ +public record InputRecordTypeParameterName(Integer x, String str) { + // violation above 'Record type name 't' must match pattern' + public void foo() {} - void foo(int i) { - } -} + void foo(int i) {} -record Other // warn -(LinkedHashMap linkedHashMap) { + // violation below 'Record type name 'foo' must match pattern' + record Other(LinkedHashMap linkedHashMap) { foo getOne() { - return null;//comment + return null; // comment } - /*comment*/Tfo$o2T getTwo(Tfo$o2T a) { - return null; + /*comment*/ T getTwo(T a) { + return null; } - foo getShadow() { - return null; + E getShadow() { + return null; } - static record Junk () { // warn - <_fo extends foo> void getMoreFoo() { - } + static record Junk() { // violation 'Record type name 'foo' must match pattern' + void getMoreFoo() {} } -} + } -record MoreOther (char c, String string) { + record MoreOther(char c, String string) { - interface Boo { - Input boo(); + interface Boo { + I boo(); } interface FooInterface { - T foo(); + T foo(); } interface FooInterface2 { - Input foo(); + I foo(); } - record Input(int x, int y) { - - } + record I(int x, int y) {} + } } diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingRecords.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingRecords.java new file mode 100644 index 00000000000..bf12fe5fd82 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingRecords.java @@ -0,0 +1,16 @@ +//non-compiled with javac: Compilable with Java14 + +package org.checkstyle.suppressionxpathfilter.constructorsdeclarationgrouping; + +public class InputXpathConstructorsDeclarationGroupingRecords { + public record MyRecord(int x, int y) { + + public MyRecord(int a) { + this(a,a); + } + + void foo() {} + + public MyRecord {} // warn + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInRecord.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInRecord.java new file mode 100644 index 00000000000..7083a132464 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInRecord.java @@ -0,0 +1,11 @@ +//non-compiled with javac: Compilable with Java17 + +package org.checkstyle.suppressionxpathfilter.covariantequals; + +public record InputXpathCovariantEqualsInRecord() { + + public boolean equals(String str) { // warn + return str.equals(this); + } + +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInRecord.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInRecord.java deleted file mode 100644 index 34171e75b51..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInRecord.java +++ /dev/null @@ -1,11 +0,0 @@ -//non-compiled with javac: Compilable with Java14 - -package org.checkstyle.suppressionxpathfilter.covariantequals; - -public record SuppressionXpathRegressionCovariantEqualsInRecord() { - - public boolean equals(String str) { // warn - return str.equals(this); - } - -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/InputXpathIllegalIdentifierNameOne.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/InputXpathIllegalIdentifierNameOne.java new file mode 100644 index 00000000000..d64db415bee --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/InputXpathIllegalIdentifierNameOne.java @@ -0,0 +1,12 @@ +//non-compiled with javac: Compilable with Java17 +package org.checkstyle.suppressionxpathfilter.illegalidentifiername; + +/* Config: + * + * default + */ +public record InputXpathIllegalIdentifierNameOne + (String string, + String yield, // warn + String otherString){ +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/InputXpathIllegalIdentifierNameTwo.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/InputXpathIllegalIdentifierNameTwo.java new file mode 100644 index 00000000000..49629d72d67 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/InputXpathIllegalIdentifierNameTwo.java @@ -0,0 +1,17 @@ +//non-compiled with javac: Compilable with Java17 +package org.checkstyle.suppressionxpathfilter.illegalidentifiername; + +/* Config: + * + * default + */ +public class InputXpathIllegalIdentifierNameTwo { + int foo(int yield) { // warn + return switch (yield) { + case 1 -> 2; + case 2 -> 3; + case 3 -> 4; + default -> 5; + }; + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/SuppressionXpathRegressionIllegalIdentifierNameTestOne.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/SuppressionXpathRegressionIllegalIdentifierNameTestOne.java deleted file mode 100644 index 24417eaf730..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/SuppressionXpathRegressionIllegalIdentifierNameTestOne.java +++ /dev/null @@ -1,12 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package org.checkstyle.suppressionxpathfilter.illegalidentifiername; - -/* Config: - * - * default - */ -public record SuppressionXpathRegressionIllegalIdentifierNameTestOne - (String string, - String yield, // warn - String otherString){ -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/SuppressionXpathRegressionIllegalIdentifierNameTestTwo.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/SuppressionXpathRegressionIllegalIdentifierNameTestTwo.java deleted file mode 100644 index 966376ded91..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalidentifiername/SuppressionXpathRegressionIllegalIdentifierNameTestTwo.java +++ /dev/null @@ -1,17 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package org.checkstyle.suppressionxpathfilter.illegalidentifiername; - -/* Config: - * - * default - */ -public class SuppressionXpathRegressionIllegalIdentifierNameTestTwo { - int foo(int yield) { // warn - return switch (yield) { - case 1 -> 2; - case 2 -> 3; - case 3 -> 4; - default -> 5; - }; - } -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationAnonymous.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationAnonymous.java new file mode 100644 index 00000000000..fd102f38a0d --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationAnonymous.java @@ -0,0 +1,13 @@ +//non-compiled with javac: compiling on jdk before 9 + +package org.checkstyle.suppressionxpathfilter.illegalinstantiation; + +public class InputXpathIllegalInstantiationAnonymous { + int b = 5; // ok + class Inner{ + public void test() { + Boolean x = new Boolean(true); // ok + Integer e = new Integer(b); // warn + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationInterface.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationInterface.java new file mode 100644 index 00000000000..bc77bc3d394 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationInterface.java @@ -0,0 +1,13 @@ +//non-compiled with javac: compiling on jdk before 9 + +package org.checkstyle.suppressionxpathfilter.illegalinstantiation; + +public class InputXpathIllegalInstantiationInterface { + interface Inner { + default void test() { + Boolean x = new Boolean(true); // ok + Integer e = new Integer(5); // ok + String s = new String(); // warn + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationSimple.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationSimple.java new file mode 100644 index 00000000000..3f5d3121c78 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/illegalinstantiation/InputXpathIllegalInstantiationSimple.java @@ -0,0 +1,11 @@ +//non-compiled with javac: compiling on jdk before 9 + +package org.checkstyle.suppressionxpathfilter.illegalinstantiation; + +public class InputXpathIllegalInstantiationSimple { + int b = 5; // ok + public void test() { + Boolean x = new Boolean(true); // warn + Integer e = new Integer(b); // ok + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/missingnullcaseinswitch/InputXpathMissingNullCaseInSwitchNested.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/missingnullcaseinswitch/InputXpathMissingNullCaseInSwitchNested.java new file mode 100644 index 00000000000..5001533bbb8 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/missingnullcaseinswitch/InputXpathMissingNullCaseInSwitchNested.java @@ -0,0 +1,22 @@ +// non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.missingnullcaseinswitch; + +public class InputXpathMissingNullCaseInSwitchNested { + void test(Object obj) { + int x = switch (obj) { + case Rectangle(ColoredPoint _, ColoredPoint _) -> 1; + case ColoredPoint(int _, int _, String _) -> 2; + case null -> 3; + default -> { + int y = switch (obj) { // warn + case Rectangle(ColoredPoint _, ColoredPoint _) -> 1; + case ColoredPoint(int _, int _, String _) -> 2; + default -> 4; + }; + yield y; + } + }; + } + record ColoredPoint(int p, int x, String c) { } + record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) { } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/missingnullcaseinswitch/InputXpathMissingNullCaseInSwitchSimple.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/missingnullcaseinswitch/InputXpathMissingNullCaseInSwitchSimple.java new file mode 100644 index 00000000000..9c96cb949fd --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/missingnullcaseinswitch/InputXpathMissingNullCaseInSwitchSimple.java @@ -0,0 +1,16 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.missingnullcaseinswitch; + +public class InputXpathMissingNullCaseInSwitchSimple { + + void test(Object obj) { + + switch (obj) { // warn + case Rectangle(ColoredPoint _, ColoredPoint _) -> {} + case ColoredPoint(int _, int _, String _) -> {} + default -> {} + } + } + record ColoredPoint(int p, int x, String c) { } + record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) { } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/InputXpathPackageAnnotationOne.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/InputXpathPackageAnnotationOne.java new file mode 100644 index 00000000000..ebdc152242f --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/InputXpathPackageAnnotationOne.java @@ -0,0 +1,8 @@ +//non-compiled with javac: compiling on jdk before 8 +//more details at https://github.com/checkstyle/checkstyle/issues/7846 +@Deprecated +package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation; // warn + +public class InputXpathPackageAnnotationOne { + +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/InputXpathPackageAnnotationTwo.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/InputXpathPackageAnnotationTwo.java new file mode 100644 index 00000000000..62dcd55063d --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/InputXpathPackageAnnotationTwo.java @@ -0,0 +1,10 @@ +//non-compiled with javac: compiling on jdk before 8 +//more details at https://github.com/checkstyle/checkstyle/issues/7846 +@Deprecated @Generated("foo") +package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation.two; // warn + +import javax.annotation.Generated; + +public class InputXpathPackageAnnotationTwo { + +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/SuppressionXpathRegressionPackageAnnotationOne.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/SuppressionXpathRegressionPackageAnnotationOne.java deleted file mode 100644 index 389588cf9ef..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/SuppressionXpathRegressionPackageAnnotationOne.java +++ /dev/null @@ -1,8 +0,0 @@ -//non-compiled with javac: compiling on jdk before 8 -//more details at https://github.com/checkstyle/checkstyle/issues/7846 -@Deprecated -package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation; // warn - -public class SuppressionXpathRegressionPackageAnnotationOne { - -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/SuppressionXpathRegressionPackageAnnotationTwo.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/SuppressionXpathRegressionPackageAnnotationTwo.java deleted file mode 100644 index 377d6614107..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packageannotation/SuppressionXpathRegressionPackageAnnotationTwo.java +++ /dev/null @@ -1,10 +0,0 @@ -//non-compiled with javac: compiling on jdk before 8 -//more details at https://github.com/checkstyle/checkstyle/issues/7846 -@Deprecated @Generated("foo") -package com.puppycrawl.tools.checkstyle.checks.annotation.packageannotation.two; // warn - -import javax.annotation.Generated; - -public class SuppressionXpathRegressionPackageAnnotationOne { - -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/InputXpathMissingPackage.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/InputXpathMissingPackage.java new file mode 100644 index 00000000000..39c32922a5e --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/InputXpathMissingPackage.java @@ -0,0 +1,5 @@ +// non-compiled with javac: missing package. Used for Testing purpose. +// package is missing. +public class InputXpathMissingPackage { // warn + // code +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/InputXpathWrongPackage.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/InputXpathWrongPackage.java new file mode 100644 index 00000000000..e99f4c59afd --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/InputXpathWrongPackage.java @@ -0,0 +1,6 @@ +// non-compiled with javac: wrong package. Used for Testing purpose. +package my.packagename.mismatch.with.folder; // warn + +public class InputXpathWrongPackage { + // code +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/SuppressionXpathRegression1.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/SuppressionXpathRegression1.java deleted file mode 100644 index f0b5261b516..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/SuppressionXpathRegression1.java +++ /dev/null @@ -1,6 +0,0 @@ -// non-compiled with javac: wrong package. Used for Testing purpose. -package my.packagename.mismatch.with.folder; // warn - -public class SuppressionXpathRegression1 { - // code -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/SuppressionXpathRegression2.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/SuppressionXpathRegression2.java deleted file mode 100644 index b3c4f5b13e3..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagedeclaration/SuppressionXpathRegression2.java +++ /dev/null @@ -1,5 +0,0 @@ -// non-compiled with javac: missing package. Used for Testing purpose. -// package is missing. -public class SuppressionXpathRegression2 { // warn - // code -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameThree.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameThree.java new file mode 100644 index 00000000000..9bc1d0519f9 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameThree.java @@ -0,0 +1,4 @@ +package org.checkstyle.suppressionxpathfilter.PACKAGENAME; // warn + +public class InputXpathPackageNameThree { +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameFour.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameFour.java new file mode 100644 index 00000000000..9cdd56c688d --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameFour.java @@ -0,0 +1,9 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.naming; + +public class InputXpathPatternVariableNameFour { + MyClass(Object o1){ + if (o1 instanceof String st) { // warning + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameOne.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameOne.java new file mode 100644 index 00000000000..10c43a800da --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameOne.java @@ -0,0 +1,9 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.naming; + +public class InputXpathPatternVariableNameOne { + MyClass(Object o1){ + if (o1 instanceof String STRING1) { // warning + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameThree.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameThree.java new file mode 100644 index 00000000000..5b3c90fbf83 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameThree.java @@ -0,0 +1,9 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.naming; + +public class InputXpathPatternVariableNameThree { + MyClass(Object o1){ + if (o1 instanceof String STR) { // warning + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameTwo.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameTwo.java new file mode 100644 index 00000000000..4d051f13e61 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/InputXpathPatternVariableNameTwo.java @@ -0,0 +1,9 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.naming; + +public class InputXpathPatternVariableNameTwo { + MyClass(Object o1){ + if (o1 instanceof String s) { // warning + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName1.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName1.java deleted file mode 100644 index cb084cd2100..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName1.java +++ /dev/null @@ -1,9 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.naming; - -public class SuppressionXpathRegressionPatternVariableName1 { - MyClass(Object o1){ - if (o1 instanceof String STRING1) { // warning - } - } -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName2.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName2.java deleted file mode 100644 index 1475ca2e97f..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName2.java +++ /dev/null @@ -1,9 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.naming; - -public class SuppressionXpathRegressionPatternVariableName2 { - MyClass(Object o1){ - if (o1 instanceof String s) { // warning - } - } -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName3.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName3.java deleted file mode 100644 index 8915ded5185..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName3.java +++ /dev/null @@ -1,9 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.naming; - -public class SuppressionXpathRegressionPatternVariableName3 { - MyClass(Object o1){ - if (o1 instanceof String STR) { // warning - } - } -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName4.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName4.java deleted file mode 100644 index 8eeffc210f1..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/patternvariablename/SuppressionXpathRegressionPatternVariableName4.java +++ /dev/null @@ -1,9 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.naming; - -public class SuppressionXpathRegressionPatternVariableName1 { - MyClass(Object o1){ - if (o1 instanceof String st) { // warning - } - } -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/InputXpathRecordComponentNameDefault.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/InputXpathRecordComponentNameDefault.java new file mode 100644 index 00000000000..47723e0ff48 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/InputXpathRecordComponentNameDefault.java @@ -0,0 +1,8 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentname; + +/* Config: default + */ +public record InputXpathRecordComponentNameDefault(int _value) { // warn + +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/InputXpathRecordComponentNameFormat.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/InputXpathRecordComponentNameFormat.java new file mode 100644 index 00000000000..80b7e9f3ba2 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/InputXpathRecordComponentNameFormat.java @@ -0,0 +1,10 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentname; + +/* Config: + * format = ^[a-z][a-zA-Z0-9]*$ + */ +public class InputXpathRecordComponentNameFormat { + public record MyRecord(int _underscoreValue, // ok + int otherValue) { } // warn +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/SuppressionXpathRecordComponentName1.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/SuppressionXpathRecordComponentName1.java deleted file mode 100644 index 236ca74f1a4..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/SuppressionXpathRecordComponentName1.java +++ /dev/null @@ -1,8 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentname; - -/* Config: default - */ -public record SuppressionXpathRecordComponentName1(int _value) { // warn - -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/SuppressionXpathRecordComponentName2.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/SuppressionXpathRecordComponentName2.java deleted file mode 100644 index a22ff3cd765..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentname/SuppressionXpathRecordComponentName2.java +++ /dev/null @@ -1,10 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentname; - -/* Config: - * format = ^[a-z][a-zA-Z0-9]*$ - */ -public class SuppressionXpathRecordComponentName2 { - public record MyRecord(int _underscoreValue, // ok - int otherValue) { } // warn -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/InputXpathRecordComponentNumberCustomMax.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/InputXpathRecordComponentNumberCustomMax.java new file mode 100644 index 00000000000..d1c28158498 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/InputXpathRecordComponentNumberCustomMax.java @@ -0,0 +1,10 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentnumber; + +/* Config: + * + * max = 1 + */ +public class InputXpathRecordComponentNumberCustomMax { + public record MyRecord(int x, int y) { } // warn +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/InputXpathRecordComponentNumberDefault.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/InputXpathRecordComponentNumberDefault.java new file mode 100644 index 00000000000..2ac74b62092 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/InputXpathRecordComponentNumberDefault.java @@ -0,0 +1,15 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentnumber; + +/* Config: + * + * max = 8 + */ +public record InputXpathRecordComponentNumberDefault(int x, int y, int z, // warn + int a, int b, int c, + int d, int e, int f, + int g, int h, int i, + int j, int k, + String... myVarargs) { + +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/SuppressionXpathRecordComponentNumber1.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/SuppressionXpathRecordComponentNumber1.java deleted file mode 100644 index 3ca4490d4d9..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/SuppressionXpathRecordComponentNumber1.java +++ /dev/null @@ -1,15 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentnumber; - -/* Config: - * - * max = 8 - */ -public record SuppressionXpathRecordComponentNumber1(int x, int y, int z, // warn - int a, int b, int c, - int d, int e, int f, - int g, int h, int i, - int j, int k, - String... myVarargs) { - -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/SuppressionXpathRecordComponentNumber2.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/SuppressionXpathRecordComponentNumber2.java deleted file mode 100644 index 63dd71b3c36..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordcomponentnumber/SuppressionXpathRecordComponentNumber2.java +++ /dev/null @@ -1,10 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.sizes.recordcomponentnumber; - -/* Config: - * - * max = 1 - */ -public class SuppressionXpathRecordComponentNumber2 { - public record MyRecord(int x, int y) { } // warn -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/InputXpathRecordTypeParameterNameTypeDeclared.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/InputXpathRecordTypeParameterNameTypeDeclared.java new file mode 100644 index 00000000000..6327eec7606 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/InputXpathRecordTypeParameterNameTypeDeclared.java @@ -0,0 +1,11 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.naming.classtypeparametername; + +import java.io.Serializable; +import java.util.LinkedHashMap; + +record InputXpathRecordTypeParameterNameTypeDeclared // warn +(LinkedHashMap linkedHashMap) { + +} + diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/InputXpathRecordTypeParameterNameTypeDefault.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/InputXpathRecordTypeParameterNameTypeDefault.java new file mode 100644 index 00000000000..fec0e5c52cb --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/InputXpathRecordTypeParameterNameTypeDefault.java @@ -0,0 +1,6 @@ +//non-compiled with javac: Compilable with Java17 +package com.puppycrawl.tools.checkstyle.checks.naming.classtypeparametername; + +public record InputXpathRecordTypeParameterNameTypeDefault(Integer x, String str) { // warn + +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/SuppressionXpathRegressionRecordTypeParameterName1.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/SuppressionXpathRegressionRecordTypeParameterName1.java deleted file mode 100644 index 4f1bdf32bb9..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/SuppressionXpathRegressionRecordTypeParameterName1.java +++ /dev/null @@ -1,11 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.naming.classtypeparametername; - -import java.io.Serializable; -import java.util.LinkedHashMap; - -record Other // warn -(LinkedHashMap linkedHashMap) { - -} - diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/SuppressionXpathRegressionRecordTypeParameterName2.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/SuppressionXpathRegressionRecordTypeParameterName2.java deleted file mode 100644 index b63183064c9..00000000000 --- a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/recordtypeparametername/SuppressionXpathRegressionRecordTypeParameterName2.java +++ /dev/null @@ -1,6 +0,0 @@ -//non-compiled with javac: Compilable with Java14 -package com.puppycrawl.tools.checkstyle.checks.naming.classtypeparametername; - -public record InputRecordTypeParameterName(Integer x, String str) { // warn - -} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/sealedshouldhavepermitslist/InputXpathSealedShouldHavePermitsListInner.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/sealedshouldhavepermitslist/InputXpathSealedShouldHavePermitsListInner.java new file mode 100644 index 00000000000..916aacb1c4a --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/sealedshouldhavepermitslist/InputXpathSealedShouldHavePermitsListInner.java @@ -0,0 +1,9 @@ +//non-compiled with javac: Compilable with Java17 +package org.checkstyle.suppressionxpathfilter.sealedshouldhavepermitslist; + +public class InputXpathSealedShouldHavePermitsListInner { + sealed class A {} // warn + final class B extends A {} + final class C extends A {} + final class D { } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/sealedshouldhavepermitslist/InputXpathSealedShouldHavePermitsListTopLevel.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/sealedshouldhavepermitslist/InputXpathSealedShouldHavePermitsListTopLevel.java new file mode 100644 index 00000000000..67b5fce3399 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/sealedshouldhavepermitslist/InputXpathSealedShouldHavePermitsListTopLevel.java @@ -0,0 +1,8 @@ +//non-compiled with javac: Compilable with Java17 +package org.checkstyle.suppressionxpathfilter.sealedshouldhavepermitslist; + +public sealed class InputXpathSealedShouldHavePermitsListTopLevel { // warn + final class B extends InputXpathSealedShouldHavePermitsListTopLevel {} + final class C extends InputXpathSealedShouldHavePermitsListTopLevel {} + final class D { } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableNameInnerClassField.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableNameInnerClassField.java new file mode 100644 index 00000000000..071f5147483 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableNameInnerClassField.java @@ -0,0 +1,18 @@ +//non-compiled with javac: Compilable with Java17 +package org.checkstyle.suppressionxpathfilter.staticvariablename; + +public class InputXpathStaticVariableNameInnerClassField { + + public int num1; + + protected int NUM2; + + public void outerMethod() { + + class MyLocalClass { + + static int NUM3; //warn + + } + } + } diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableNameNoAccessModifier.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableNameNoAccessModifier.java new file mode 100644 index 00000000000..701069fb11c --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableNameNoAccessModifier.java @@ -0,0 +1,8 @@ +//non-compiled with javac: Compilable with Java17 +package org.checkstyle.suppressionxpathfilter.staticvariablename; + +public class InputXpathStaticVariableNameNoAccessModifier { + { + static int NUM3; //warn + } + } diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedcatchparametershouldbeunnamed/InputXpathUnusedCatchParameterShouldBeUnnamedNested.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedcatchparametershouldbeunnamed/InputXpathUnusedCatchParameterShouldBeUnnamedNested.java new file mode 100644 index 00000000000..bbcd5c4d151 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedcatchparametershouldbeunnamed/InputXpathUnusedCatchParameterShouldBeUnnamedNested.java @@ -0,0 +1,20 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.unusedcatchparametershouldbeunnamed; + +public class InputXpathUnusedCatchParameterShouldBeUnnamedNested { + + void test() { + try { + int x = 1 / 0; + } + catch (Exception e) { + try { + int z = 5 / 0; + } + catch (Exception exception) { // warn + System.out.println("infinity"); + } + e.printStackTrace(); + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedcatchparametershouldbeunnamed/InputXpathUnusedCatchParameterShouldBeUnnamedSimple.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedcatchparametershouldbeunnamed/InputXpathUnusedCatchParameterShouldBeUnnamedSimple.java new file mode 100644 index 00000000000..e7016bc04ad --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedcatchparametershouldbeunnamed/InputXpathUnusedCatchParameterShouldBeUnnamedSimple.java @@ -0,0 +1,14 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.unusedcatchparametershouldbeunnamed; + +public class InputXpathUnusedCatchParameterShouldBeUnnamedSimple { + + void test() { + try { + int x = 1 / 0; + } + catch (Exception e) { // warn + System.out.println("infinity"); + } + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedlambdaparametershouldbeunnamed/InputXpathUnusedLambdaParameterShouldBeUnnamedNested.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedlambdaparametershouldbeunnamed/InputXpathUnusedLambdaParameterShouldBeUnnamedNested.java new file mode 100644 index 00000000000..eedc0b9ecfc --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedlambdaparametershouldbeunnamed/InputXpathUnusedLambdaParameterShouldBeUnnamedNested.java @@ -0,0 +1,14 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.unusedcatchparametershouldbeunnamed; + +import java.util.function.Function; + +public class InputXpathUnusedLambdaParameterShouldBeUnnamedNested { + + void test() { + Function f1 = (x) -> { + Function f = (y) -> x; // warn + return 2; + }; + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedlambdaparametershouldbeunnamed/InputXpathUnusedLambdaParameterShouldBeUnnamedSimple.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedlambdaparametershouldbeunnamed/InputXpathUnusedLambdaParameterShouldBeUnnamedSimple.java new file mode 100644 index 00000000000..6511463a769 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/unusedlambdaparametershouldbeunnamed/InputXpathUnusedLambdaParameterShouldBeUnnamedSimple.java @@ -0,0 +1,11 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.unusedcatchparametershouldbeunnamed; + +import java.util.function.Function; + +public class InputXpathUnusedLambdaParameterShouldBeUnnamedSimple { + + void test() { + Function f = (x) -> 1; // warn + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/whenshouldbeused/InputXpathWhenShouldBeUsedNested.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/whenshouldbeused/InputXpathWhenShouldBeUsedNested.java new file mode 100644 index 00000000000..9f5fc7888df --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/whenshouldbeused/InputXpathWhenShouldBeUsedNested.java @@ -0,0 +1,22 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.whenshouldbeused; + +public class InputXpathWhenShouldBeUsedNested { + + void test(Object o, Object o2, int y) { + int x = switch (o) { + case String s -> { + switch (o2) { + case Integer _ -> { // warn + if (y == 0) { + System.out.println(0); + } + } + default -> {} + } + yield 3; + } + default -> 3; + }; + } +} diff --git a/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/whenshouldbeused/InputXpathWhenShouldBeUsedSimple.java b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/whenshouldbeused/InputXpathWhenShouldBeUsedSimple.java new file mode 100644 index 00000000000..8fcaabf6811 --- /dev/null +++ b/src/it/resources-noncompilable/org/checkstyle/suppressionxpathfilter/whenshouldbeused/InputXpathWhenShouldBeUsedSimple.java @@ -0,0 +1,15 @@ +//non-compiled with javac: Compilable with Java21 +package org.checkstyle.suppressionxpathfilter.whenshouldbeused; + +public class InputXpathWhenShouldBeUsedSimple { + void test(Object o) { + switch (o) { + case String s -> { // warn + if (s.isEmpty()) { + System.out.println("empty string"); + } + } + default -> {} + } + } + } diff --git a/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule21filename/InputFileName1.java b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule21filename/InputFileName1.java new file mode 100644 index 00000000000..b02aef9dc1a --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule21filename/InputFileName1.java @@ -0,0 +1,38 @@ +package com.google.checkstyle.test.chapter2filebasic.rule21filename; + +// violation below 'Top-level class MyAnnotation1 has to reside in its own source file.' +@interface MyAnnotation1 { // ok + String name(); + + int version(); +} + +/** Some javadoc. */ +@MyAnnotation1(name = "ABC", version = 1) +public class InputFileName1 {} // ok + +// violation below 'Top-level class Enum1 has to reside in its own source file.' +enum Enum1 { + A, + B, + C; + + Enum1() {} + + public String toString() { + return ""; // some custom implementation + } +} + +// violation below 'Top-level class TestRequireThisEnum has to reside in its own source file.' +interface TestRequireThisEnum { // ok + enum DayOfWeek { + SUNDAY, + MONDAY, + TUESDAY, + WEDNESDAY, + THURSDAY, + FRIDAY, + SATURDAY + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule21filename/InputFileName2.java b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule21filename/InputFileName2.java new file mode 100644 index 00000000000..55754b46b73 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule21filename/InputFileName2.java @@ -0,0 +1,22 @@ +package com.google.checkstyle.test.chapter2filebasic.rule21filename; + +/** Test for illegal tokens. */ +public class InputFileName2 { // ok + /** Some javadoc. */ + public void defaultMethod() { + int i = 0; + switch (i) { + default: + i--; + i++; + break; + } + } + + public native void nativeMethod(); + + public void methodWithLiterals() { + final String ref = " <- //warn - // Contains trailing whitespace -> - - /** Invalid format **/ - public static final int badConstant = 2; - /** Valid format **/ - public static final int MAX_ROWS = 2; - - /** Invalid format **/ - private static int badStatic = 2; - /** Valid format **/ - private static int sNumCreated = 0; - - /** Invalid format **/ - private int badMember = 2; - /** Valid format **/ - private int mNumCreated1 = 0; - /** Valid format **/ - protected int mNumCreated2 = 0; - - /** commas are wrong **/ - private int[] mInts = new int[] {1,2, 3, - 4}; - - public static int sTest1; - /** should be private **/ - protected static int sTest3; - /** should be private **/ - static int sTest2; - - /** should be private **/ - int mTest1; - /** should be private **/ - public int mTest2; - - /** - * @return hack - * @param badFormat1 bad format - * @param badFormat2 bad format - * @param badFormat3 bad format - * @throws java.lang.Exception abc - **/ - int test1(int badFormat1,int badFormat2, - final int badFormat3) //warn - throws java.lang.Exception - { - return 0; - } - - /** method that is 20 lines long **/ - private void longMethod() - { - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - } - - /** constructor that is 10 lines long **/ - private InputFileTabCharacter() - { - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - } - - /** test local variables */ - private void localVariables() - { - int abc = 0; - int ABC = 0; - - final int cde = 0; - final int CDE = 0; - - for (int k = 0; k < 1; k++) - { - String innerBlockVariable = ""; - } - for (int I = 0; I < 1; I++) - { - String InnerBlockVariable = ""; - } - } - - /** test method pattern */ - void ALL_UPPERCASE_METHOD() - { - } - - /** test illegal constant **/ - private static final int BAD__NAME = 3; - - // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" - // long line that has a tab -> <- and would be OK if tab counted as 1 char //warn - // tabs that count as one char because of their position -> <- -> <- //warn - - /** some lines to test the column after tabs */ - void violateColumnAfterTabs() - { - // with tab-width 8 all statements below start at the same column, - // with different combinations of ' ' and '\t' before the statement - int tab0 =1; - int tab1 =1; //warn - int tab2 =1; //warn - int tab3 =1; //warn - int tab4 =1; //warn - int tab5 =1; //warn - } - - // MEMME: - /* MEMME: a - * MEMME: - * OOOO - */ - /* NOTHING */ - /* YES */ /* MEMME: x */ /* YES!! */ - - /** test long comments **/ - void veryLong() - { - /* - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - enough talk */ - } - - /** - * @see to lazy to document all args. Testing excessive # args - **/ - void toManyArgs(int aArg1, int aArg2, int aArg3, int aArg4, int aArg5, - int aArg6, int aArg7, int aArg8, int aArg9) - { - } -} - -/** Test class for variable naming in for each clause. */ -class InputSimple2 -{ - /** Some more Javadoc. */ - public void doSomething() - { - //"O" should be named "o" - for (Object O : new java.util.ArrayList()) - { - - } - } -} - -/** Test enum for member naming check */ -enum MyEnum1 -{ - /** ABC constant */ - ABC, - - /** XYZ constant */ - XYZ; - - /** Should be mSomeMember */ - private int someMember; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule231filetab/InputFormattedWhitespaceCharacters.java b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule231filetab/InputFormattedWhitespaceCharacters.java new file mode 100644 index 00000000000..cd94df83eab --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule231filetab/InputFormattedWhitespaceCharacters.java @@ -0,0 +1,39 @@ +package com.google.checkstyle.test.chapter2filebasic.rule231filetab; + +final class InputFormattedWhitespaceCharacters { + // Long line ---------------------------------------------------------------- + // Contains a tab -> <- // violation 'Line contains a tab character.' + // Contains trailing whitespace -> + + /** + * Some javadoc. + * + * @param badFormat1 bad format + * @param badFormat2 bad format + * @param badFormat3 bad format + * @return hack + * @throws Exception abc + */ + int test1(int badFormat1, int badFormat2, final int badFormat3) throws Exception { + return 0; + } + + // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" + // long line that has a tab -> <- and would be OK if tab counted as 1 char + // violation above 'Line contains a tab character.' + + // tabs that count as one char because of their position -> <- -> <- + // violation above 'Line contains a tab character.' + + /** some lines to test the column after tabs. */ + void violateColumnAfterTabs() { + // with tab-width 8 all statements below start at the same column, + // with different combinations of ' ' and '\t' before the statement + int tab0 = 1; + int tab1 = 1; + int tab2 = 1; + int tab3 = 1; + int tab4 = 1; + int tab5 = 1; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule231filetab/InputWhitespaceCharacters.java b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule231filetab/InputWhitespaceCharacters.java new file mode 100644 index 00000000000..27462282091 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule231filetab/InputWhitespaceCharacters.java @@ -0,0 +1,55 @@ +package com.google.checkstyle.test.chapter2filebasic.rule231filetab; + +final class InputWhitespaceCharacters { + // Long line ---------------------------------------------------------------- + // Contains a tab -> <- // violation 'Line contains a tab character.' + // Contains trailing whitespace -> + + /** + * Some javadoc. + * + * @param badFormat1 bad format + * @param badFormat2 bad format + * @param badFormat3 bad format + * @return hack + * @throws java.lang.Exception abc + **/ + int test1(int badFormat1, int badFormat2, + final int badFormat3) // violation 'Line contains a tab character.' + throws java.lang.Exception { + return 0; + } + + // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" + // long line that has a tab -> <- and would be OK if tab counted as 1 char + // violation above 'Line contains a tab character.' + // tabs that count as one char because of their position -> <- -> <- + // violation above 'Line contains a tab character.' + + /** some lines to test the column after tabs. */ + void violateColumnAfterTabs() { + // with tab-width 8 all statements below start at the same column, + // with different combinations of ' ' and '\t' before the statement + int tab0 = 1; + int tab1 = 1; + // 2 violations above: + // 'Line contains a tab character.' + // ''method def' child has incorrect indentation level 8, expected level should be 4.' + int tab2 = 1; + // 2 violations above: + // 'Line contains a tab character.' + // ''method def' child has incorrect indentation level 8, expected level should be 4.' + int tab3 = 1; + // 2 violations above: + // 'Line contains a tab character.' + // ''method def' child has incorrect indentation level 16, expected level should be 4.' + int tab4 = 1; + // 2 violations above: + // 'Line contains a tab character.' + // ''method def' child has incorrect indentation level 16, expected level should be 4.' + int tab5 = 1; + // 2 violations above: + // 'Line contains a tab character.' + // ''method def' child has incorrect indentation level 8, expected level should be 4.' + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/InputIllegalTokenText.java b/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/InputIllegalTokenText.java deleted file mode 100644 index 65fed9d85db..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter2filebasic/rule232specialescape/InputIllegalTokenText.java +++ /dev/null @@ -1,166 +0,0 @@ -package com.google.checkstyle.test.chapter2filebasic.rule232specialescape; - -/** - * Test for illegal tokens - */ -public class InputIllegalTokenText -{ - - public void methodWithLiterals() - { - final String ref = " <- - // Contains trailing whitespace -> - - // Name format tests - // - /** Invalid format **/ - public static final int badConstant = 2; - /** Valid format **/ - public static final int MAX_ROWS = 2; - - /** Invalid format **/ - private static int badStatic = 2; - /** Valid format **/ - private static int sNumCreated = 0; - - /** Invalid format **/ - private int badMember = 2; - /** Valid format **/ - private int mNumCreated1 = 0; - /** Valid format **/ - protected int mNumCreated2 = 0; - - /** commas are wrong **/ - private int[] mInts = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; //warn - - /** - * Very long url: https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java - */ - public void fooMethod() {} - - /** - * Long url without wrapping: http://ftp.dlink.ru/pub/D-Link_Solutions/D-Link_Solutions_for_Business.pdf - */ - public void fooMethodLongFtp() {} - - public void fooLongStringUrl() { - String url = "https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java"; //ok - processUrl("https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java"); //ok - processUrl("some line" - + "https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java" //ok - + "+ long fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo00000000000o line"); //warn - processUrl("Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line"); //warn - String[] soooooooooooooooooooooooooooooooooooolongfooooooooooooooooooooooooooooooooooooooooooo = { //warn - "http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java", //ok - "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line", //warn - }; - - String fakehttps = "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line"; //warn - - processUrl(new String[] { - "http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java", //ok - "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line", //warn - }); - - String s = "text" - + "text" - + "text something more.. long url name, long url name, long url name" //ok - + "other text"; - } - - /** - * - * @param url - */ - public void processUrl(String url) {} - - /** - * - * @param urls - */ - public void processUrl(String[] urls){} -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule32packagestatement/InputPackageStatement.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule32packagestatement/InputPackageStatement.java new file mode 100644 index 00000000000..333b9537e30 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule32packagestatement/InputPackageStatement.java @@ -0,0 +1,15 @@ +package com.google.checkstyle.test. // violation 'package statement should not be line-wrapped.' + chapter3filestructure.rule32packagestatement; + +/** some javadoc. */ +public class InputPackageStatement { + // Long line + // ----------------------------------------------------------------------------------------------------- + // violation above 'Line is longer than 100 characters (found 106).' + + private int[] testing = + new int[] { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/InputAvoidStarImport.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/InputAvoidStarImport.java deleted file mode 100644 index 386dbb03fe8..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/InputAvoidStarImport.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule331nowildcard; - -import java.io.*; //warn -import java.lang.*; //warn -import java.lang.String; -import java.sql.Connection; -import java.util.List; -import java.util.List; -import java.util.Iterator; -import java.util.Enumeration; -import java.util.Arrays; -import javax.swing.JToolBar; -import javax.swing.JToggleButton; -import javax.swing.ScrollPaneLayout; -import javax.swing.BorderFactory; -import static java.io.File.listRoots; - -import static javax.swing.WindowConstants.*; //warn -import static javax.swing.WindowConstants.*; //warn -import static java.io.File.createTempFile; -import java.awt.Component; -import java.awt.Graphics2D; -import java.awt.HeadlessException; -import java.awt.Label; -import java.util.Date; -import java.util.Calendar; -import java.util.BitSet; - -class InputAvoidStarImport {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/InputNoWildcardImports.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/InputNoWildcardImports.java new file mode 100644 index 00000000000..8c52cb92b60 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule331nowildcard/InputNoWildcardImports.java @@ -0,0 +1,31 @@ +package com.google.checkstyle.test.chapter3filestructure.rule331nowildcard; + +import static java.io.File.createTempFile; +import static java.io.File.listRoots; +import static javax.swing.WindowConstants.*; +// violation above '.* '.*' form of import should be avoided - javax.swing.WindowConstants.*.' +import static javax.swing.WindowConstants.*; +// violation above '.* '.*' form of import should be avoided - javax.swing.WindowConstants.*.' + +import java.awt.Component; +import java.awt.Graphics2D; +import java.awt.HeadlessException; +import java.awt.Label; +import java.io.*; // violation 'Using the '.*' form of import should be avoided - java.io.*.' +import java.lang.*; // violation 'Using the '.*' form of import should be avoided - java.lang.*.' +import java.lang.String; +import java.sql.Connection; +import java.util.Arrays; +import java.util.BitSet; +import java.util.Calendar; +import java.util.Date; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; +import java.util.List; +import javax.swing.BorderFactory; +import javax.swing.JToggleButton; +import javax.swing.JToolBar; +import javax.swing.ScrollPaneLayout; + +class InputNoWildcardImports {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputFormattedNoLineWrapping.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputFormattedNoLineWrapping.java new file mode 100644 index 00000000000..b37477fa174 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputFormattedNoLineWrapping.java @@ -0,0 +1,24 @@ +package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; + +// ok, long imports are allowed +import com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule.PackageStatementTest; + +/** Some javadoc. */ +public class InputFormattedNoLineWrapping { + + public void fooMethod() { + // + } + + // Long line + // -------------------------------------------------------------------------------------------------- + // violation above 'Line is longer than 100 characters (found 103).' + + private int[] testing = + new int[] { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + + PackageStatementTest packageStatementTest = new PackageStatementTest(); +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputLineLength.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputLineLength.java deleted file mode 100644 index d5f12de9a84..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputLineLength.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; //ok -import com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule.*; //ok -final class InputLineLength -{ - // Long line ---------------------------------------------------------------------------------------- //warn - // Contains a tab -> <- - // Contains trailing whitespace -> - - // Name format tests - // - /** Invalid format **/ - public static final int badConstant = 2; - /** Valid format **/ - public static final int MAX_ROWS = 2; - - /** Invalid format **/ - private static int badStatic = 2; - /** Valid format **/ - private static int sNumCreated = 0; - - /** Invalid format **/ - private int badMember = 2; - /** Valid format **/ - private int mNumCreated1 = 0; - /** Valid format **/ - protected int mNumCreated2 = 0; - - /** commas are wrong **/ - private int[] mInts = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, }; //warn - - // - // Accessor tests - // - /** should be private **/ - public static int sTest1; - /** should be private **/ - protected static int sTest3; - /** should be private **/ - static int sTest2; - - /** should be private **/ - int mTest1; - /** should be private **/ - public int mTest2; - - // - // Parameter name format tests - // - - /** - * @return hack - * @param badFormat1 bad format - * @param badFormat2 bad format - * @param badFormat3 bad format - * @throws java.lang.Exception abc - **/ - int test1(int badFormat1,int badFormat2, - final int badFormat3) - throws java.lang.Exception - { - return 0; - } - - /** method that is 20 lines long **/ - private void longMethod() - { - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - } - - /** constructor that is 10 lines long **/ - private InputLineLength() - { - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - } - - /** test local variables */ - private void localVariables() - { - // normal decl - int abc = 0; - int ABC = 0; - - // final decls - final int cde = 0; - final int CDE = 0; - - // decl in for loop init statement - for (int k = 0; k < 1; k++) - { - String innerBlockVariable = ""; - } - for (int I = 0; I < 1; I++) - { - String InnerBlockVariable = ""; - } - } - - /** test method pattern */ - void ALL_UPPERCASE_METHOD() - { - } - - /** test illegal constant **/ - private static final int BAD__NAME = 3; - - // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" - // long line that has a tab -> <- and would be OK if tab counted as 1 char - // tabs that count as one char because of their position -> <- -> <-, OK - - /** some lines to test the column after tabs */ - void violateColumnAfterTabs() - { - // with tab-width 8 all statements below start at the same column, - // with different combinations of ' ' and '\t' before the statement - int tab0 =1; - int tab1 =1; - int tab2 =1; - int tab3 =1; - int tab4 =1; - int tab5 =1; - } - - // MEMME: - /* MEMME: a - * MEMME: - * OOOO - */ - /* NOTHING */ - /* YES */ /* MEMME: x */ /* YES!! */ - - /** test long comments **/ - void veryLong() - { - /* - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - enough talk */ - } - - /** - * @see to lazy to document all args. Testing excessive # args - **/ - void toManyArgs(int aArg1, int aArg2, int aArg3, int aArg4, int aArg5, - int aArg6, int aArg7, int aArg8, int aArg9) - { - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapBad.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapBad.java deleted file mode 100644 index 8663ba4689b..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapBad.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.google.checkstyle.test. //warn - chapter3filestructure.rule332nolinewrap; - -import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; //ok - -import javax.accessibility. //warn - AccessibleAttributeSequence; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; //ok - -import static java.math. //warn - BigInteger.ONE; - -public class - InputNoLineWrapBad { - - public void - fooMethod() { - final int - foo = 0; - } -} - -enum - FooFoo { -} - -interface - InterFoo {} - diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapGood.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapGood.java deleted file mode 100644 index 50b28664ecb..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapGood.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; //ok - -import static java.math.BigInteger.ZERO; //ok - -import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; //ok -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; //ok -import javax.accessibility.AccessibleAttributeSequence; //ok - -public class InputNoLineWrapGood { - - public void fooMethod() { - // - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapping.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapping.java new file mode 100644 index 00000000000..77e22925f14 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule332nolinewrap/InputNoLineWrapping.java @@ -0,0 +1,35 @@ +package com.google.checkstyle.test.chapter3filestructure.rule332nolinewrap; + +import static java.math. // violation 'import statement should not be line-wrapped.' + BigInteger.ONE; +import static java.math.BigInteger.ZERO; // ok + +// ok, long imports are allowed +import com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule.PackageStatementTest; +import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; // ok +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; // ok +import java.util.concurrent.atomic // violation 'import statement should not be line-wrapped.' + .AtomicMarkableReference; +import javax.accessibility.AccessibleAttributeSequence; // ok +import javax.accessibility. // violation 'import statement should not be line-wrapped.' + AccessibleAttributeSequence; + +/** Some javadoc. */ +public class InputNoLineWrapping { + + public void fooMethod() { + // + } + + // Long line + // -------------------------------------------------------------------------------------------------- + // violation above 'Line is longer than 100 characters (found 103).' + + private int[] testing = + new int[] { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 + }; + + PackageStatementTest packageStatementTest = new PackageStatementTest(); +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder1.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder1.java deleted file mode 100644 index a79d8682eef..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder1.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import static java.io.File.createTempFile; -import static java.awt.Button.ABORT; //warn -import static javax.swing.WindowConstants.*; -import java.awt.Button; //warn -import java.awt.Frame; -import java.awt.Dialog; //warn -import java.awt.event.ActionEvent; -import javax.swing.JComponent; -import javax.swing.JTable; -import java.io.File; //warn -import java.io.IOException; //warn -import java.io.InputStream; //warn -import java.io.Reader; //warn - -import com.google.common.base.Ascii; //warn - -public class InputCustomImportOrder1 {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder2.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder2.java deleted file mode 100644 index 3f5497a947c..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder2.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import static java.io.File.createTempFile; -import static java.awt.Button.ABORT; //warn -import static javax.swing.WindowConstants.*; - -import java.util.List; -import java.util.StringTokenizer; -import java.util.*; //warn -import java.util.concurrent.AbstractExecutorService; -import java.util.concurrent.*; //warn - -import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; //warn -import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*; //warn - -import com.google.common.reflect.*; //warn - -public class InputCustomImportOrder2 { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder3.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder3.java deleted file mode 100644 index c2f317f4ad9..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder3.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import static java.awt.Button.ABORT; -import java.awt.Dialog; //warn -import static javax.swing.WindowConstants.*; //warn - -import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; //warn -import com.google.common.reflect.*; //warn -import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*; //warn -import java.io.File; -import static java.io.File.createTempFile; //warn -import java.util.StringTokenizer; -import java.util.*; //warn -import java.util.concurrent.AbstractExecutorService; -import java.util.concurrent.*; //warn - -public class InputCustomImportOrder3 { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder4.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder4.java deleted file mode 100644 index aaf66e72c0b..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder4.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import static java.awt.Button.ABORT; -import static java.io.File.createTempFile; - - -import static javax.swing.WindowConstants.*; //warn - -import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; -import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*; -import com.google.common.reflect.*; -import java.util.List; - - -import java.util.StringTokenizer; //warn - -import java.util.concurrent.AbstractExecutorService; // warn - -public class InputCustomImportOrder4 { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder5.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder5.java deleted file mode 100644 index 55aa52769e6..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrder5.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import static java.awt.Button.ABORT; -import static java.io.File.createTempFile; -// comments - - -// comments -import static javax.swing.WindowConstants.*; //warn - -// comments - -import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; //warn -import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*; -// comments - -import com.google.common.reflect.*; //warn -import java.util.List; - -// comments -import java.util.StringTokenizer; //warn -// comments - -// comments -import java.util.concurrent.AbstractExecutorService; //warn - -public class InputCustomImportOrder5 { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderNoImports.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderNoImports.java deleted file mode 100644 index 6b3051f7c53..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderNoImports.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -public class InputCustomImportOrderNoImports { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderValid.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderValid.java deleted file mode 100644 index befffe891e7..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderValid.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; -// it is not forbidden to have extra lines (more than one) between package and import group - - -import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.containsAnnotation; -import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.getAnnotation; - -import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; -import com.puppycrawl.tools.checkstyle.checks.design.ThrowsCountCheck; -import com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck; -import java.util.Arrays; -import java.util.BitSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.NoSuchElementException; -import javax.accessibility.Accessible; -import org.apache.commons.beanutils.converters.ArrayConverter; - -public class InputCustomImportOrderValid { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderValid2.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderValid2.java deleted file mode 100644 index 30be0597af2..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputCustomImportOrderValid2.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; - -import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.containsAnnotation; -import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.getAnnotation; -// comments - -// comments -import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; -import com.puppycrawl.tools.checkstyle.checks.design.ThrowsCountCheck; -import com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck; -import java.util.Arrays; -// comments -import java.util.BitSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.NoSuchElementException; -import javax.accessibility.Accessible; -import org.apache.commons.beanutils.converters.ArrayConverter; - -public class InputCustomImportOrderValid2 { -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing1.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing1.java new file mode 100644 index 00000000000..068b9eb46df --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing1.java @@ -0,0 +1,31 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import static java.io.File.createTempFile; +import static java.awt.Button.ABORT; +// violation above '.* 'java.awt.Button.ABORT' .* Should be before 'java.io.File.createTempFile'.' +import static javax.swing.WindowConstants.*; +// violation above 'Using the '.*' form of import should be avoided' +import java.awt.Button; +// violation above ''java.awt.Button' should be separated from previous import group by one line.' +import java.awt.Frame; +import java.awt.Dialog; +// violation above '.* 'java.awt.Dialog' .* Should be before 'java.awt.Frame'.' +import java.awt.event.ActionEvent; +import javax.swing.JComponent; +import javax.swing.JTable; +import java.io.File; +// violation above '.* 'java.io.File' .* Should be before 'javax.swing.JTable'.' +import java.io.IOException; +// violation above '.* 'java.io.IOException' .* Should be before 'javax.swing.JTable'.' +import java.io.InputStream; +// violation above '.* 'java.io.InputStream' .* Should be before 'javax.swing.JTable'.' +import java.io.Reader; +// violation above '.* 'java.io.Reader' .* Should be before 'javax.swing.JTable'.' + +import com.google.common.base.Ascii; +// 2 violations above: +// 'Extra separation in import group before 'com.google.common.base.Ascii'' +// '.* 'com.google.common.base.Ascii' .* Should be before 'javax.swing.JTable'.' + +/** Some javadoc. */ +public class InputOrderingAndSpacing1 {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing2.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing2.java new file mode 100644 index 00000000000..2b5b6018460 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing2.java @@ -0,0 +1,41 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import static java.io.File.createTempFile; +import static java.awt.Button.ABORT; +// violation above '.* 'java.awt.Button.ABORT' .* Should be before 'java.io.File.createTempFile'.' +import static javax.swing.WindowConstants.*; +// violation above 'Using the '.*' form of import should be avoided' + +import java.util.List; +import java.util.StringTokenizer; +import java.util.*; +// 2 violations above: +// '.* 'java.util.*' .* Should be before 'java.util.StringTokenizer'.' +// 'Using the '.*' form of import should be avoided' +import java.util.concurrent.AbstractExecutorService; +import java.util.concurrent.*; +// 2 violations above: +// '.* Should be before 'java.util.concurrent.AbstractExecutorService'.' +// 'Using the '.*' form of import should be avoided' + +import com.google.checkstyle.test.chapter2filebasic.rule21filename.*; +// 3 violations above: +// 'Extra separation in import group before .*' +// '.* Should be before 'java.util.concurrent.AbstractExecutorService'.' +// 'Using the '.*' form of import should be avoided' + +import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.*; +// 3 violations above: +// 'Extra separation in import group before .*' +// '.* Should be before 'java.util.concurrent.AbstractExecutorService'.' +// 'Using the '.*' form of import should be avoided' + +import com.google.common.reflect.*; +// 3 violations above: +// 'Extra separation in import group before 'com.google.common.reflect.*'' +// '.* Should be before 'java.util.concurrent.AbstractExecutorService'.' +// 'Using the '.*' form of import should be avoided' + +/** Some javadoc. */ +public class InputOrderingAndSpacing2 { +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing3.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing3.java new file mode 100644 index 00000000000..5a30c6c8f51 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing3.java @@ -0,0 +1,29 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import static java.awt.Button.ABORT; +import java.awt.Dialog; +// violation above ''java.awt.Dialog' should be separated from previous import group by one line.' +import static javax.swing.WindowConstants.EXIT_ON_CLOSE; +// violation above '.*'javax.swing.WindowConstants.*' .* wrong order. Should be in the 'STATIC' .*' + +import com.google.checkstyle.test.chapter2filebasic.rule21filename.FileNameTest; +// 2 violations above: +// 'Extra separation in import group before .*' +// '.* Should be before 'java.awt.Dialog'.' +import com.google.common.reflect.ImmutableTypeToInstanceMap; +// violation above '.* Should be before 'java.awt.Dialog'.' +import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.SourceFileStructureTest; +// violation above '.* Should be before 'java.awt.Dialog'.' +import java.io.File; +import static java.io.File.createTempFile; +// violation above '.*'java.io.File.createTempFile' .* wrong order. Should be in the 'STATIC' .*' +import java.util.StringTokenizer; +import java.util.LinkedHashMap; +// violation above '.* 'java.util.LinkedHashMap' .* Should be before 'java.util.StringTokenizer'.' +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.AbstractExecutorService; +// violation above '.* Should be before 'java.util.concurrent.ThreadFactory'.' + +/** Some javadoc. */ +public class InputOrderingAndSpacing3 { +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing4.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing4.java new file mode 100644 index 00000000000..f5fd342113e --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing4.java @@ -0,0 +1,24 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import static java.io.File.createTempFile; +import static java.awt.Button.ABORT; +// violation above '.* 'java.awt.Button.ABORT' .* Should be before 'java.io.File.createTempFile'.' + +import static javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE; +// violation above 'Extra separation .* before 'javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE'' + +import com.google.checkstyle.test.chapter2filebasic.rule21filename.FileNameTest; +import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.SourceFileStructureTest; +import com.google.common.reflect.Invokable; +import java.util.List; + + +import java.util.StringTokenizer; +// violation above 'Extra separation in import group before 'java.util.StringTokenizer'' + +import java.util.concurrent.AbstractExecutorService; +// violation above 'Extra separation .* before 'java.util.concurrent.AbstractExecutorService'' + +/** Some javadoc. */ +public class InputOrderingAndSpacing4 { +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing5.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing5.java new file mode 100644 index 00000000000..a6880ff4496 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacing5.java @@ -0,0 +1,34 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import static java.awt.Button.ABORT; +import static java.io.File.createTempFile; +// comments + + +// comments +import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; +// violation above 'Extra separation .* before 'javax.swing.WindowConstants.DISPOSE_ON_CLOSE'' + +// comments + +import com.google.checkstyle.test.chapter2filebasic.rule21filename.InputFileName1; +// violation above ''com.google.checkstyle.test.*' should be separated .* by one line.' +import com.google.checkstyle.test.chapter3filestructure.rule3sourcefile.SourceFileStructureTest; +// comments + +import com.google.common.reflect.TypeToken; +// violation above 'Extra separation in import group before 'com.google.common.reflect.*'' +import java.util.List; + +// comments +import java.util.StringTokenizer; +// violation above 'Extra separation in import group before 'java.util.StringTokenizer'' +// comments + +// comments +import java.util.concurrent.AbstractExecutorService; +// violation above 'Extra separation .* before 'java.util.concurrent.AbstractExecutorService'' + +/** Some javadoc. */ +public class InputOrderingAndSpacing5 { +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingNoImports.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingNoImports.java new file mode 100644 index 00000000000..83b5aa4da7a --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingNoImports.java @@ -0,0 +1,4 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +/** Some javadoc. */ +public class InputOrderingAndSpacingNoImports {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingValid.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingValid.java new file mode 100644 index 00000000000..9d393d2a277 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingValid.java @@ -0,0 +1,22 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +// it is not forbidden to have extra lines (more than one) between package and import group + + +import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.containsAnnotation; +import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.getAnnotation; + +import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; +import com.puppycrawl.tools.checkstyle.checks.design.ThrowsCountCheck; +import com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck; +import java.util.Arrays; +import java.util.BitSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.NoSuchElementException; +import javax.accessibility.Accessible; +import org.apache.commons.beanutils.converters.ArrayConverter; + +/** Some javadoc. */ +public class InputOrderingAndSpacingValid { +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingValid2.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingValid2.java new file mode 100644 index 00000000000..192c52b12d7 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule333orderingandspacing/InputOrderingAndSpacingValid2.java @@ -0,0 +1,22 @@ +package com.google.checkstyle.test.chapter3filestructure.rule333orderingandspacing; + +import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.containsAnnotation; +import static com.puppycrawl.tools.checkstyle.utils.AnnotationUtil.getAnnotation; +// comments + +// comments +import com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck; +import com.puppycrawl.tools.checkstyle.checks.design.ThrowsCountCheck; +import com.puppycrawl.tools.checkstyle.checks.design.VisibilityModifierCheck; +import java.util.Arrays; +// comments +import java.util.BitSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.NoSuchElementException; +import javax.accessibility.Accessible; +import org.apache.commons.beanutils.converters.ArrayConverter; + +/** Some javadoc. */ +public class InputOrderingAndSpacingValid2 { +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad1.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad1.java index 63b1a32bb02..ae476634e91 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad1.java +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad1.java @@ -1,5 +1,9 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; -class InputOneTopLevelClassBad1 {} //ok -enum FooEnum {} // warn +class InputOneTopLevelClassBad1 {} // ok + +// violation below 'Top-level class FooEnum has to reside in its own source file.' +enum FooEnum {} + +// violation below 'Top-level class FooAt has to reside in its own source file.' @interface FooAt {} // warn diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad2.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad2.java index 5e442eb451c..88bd45b6317 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad2.java +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBad2.java @@ -1,9 +1,10 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; -public enum InputOneTopLevelClassBad2 {} //ok +/** Some javadoc. */ +public enum InputOneTopLevelClassBad2 {} // ok -interface FooIn {} // warn +// violation below 'Top-level class FooIn has to reside in its own source file.' +interface FooIn {} +// violation below 'Top-level class FooClass has to reside in its own source file.' class FooClass {} // warn - - diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBasic.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBasic.java index 14c87159e29..8bfbc106afe 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBasic.java +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassBasic.java @@ -1,88 +1,84 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; -public class InputOneTopLevelClassBasic -{ - public InputOneTopLevelClassBasic() throws CloneNotSupportedException - { - super.equals(new String()); - super.clone(); - } - public Object clone() throws CloneNotSupportedException - { - return super.clone(); - } +/** Some javadoc. */ +public class InputOneTopLevelClassBasic { + public InputOneTopLevelClassBasic() throws CloneNotSupportedException { + super.equals(new String()); + super.clone(); + } - public void method() throws CloneNotSupportedException - { - super.clone(); - } + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } - { - super.clone(); - } + public void method() throws CloneNotSupportedException { + super.clone(); + } + + { + super.clone(); + } } -class NoSuperClone //warn -{ - public Object clone() - { - return null; - } +// violation below 'Top-level class NoSuperClone has to reside in its own source file.' +class NoSuperClone { + public Object clone() { + return null; + } } -class InnerClone //warn -{ - public Object clone() - { - class Inner - { - public Object clone() throws CloneNotSupportedException - { - return super.clone(); - } - } - return null; +// violation below 'Top-level class InnerClone has to reside in its own source file.' +class InnerClone { + public Object clone() { + class Inner { + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } } + + return null; + } } // This could not pass as valid semantically but tests that // type arguments are ignored when checking super calls -class CloneWithTypeArguments //warn -{ - //Some code +// violation below 'Top-level class CloneWithTypeArguments has to reside in its own source file.' +class CloneWithTypeArguments { + // Some code } -class CloneWithTypeArgumentsAndNoSuper //warn -{ -} +// violation below '.* class CloneWithTypeArgumentsAndNoSuper has to reside in .* own source file.' +class CloneWithTypeArgumentsAndNoSuper {} -//Check that super keyword isn't snagged here -class MyClassWithGenericSuperMethod //warn -{ - void someMethod(java.util.List l) - { - //Some code - } +// Check that super keyword isn't snagged here +// violation below '.* class MyClassWithGenericSuperMethod has to reside in its own source file.' +class MyClassWithGenericSuperMethod { + void someMethod(java.util.List l) { + // Some code + } - /** - * Not a valid clone override. Should not get flagged. - * @param o some object - * @return a cloned Object? - */ - public static Object clone(Object o) { + /** + * Not a valid clone override. Should not get flagged. + * + * @param o some object + * @return a cloned Object? + */ + public static Object clone(Object o) { return null; - } + } } -class AnotherClass { //warn +// violation below 'Top-level class AnotherClass has to reside in its own source file.' +class AnotherClass { - /** - * Not a valid clone override. Should not get flagged. - * @param t some type - * @param a type - * @return a cloned type? - */ - public T clone(T t) { + /** + * Not a valid clone override. Should not get flagged. + * + * @param t some type + * @param a type + * @return a cloned type? + */ + public T clone(T t) { return null; - } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassGood.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassGood.java index 43a0f2dbc02..24c4f31ebbd 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassGood.java +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule341onetoplevel/InputOneTopLevelClassGood.java @@ -1,23 +1,21 @@ package com.google.checkstyle.test.chapter3filestructure.rule341onetoplevel; -public class InputOneTopLevelClassGood //ok -{ - public InputOneTopLevelClassGood() throws CloneNotSupportedException - { - super.equals(new String()); - super.clone(); - } - public Object clone() throws CloneNotSupportedException - { - return super.clone(); - } +/** Some javadoc. */ +public class InputOneTopLevelClassGood { // ok + public InputOneTopLevelClassGood() throws CloneNotSupportedException { + super.equals(new String()); + super.clone(); + } - public void method() throws CloneNotSupportedException - { - super.clone(); - } + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } - { - super.clone(); - } + public void method() throws CloneNotSupportedException { + super.clone(); + } + + { + super.clone(); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadMethodsDeclarationOrder.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadMethodsDeclarationOrder.java deleted file mode 100644 index 76cdf5f399b..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadMethodsDeclarationOrder.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.rule3421overloadsplit; - -class InputOverloadMethodsDeclarationOrder -{ - public void overloadMethod(int i) - { - //some foo code - } - - public void overloadMethod(String s) - { - //some foo code - } - - public void overloadMethod(boolean b) - { - //some foo code - } - - public void fooMethod() - { - - } - - //violation because overloads never split - public void overloadMethod(String s, Boolean b, int i) //warn - { - //some foo code - } - - InputOverloadMethodsDeclarationOrder anonymous = new InputOverloadMethodsDeclarationOrder() - { - public void overloadMethod(int i) - { - //some foo code - } - - public void overloadMethod(String s) - { - //some foo code - } - - public void overloadMethod(boolean b) - { - //some foo code - } - - public void fooMethod() - { - - } - - //violation because overloads never split - public void overloadMethod(String s, Boolean b, int i) //warn - { - //some foo code - } - }; -} - -interface Fooable -{ - public abstract void foo(int i); - public abstract void foo(String s); - public abstract void noFoo(); - public abstract void foo(String s, Boolean b, int i); //warn -} - -enum FooType { - Strategy(""), - Shooter(""), - RPG(""); - - private String description; - - private FooType(String description) { - this.description = description; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public void overloadMethod(int i) - { - //some foo code - } - - public void overloadMethod(String s) - { - //some foo code - } - - public void overloadMethod(boolean b) - { - //some foo code - } - - public void fooMethod() - { - - } - - //violation because overloads never split - public void overloadMethod(String s, Boolean b, int i) //warn - { - //some foo code - } -} - diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadsNeverSplit.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadsNeverSplit.java new file mode 100644 index 00000000000..6ebbeb85fbe --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3421overloadsplit/InputOverloadsNeverSplit.java @@ -0,0 +1,236 @@ +package com.google.checkstyle.test.chapter3filestructure.rule3421overloadsplit; + +/** Testing. */ +public class InputOverloadsNeverSplit { + + int abc; + + int bcd; + + void foo() {} + + InputOverloadsNeverSplit() {} + + InputOverloadsNeverSplit(String a) {} + + void foo2() {} + + InputOverloadsNeverSplit(int a) {} + + // violation 2 lines above 'Constructors should be grouped together.*' + + int abcd; + + InputOverloadsNeverSplit(double x) {} + + // violation 2 lines above 'Constructors should be grouped together.*' + + private enum InnerEnum1 { + one; + + int xyz; + + InnerEnum1() {} + + InnerEnum1(String f) {} + + String str; + + String str2; + + InnerEnum1(int x) {} // violation 'Constructors should be grouped together.*' + + private abstract class Inner { + Inner() {} + + int xyz; + + String neko; + + Inner(String g) {} // violation 'Constructors should be grouped together.*' + } + + InnerEnum1(double d) {} // violation 'Constructors should be grouped together.*' + } + + InputOverloadsNeverSplit(float x) {} + + // violation 2 lines above 'Constructors should be grouped together.*' + + InputOverloadsNeverSplit(long l) {} + + // violation 2 lines above 'Constructors should be grouped together.*' + + private class Inner { + Inner() {} + + Inner(String str) {} + + // Comments are allowed between constructors. + Inner(int x) {} + } + + private class Inner2 { + Inner2() {} + + Inner2(String str) {} + + int xyz; + + Inner2(int x) {} // violation 'Constructors should be grouped together.*' + + String xx; + + Inner2(double d) {} // violation 'Constructors should be grouped together.*' + + // violation below 'Constructors should be grouped together.*' + Inner2(float f) {} + } + + InputOverloadsNeverSplit(long l, double d) {} + + // violation 2 lines above 'Constructors should be grouped together.*' + + InputOverloadsNeverSplit annoynmous = + new InputOverloadsNeverSplit() { + int xyz; + + void test() {} + + void test2() {} + }; + + private enum InnerEnum2 { + ONE, + TWO, + THREE; + + void test() {} + + void test2() {} + + void test3() {} + } + + private enum InnerEnum3 { + InnerEnum3() {} + } + + private enum InnerEnum4 {} + + private class Inner3 { + void test() {} + + void test2() {} + + void test3() {} + } + + private class Inner4 { + Inner4() {} + } + + private class Inner5 {} + + public void overloadMethod(int i) { + // some foo code + } + + public void overloadMethod(String s) { + // some foo code + } + + public void overloadMethod(boolean b) { + // some foo code + } + + public void fooMethod() {} + + // violation below 'All overloaded methods should be placed next to each other. .* '143'.' + public void overloadMethod(String s, Boolean b, int i) { + // some foo code + } + + InputOverloadsNeverSplit anonymous = + new InputOverloadsNeverSplit() { + public void overloadMethod(int i) { + // some foo code + } + + public void overloadMethod(String s) { + // some foo code + } + + public void overloadMethod(boolean b) { + // some foo code + } + + public void fooMethod() {} + + // violation below 'All overloaded methods should be placed next to each other. .* '164'.' + public void overloadMethod(String s, Boolean b, int i) { + // some foo code + } + }; + + public void testing() {} + + private void testing(int a) {} + + public void testing(int a, int b) {} + + public static void testing(String a) {} + + public void testing(String a, String b) {} + + interface Fooable { + public abstract void foo(int i); + + public abstract void foo(String s); + + public abstract void noFoo(); + + public abstract void foo(String s, Boolean b, int i); + // violation above 'All overloaded methods should be placed next to each other. .* '189'.' + + } + + enum FooType { + Strategy(""), + Shooter(""), + RPG(""); + + private String description; + + private FooType(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public void overloadMethod(int i) { + // some foo code + } + + public void overloadMethod(String s) { + // some foo code + } + + public void overloadMethod(boolean b) { + // some foo code + } + + public void fooMethod() {} + + // violation below 'All overloaded methods should be placed next to each other. .* '225'.' + public void overloadMethod(String s, Boolean b, int i) { + // some foo code + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputEmptyLineSeparator.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputEmptyLineSeparator.java deleted file mode 100644 index dc01bcb7528..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputEmptyLineSeparator.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter3filestructure.rule3sourcefile; //warn -import java.io.Serializable; //warn -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.Collections; -import java.util.Calendar; -import java.util.Set; - -import javax.swing.AbstractAction; - -import org.apache.commons.beanutils.locale.converters.ByteLocaleConverter; -class InputEmptyLineSeparator //warn -{ - public static final double FOO_PI = 3.1415; - private boolean flag = true; - static { //warn - //empty static initializer - } - - { - //empty instance initializer - } - - /** - * - * - * - */ - private InputEmptyLineSeparator() - { - //empty - } - - public int compareTo(InputEmptyLineSeparator aObject) - { - int number = 0; - return 0; - } - /** - * - * @param task - * @param result - * @return - */ - public static Callable callable(Runnable task, T result) // warn - { - return null; - } - - public int getBeastNumber() - { - return 666; - } - interface IntEnum { //warn - } - - class InnerClass { - - public static final double FOO_PI_INNER = 3.1415; - private boolean flagInner = true; - { //warn - //empty instance initializer - } - - private InnerClass() - { - //empty - } - - } - - class InnerClass2 { //ok - private InnerClass2() //ok - { - //empty - } - } - - class InnerClass3 { //ok - public int compareTo(InputEmptyLineSeparator aObject) //ok - { - int number = 0; - return 0; - } - - } -} - -class Class1 { //ok - private Class1() {} //ok -} -class Class2{ //warn - public int compareTo(InputEmptyLineSeparator aObject) //ok - { - int number = 0; - return 0; - } - Class2 anon = new Class2(){ //warn - public int compareTo(InputEmptyLineSeparator aObject) //ok - { - int number = 0; - return 0; - } - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputFormattedSourceFileStructure.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputFormattedSourceFileStructure.java new file mode 100644 index 00000000000..0714b878e71 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputFormattedSourceFileStructure.java @@ -0,0 +1,111 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// +package com.google.checkstyle.test.chapter3filestructure.rule3sourcefile; + +// violation 2 lines above ''package' should be separated from previous line.' + +import java.util.concurrent.Callable; + +class InputFormattedSourceFileStructure { + public static final double FOO_PI = 3.1415; + private boolean flag = true; + + static { + // empty static initializer + } + + { + // empty instance initializer + } + + /** Some javadoc... */ + private InputFormattedSourceFileStructure() { + // empty + } + + public int compareTo(InputFormattedSourceFileStructure obj) { + int number = 0; + return 0; + } + + /** + * Some javadoc... + * + * @param task some description.... + * @param result some description.... + * @return some description.... + */ + public static Callable callable(Runnable task, T result) { + return null; + } + + public int getBeastNumber() { + return 666; + } + + interface IntEnum {} + + class InnerClass { + + public static final double FOO_PI_INNER = 3.1415; + private boolean flagInner = true; + + { + // empty instance initializer + } + + private InnerClass() { + // empty + } + } + + class InnerClass2 { // ok + private InnerClass2() { // ok + // empty + } + } + + class InnerClass3 { // ok + public int compareTo(InputSourceFileStructure obj) { // ok + int number = 0; + return 0; + } + } +} + +// violation below 'Top-level class ExtraClass1 has to reside in its own source file.' +class ExtraClass1 { // ok + private ExtraClass1() {} // ok +} + +class ExtraClass2 { + // violation above 'Top-level class ExtraClass2 has to reside in its own source file.' + public int compareTo(InputSourceFileStructure obj) { // ok + int number = 0; + return 0; + } + + Class2 anon = + new Class2() { + public int compareTo(InputSourceFileStructure obj) { // ok + int number = 0; + return 0; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputSourceFileStructure.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputSourceFileStructure.java new file mode 100644 index 00000000000..b93550bda15 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/rule3sourcefile/InputSourceFileStructure.java @@ -0,0 +1,107 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// +// violation below ''package' should be separated from previous line.' +package com.google.checkstyle.test.chapter3filestructure.rule3sourcefile; +import java.util.concurrent.Callable; // violation ''import' should be separated from previous line.' +class InputSourceFileStructure { // violation ''CLASS_DEF' should be separated from previous line.' + public static final double FOO_PI = 3.1415; + private boolean flag = true; + static { // violation ''STATIC_INIT' should be separated from previous line.' + // empty static initializer + } + + { + // empty instance initializer + } + + /** Some javadoc... */ + private InputSourceFileStructure() { + // empty + } + + public int compareTo(InputSourceFileStructure obj) { + int number = 0; + return 0; + } + /** + * Some javadoc... + * + * @param task some description.... + * @param result some description.... + * @return some description.... + */ + public static Callable callable(Runnable task, T result) { + // violation above ''METHOD_DEF' should be separated from previous line.' + return null; + } + + public int getBeastNumber() { + return 666; + } + interface IntEnum { + // violation above ''INTERFACE_DEF' should be separated from previous line.' + } + + class InnerClass { + + public static final double FOO_PI_INNER = 3.1415; + private boolean flagInner = true; + { // violation ''INSTANCE_INIT' should be separated from previous line.' + // empty instance initializer + } + + private InnerClass() { + // empty + } + } + + class InnerClass2 { // ok + private InnerClass2() { // ok + // empty + } + } + + class InnerClass3 { // ok + public int compareTo(InputSourceFileStructure obj) { // ok + int number = 0; + return 0; + } + } +} + +// violation below 'Top-level class Class1 has to reside in its own source file.' +class Class1 { // ok + private Class1() {} // ok +} +class Class2 { + // 2 violations above: + // 'Top-level class Class2 has to reside in its own source file.' + // 'CLASS_DEF' should be separated from previous line.' + public int compareTo(InputSourceFileStructure obj) { // ok + int number = 0; + return 0; + } + Class2 anon = // violation ''VARIABLE_DEF' should be separated from previous line.' + new Class2() { + public int compareTo(InputSourceFileStructure obj) { // ok + int number = 0; + return 0; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/InputLineLength.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/InputLineLength.java deleted file mode 100644 index 7f215f4ce86..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/InputLineLength.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule; // ok -import java.io.*; -final class InputLineLength -{ - // Long line ---------------------------------------------------------------------------------------- //warn - // Contains a tab -> <- - // Contains trailing whitespace -> - - // Name format tests - // - /** Invalid format **/ - public static final int badConstant = 2; - /** Valid format **/ - public static final int MAX_ROWS = 2; - - /** Invalid format **/ - private static int badStatic = 2; - /** Valid format **/ - private static int sNumCreated = 0; - - /** Invalid format **/ - private int badMember = 2; - /** Valid format **/ - private int mNumCreated1 = 0; - /** Valid format **/ - protected int mNumCreated2 = 0; - - /** commas are wrong **/ - private int[] mInts = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}; //warn - - /** - * Very long url: https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java - */ - public void fooMethod() {} - - /** - * Long url without wrapping: http://ftp.dlink.ru/pub/D-Link_Solutions/D-Link_Solutions_for_Business.pdf - */ - public void fooMethodLongFtp() {} - - public void fooLongStringUrl() { - String url = "https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java"; //ok - processUrl("https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java"); //ok - processUrl("some line" - + "https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java" //ok - + "+ long fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo00000000000o line"); //warn - processUrl("Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line"); //warn - String[] soooooooooooooooooooooooooooooooooooolongfooooooooooooooooooooooooooooooooooooooooooo = { //warn - "http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java", //ok - "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line", //warn - }; - - String fakehttps = "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line"; //warn - - processUrl(new String[] { - "http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java", //ok - "Some long foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo line", //warn - }); - - String s = "text" - + "text" - + "text something more.. long url name, long url name, long url name" //ok - + "other text"; - } - - /** - * - * @param url - */ - public void processUrl(String url) {} - - /** - * - * @param urls - */ - public void processUrl(String[] urls){} -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/InputPackageStatementLongName.java b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/InputPackageStatementLongName.java new file mode 100644 index 00000000000..c2b51834a26 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter3filestructure/toolongpackagetotestcoveragegooglesjavastylerule/InputPackageStatementLongName.java @@ -0,0 +1,3 @@ +package com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule; // ok + +final class InputPackageStatementLongName {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/InputNeedBraces.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/InputNeedBraces.java deleted file mode 100644 index 93673907a44..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule411bracesareused/InputNeedBraces.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule411bracesareused; - -import java.io.*; -import javax.script.*; -import java.util.concurrent.*; -import java.nio.channels.*; -import java.awt.print.*; -import java.lang.management.*; -import javax.lang.model.element.*; - -class InputNeedBraces -{ - /** @return helper func **/ - boolean condition() - { - return false; - } - - /** Test do/while loops **/ - void testDoWhile() - { - // Valid - do { - testDoWhile(); - } - while (condition()); - - // Invalid - do testDoWhile(); while (condition()); //warn - } - - /** Test while loops **/ - void testWhile() - { - // Valid - while (condition()) { - testWhile(); - } - - // Invalid - while(condition()); //warn - while (condition()) //warn - testWhile(); - while (condition()) //warn - if (condition()) //warn - testWhile(); - } - - /** Test for loops **/ - void testFor() - { - // Valid - for (int i = 1; i < 5; i++) { - testFor(); - } - - // Invalid - for(int i = 1;i < 5;i++); //warn - for (int i = 1; i < 5; i++) //warn - testFor(); - for (int i = 1; i < 5; //warn - i++) - if (i > 2) //warn - testFor(); - } - - /** Test if constructs **/ - public void testIf() - { - // Valid - if (condition()) { - testIf(); - } - else if (condition()) { - testIf(); - } - else { - testIf(); - } - - // Invalid - if (condition()); //warn - if (condition()) //warn - testIf(); - if (condition()) //warn - testIf(); - else //warn - testIf(); - if (condition()) //warn - testIf(); - else { - testIf(); - } - if (condition()) { - testIf(); - } - else //warn - testIf(); - if (condition()) //warn - if (condition()) //warn - testIf(); - } - - void whitespaceAfterSemi() - { - //reject - int i = 1;int j = 2; - - //accept - for (;;) { - } - } - - /** Empty constructor block. **/ - public InputNeedBraces() {} - - /** Empty method block. **/ - public void emptyImplementation() {} -} - -class EmptyBlocks { - boolean flag = true; - int[] a = {1, 2, 3, 4, }; - - void foo() { - while(flag); //warn - while(flag) {} - while(flag) {/*foo*/} - do; //warn - while(flag); - do {} - while(flag); - do {/*foo*/} - while(flag); - if(flag); //warn - if(flag){} - if(flag) {/*foo*/} - if(flag); //warn - else; //warn - if(flag){} - else {} - if(flag){/*foo*/} - else {/*foo*/} - for(int i = 0; i < 10; i++); //warn - for(int i = 0; i < 10; i++) {} - for(int i = 0; i < 10; i++) {/*foo*/} - for(int b : a); //warn - for(int b : a) {} - for(int b : a) {/*foo*/} - } - - class InnerEmptyBlocks { - boolean flag = true; - int[] a = {1, 2, 3, 4, }; - - void foo() { - while(flag); //warn - while(flag) {} - while(flag) {/*foo*/} - do; //warn - while(flag); - do {} - while(flag); - do {/*foo*/} - while(flag); - if(flag); //warn - if(flag){} - if(flag) {/*foo*/} - if(flag); //warn - else; //warn - if(flag){} - else {} - if(flag){/*foo*/} - else {/*foo*/} - for(int i = 0; i < 10; i++); //warn - for(int i = 0; i < 10; i++) {} - for(int i = 0; i < 10; i++) {/*foo*/} - for(int b : a); //warn - for(int b : a) {} - for(int b : a) {/*foo*/} - } - } - - InnerEmptyBlocks anon = new InnerEmptyBlocks() { - boolean flag = true; - int[] a = {1, 2, 3, 4, }; - - void foo() { - while(flag); //warn - while(flag) {} - while(flag) {/*foo*/} - do; //warn - while(flag); - do {} - while(flag); - do {/*foo*/} - while(flag); - if(flag); //warn - if(flag){} - if(flag) {/*foo*/} - if(flag); //warn - else; //warn - if(flag){} - else {} - if(flag){/*foo*/} - else {/*foo*/} - for(int i = 0; i < 10; i++); //warn - for(int i = 0; i < 10; i++) {} - for(int i = 0; i < 10; i++) {/*foo*/} - for(int b : a); //warn - for(int b : a) {} - for(int b : a) {/*foo*/} - } - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage/InputUseOfOptionalBraces.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage/InputUseOfOptionalBraces.java new file mode 100644 index 00000000000..e0f7bd4552d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule411optionalbracesusage/InputUseOfOptionalBraces.java @@ -0,0 +1,263 @@ +package com.google.checkstyle.test.chapter4formatting.rule411optionalbracesusage; + +class InputUseOfOptionalBraces { + /** + * some javadoc.. + * + * @return helper func * + */ + boolean condition() { + return false; + } + + /** Test do/while loops. */ + void testDoWhile() { + // Valid + do { + testDoWhile(); + } while (condition()); + + // Invalid + do testDoWhile(); // violation ''do' construct must use '{}'s.' + while (condition()); + } + + /** Test while loops. */ + void testWhile() { + // Valid + while (condition()) { + testWhile(); + } + + // Invalid + while (condition()); // violation ''while' construct must use '{}'s.' + while (condition()) // violation ''while' construct must use '{}'s.' + testWhile(); + while (condition()) // violation ''while' construct must use '{}'s.' + if (condition()) // violation ''if' construct must use '{}'s.' + testWhile(); + String k = "testing"; + if (k != null) k = "ss"; // violation ''if' construct must use '{}'s.' + } + + /** Test for loops. */ + void testFor() { + // Valid + for (int i = 1; i < 5; i++) { + testFor(); + } + + // Invalid + for (int i = 1; i < 5; i++); // violation ''for' construct must use '{}'s.' + for (int i = 1; i < 5; i++) // violation ''for' construct must use '{}'s.' + testFor(); + for (int i = 1; // violation ''for' construct must use '{}'s.' + i < 5; + i++) + if (i > 2) // violation ''if' construct must use '{}'s.' + testFor(); + } + + /** Test if constructs. */ + public void testIf() { + // Valid + if (condition()) { + testIf(); + } else if (condition()) { + testIf(); + } else { + testIf(); + } + + // Invalid + if (condition()); // violation ''if' construct must use '{}'s.' + if (condition()) // violation ''if' construct must use '{}'s.' + testIf(); + if (condition()) // violation ''if' construct must use '{}'s.' + testIf(); + else // violation ''else' construct must use '{}'s.' + testIf(); + if (condition()) // violation ''if' construct must use '{}'s.' + testIf(); + else { + testIf(); + } + if (condition()) { + testIf(); + } else // violation ''else' construct must use '{}'s.' + testIf(); + if (condition()) // violation ''if' construct must use '{}'s.' + if (condition()) // violation ''if' construct must use '{}'s.' + testIf(); + } + + void whitespaceAfterSemi() { + // reject + int i = 1; + int j = 2; + + // accept + for (; ; ) {} + } + + /** Empty constructor block. */ + public InputUseOfOptionalBraces() {} + + /** Empty method block. */ + public void emptyImplementation() {} + + /** Testing Lambdas. */ + static Runnable r2 = () -> String.CASE_INSENSITIVE_ORDER.equals("Hello world one!"); + + static Runnable r3 = () -> String.CASE_INSENSITIVE_ORDER.equals("Hello world one!"); + static Runnable r4 = + () -> { + String.CASE_INSENSITIVE_ORDER.equals("Hello world one!"); + }; + static Runnable r5 = () -> {}; + + class EmptyBlocks { + boolean flag = true; + int[] abc = { + 1, 2, 3, 4, + }; + + void foo() { + while (flag); // violation ''while' construct must use '{}'s.' + while (flag) {} + while (flag) { + /*foo*/ + } + do ; // violation ''do' construct must use '{}'s.' + while (flag); + do {} while (flag); + do { + /*foo*/ + } while (flag); + if (flag) ; // violation ''if' construct must use '{}'s.' + if (flag) { /*foo*/ } + if (flag) { + /*foo*/ + } + if (flag) ; // violation ''if' construct must use '{}'s.' + else ; // violation ''else' construct must use '{}'s.' + // violation below 'Empty if block.' + if (flag) { + } else { + } + // violation 2 lines above 'Empty else block.' + if (flag) { + /*foo*/ + } else { + /*foo*/ + } + for (int i = 0; i < 10; i++); // violation ''for' construct must use '{}'s.' + for (int i = 0; i < 10; i++) {} + for (int i = 0; i < 10; i++) { + /*foo*/ + } + for (int b : abc); // violation ''for' construct must use '{}'s.' + for (int b : abc) {} + for (int b : abc) { + /*foo*/ + } + } + + class InnerEmptyBlocks { + boolean flag = true; + int[] abc = { + 1, 2, 3, 4, + }; + + void foo() { + while (flag); // violation ''while' construct must use '{}'s.' + while (flag) {} + while (flag) { + /*foo*/ + } + do ; // violation ''do' construct must use '{}'s.' + while (flag); + do {} while (flag); + do { + /*foo*/ + } while (flag); + if (flag) ; // violation ''if' construct must use '{}'s.' + if (flag) { /*foo*/ } + if (flag) { + /*foo*/ + } + if (flag) ; // violation ''if' construct must use '{}'s.' + else ; // violation ''else' construct must use '{}'s.' + // violation below 'Empty if block.' + if (flag) { + } else { + } + // violation 2 lines above 'Empty else block.' + if (flag) { + /*foo*/ + } else { + /*foo*/ + } + for (int i = 0; i < 10; i++); // violation ''for' construct must use '{}'s.' + for (int i = 0; i < 10; i++) {} + for (int i = 0; i < 10; i++) { + /*foo*/ + } + for (int b : abc); // violation ''for' construct must use '{}'s.' + for (int b : abc) {} + for (int b : abc) { + /*foo*/ + } + } + } + + InnerEmptyBlocks anon = + new InnerEmptyBlocks() { + boolean flag = true; + int[] abc = { + 1, 2, 3, 4, + }; + + void foo() { + while (flag); // violation ''while' construct must use '{}'s.' + while (flag) {} + while (flag) { + /*foo*/ + } + do ; // violation ''do' construct must use '{}'s.' + while (flag); + do {} while (flag); + do { + /*foo*/ + } while (flag); + if (flag) ; // violation ''if' construct must use '{}'s.' + if (flag) { /*foo*/ } + if (flag) { + /*foo*/ + } + if (flag) ; // violation ''if' construct must use '{}'s.' + else ; // violation ''else' construct must use '{}'s.' + // violation below 'Empty if block.' + if (flag) { + } else { + } + // violation 2 lines above 'Empty else block.' + if (flag) { + /*foo*/ + } else { + /*foo*/ + } + for (int i = 0; i < 10; i++); // violation ''for' construct must use '{}'s.' + for (int i = 0; i < 10; i++) {} + for (int i = 0; i < 10; i++) { + /*foo*/ + } + for (int b : abc); // violation ''for' construct must use '{}'s.' + for (int b : abc) {} + for (int b : abc) { + /*foo*/ + } + } + }; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedLeftCurlyAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedLeftCurlyAnnotations.java new file mode 100644 index 00000000000..316d68318cc --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedLeftCurlyAnnotations.java @@ -0,0 +1,61 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.ArrayList; +import java.util.List; + +@TestClassAnnotation2 +class InputFormattedLeftCurlyAnnotations { + private static final int X = 10; + + @Override + public boolean equals(Object other) { + return false; + } + + @Override + @SuppressWarnings("unused") + public int hashCode() { + int a = 10; + return 1; + } + + @Override + @SuppressWarnings({"unused", "unchecked", "static-access"}) + public String toString() { + Integer i = this.X; + List l = new ArrayList(); + return "SomeString"; + } +} + +// violation below '.* InputFormattedLeftCurlyAnnotations2 has to reside in its own source file.' +@TestClassAnnotation2 +class InputFormattedLeftCurlyAnnotations2 { + private static final int X = 10; + + @Override + public boolean equals(Object other) { + return false; + } + + @Override + @SuppressWarnings("unused") + public int hashCode() { + int a = 10; + return 1; + } + + @Override + @SuppressWarnings({"unused", "unchecked", "static-access"}) + public String toString() { + Integer i = this.X; + List l = new ArrayList(); + return "SomeString"; + } +} + +// violation below 'Top-level class TestClassAnnotation2 has to reside in its own source file.' +@Target(ElementType.TYPE) +@interface TestClassAnnotation2 {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedLeftCurlyMethod.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedLeftCurlyMethod.java new file mode 100644 index 00000000000..6938dbd9c31 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedLeftCurlyMethod.java @@ -0,0 +1,55 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +class InputFormattedLeftCurlyMethod { + InputFormattedLeftCurlyMethod() {} + + InputFormattedLeftCurlyMethod(String one) {} + + InputFormattedLeftCurlyMethod(int one) {} + + void method1() {} + + void method2() {} + + void method3() {} + + void method4() {} + + void method5(String one, String two) {} + + void method6(String one, String two) {} + + enum InputLeftCurlyMethodEnum { + CONSTANT1("hello") { + void method1() {} + + void method2() {} + + void method3() {} + + void method4() {} + + void method5(String one, String two) {} + + void method6(String one, String two) {} + }, + + CONSTANT2("hello") {}, + + CONSTANT3("hellohellohellohellohellohellohellohellohellohellohellohellohellohello") {}; + + private InputLeftCurlyMethodEnum(String value) {} + + void method1() {} + + void method2() {} + + void method3() {} + + void method4() {} + + void method5(String one, String two) {} + + void method6(String one, String two) {} + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedNonemptyBlocksLeftRightCurly.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedNonemptyBlocksLeftRightCurly.java new file mode 100644 index 00000000000..50d28dae1a8 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedNonemptyBlocksLeftRightCurly.java @@ -0,0 +1,273 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +class InputFormattedNonemptyBlocksLeftRightCurly { + /** + * summary. + * + * @return helper func * + */ + boolean condition() { + return false; + } + + /** Test do/while loops. */ + void testDoWhile() { + + do { + testDoWhile(); + } while (condition()); + + do { + testDoWhile(); + } while (condition()); + } + + /** Test while loops. */ + void testWhile() { + + while (condition()) { + testWhile(); + } + + while (condition()) { + /* foo */ + } + while (condition()) { + testWhile(); + } + while (condition()) { + if (condition()) { + testWhile(); + } + } + } + + /** Test for loops. */ + void testFor() { + + for (int i = 1; i < 5; i++) { + testFor(); + } + + for (int i = 1; i < 5; i++) { + /* foo */ + } + for (int i = 1; i < 5; i++) { + testFor(); + } + for (int i = 1; i < 5; i++) { + if (i > 2) { + testFor(); + } + } + } + + /** Test if constructs. */ + public void testIf() { + + if (condition()) { + testIf(); + } else if (condition()) { + testIf(); + } else { + testIf(); + } + + if (condition()) { + /* foo */ + } + if (condition()) { + testIf(); + } + if (condition()) { + testIf(); + } else { + testIf(); + } + if (condition()) { + testIf(); + } else { + testIf(); + } + if (condition()) { + testIf(); + } else { + testIf(); + } + if (condition()) { + if (condition()) { + testIf(); + } + } + } + + void whitespaceAfterSemi() { + + int i = 1; + int j = 2; + + for (; ; ) {} + } + + /** Empty constructor block. */ + public InputFormattedNonemptyBlocksLeftRightCurly() {} + + /** Empty method block. */ + public void emptyImplementation() {} +} + +// violation below 'Top-level class EnumContainerLeft2 has to reside in its own source file.' +class EnumContainerLeft2 { + private enum Suit { + CLUBS, + HEARTS, + SPADES, + DIAMONDS + } // ok +} + +// violation below 'Top-level class WithArraysLeft2 has to reside in its own source file.' +class WithArraysLeft2 { // ok + String[] s1 = {""}; // ok + String[] empty = {}; // ok + String[] s2 = { // ok + "foo", "foo", + }; + String[] s3 = { // ok + "foo", "foo", + }; + String[] s4 = { // ok + "foo", "foo", + }; + String[] s5 = {"foo", "foo"}; // ok +} + +// violation below 'Top-level class InputRightCurlyOther22 has to reside in its own source file.' +class InputRightCurlyOther22 { + /** + * summary. + * + * @see test method * + */ + int foo() throws InterruptedException { + int x = 1; + int a = 2; + while (true) { + try { + if (x > 0) { + break; + } else if (x < 0) { // ok + + ; + } else { + break; + } // ok + switch (a) { + case 0: + break; + default: + break; + } // ok + } catch (Exception e) { + break; + } // ok + } // ok + + synchronized (this) { + do { + x = 2; + } while (x == 2); // ok + } // ok + + this.wait(666); // Bizarre, but legal + + for (int k = 0; k < 1; k++) { + String innerBlockVariable = ""; + } // ok + + if (System.currentTimeMillis() > 1000) { + return 1; + } else { + return 2; + } + } // ok + + static { + int x = 1; + } // ok + + /** some javadoc. */ + public enum GreetingsEnum { + HELLO, + GOODBYE + } // ok + + void method2() { + boolean flag = true; + if (flag) { + System.identityHashCode("heh"); + flag = !flag; + } + System.identityHashCode("Xe-xe"); + + if (flag) { + System.identityHashCode("some foo"); + } + } // ok +} // ok + +/** + * Test input for closing brace if that brace terminates a statement or the body of a constructor. + */ +// violation below 'Top-level class FooCtor2 has to reside in its own source file.' +class FooCtor2 { + int i3; + + public FooCtor2() { + i3 = 1; + } +} + +/** Test input for closing brace if that brace terminates a statement or the body of a method. */ +// violation below 'Top-level class FooMethod2 has to reside in its own source file.' +class FooMethod2 { + public void fooMethod() { + int i = 1; + } +} + +/** + * Test input for closing brace if that brace terminates a statement or the body of a named class. + */ +// violation below 'Top-level class FooInner2 has to reside in its own source file.' +class FooInner2 { + class InnerFoo { + public void fooInnerMethod() {} + } +} // ok + +// violation below 'Top-level class EnumContainer2 has to reside in its own source file.' +class EnumContainer2 { + private enum Suit { + CLUBS, + HEARTS, + SPADES, + DIAMONDS + } // ok +} + +// violation below 'Top-level class WithArrays2 has to reside in its own source file.' +class WithArrays2 { + String[] test = {""}; // ok + String[] empty = {}; // ok + String[] s1 = { + "foo", "foo", + }; // ok + String[] s2 = { + "foo", "foo", + }; // ok + String[] s3 = { + "foo", "foo", + }; // ok + String[] s4 = {"foo", "foo"}; // ok +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurly.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurly.java new file mode 100644 index 00000000000..a362195ec6e --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurly.java @@ -0,0 +1,14 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +/** some javadoc. */ +public class InputFormattedRightCurly { + /** some javadoc. */ + public static void main(String[] args) { + boolean after = false; + try { + /* foo */ + } finally { + after = true; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyDoWhile.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyDoWhile.java new file mode 100644 index 00000000000..13ee5dc6875 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyDoWhile.java @@ -0,0 +1,79 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +import java.util.Scanner; + +/** Test input for GitHub issue #3090. https://github.com/checkstyle/checkstyle/issues/3090 . */ +public class InputFormattedRightCurlyDoWhile { + + public void foo1() { + do {} while (true); + } + + /** some javadoc. */ + public void foo2() { + int i = 1; + while (i < 5) { + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + i++; + } + } + + /** some javadoc. */ + public void foo3() { + int i = 1; + do { + i++; + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + } while (i < 5); + } + + /** some javadoc. */ + public void foo4() { + int prog; + int user; + prog = (int) (Math.random() * 10) + 1; + Scanner input = new Scanner(System.in, "utf-8"); + if (input.hasNextInt()) { + do { + user = input.nextInt(); + if (user == prog) { + String.CASE_INSENSITIVE_ORDER.equals("Good!"); + } else { + if (user > 0 && user <= 10) { + String.CASE_INSENSITIVE_ORDER.equals("Bad! "); + if (prog < user) { + String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours."); + } else { + String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours"); + } + } else { + String.CASE_INSENSITIVE_ORDER.equals("Violation!"); + } + } + } while (user != prog); + } else { + String.CASE_INSENSITIVE_ORDER.equals("Violation!"); + } + String.CASE_INSENSITIVE_ORDER.equals("Goodbye!"); + } + + public void foo5() { + do {} while (true); + } + + public void foo6() { + do {} while (true); + } + + public void foo7() { + do {} while (true); + } + + public void foo8() { + do {} while (true); + } + + public void foo9() { + do {} while (true); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyDoWhile2.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyDoWhile2.java new file mode 100644 index 00000000000..c2c2bed5f25 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyDoWhile2.java @@ -0,0 +1,80 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +import java.nio.charset.StandardCharsets; +import java.util.Scanner; + +/** Test input for GitHub issue #3090. https://github.com/checkstyle/checkstyle/issues/3090 . */ +public class InputFormattedRightCurlyDoWhile2 { + + public void foo1() { + do {} while (true); + } + + /** some javadoc. */ + public void foo2() { + int i = 1; + while (i < 5) { + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + i++; + } + } + + /** some javadoc. */ + public void foo3() { + int i = 1; + do { + i++; + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + } while (i < 5); + } + + /** some javadoc. */ + public void foo4() { + int prog; + int user; + prog = (int) (Math.random() * 10) + 1; + Scanner input = new Scanner(System.in, StandardCharsets.UTF_8); + if (input.hasNextInt()) { + do { + user = input.nextInt(); + if (user == prog) { + String.CASE_INSENSITIVE_ORDER.equals("Good!"); + } else { + if (user > 0 && user <= 10) { + String.CASE_INSENSITIVE_ORDER.equals("Bad! "); + if (prog < user) { + String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours."); + } else { + String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours"); + } + } else { + String.CASE_INSENSITIVE_ORDER.equals("Violation!"); + } + } + } while (user != prog); + } else { + String.CASE_INSENSITIVE_ORDER.equals("Violation!"); + } + String.CASE_INSENSITIVE_ORDER.equals("Goodbye!"); + } + + public void foo5() { + do {} while (true); + } + + public void foo6() { + do {} while (true); + } + + public void foo7() { + do {} while (true); + } + + public void foo8() { + do {} while (true); + } + + public void foo9() { + do {} while (true); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyOther.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyOther.java new file mode 100644 index 00000000000..bf0833f5cad --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlyOther.java @@ -0,0 +1,173 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +class InputFormattedRightCurlyOther { + /** + * summary. + * + * @see test method * + */ + int foo() throws InterruptedException { + int x = 1; + int a = 2; + while (true) { + try { + if (x > 0) { + break; + } else if (x < 0) { + + ; + } else { + break; + } + switch (a) { + case 0: + break; + default: + break; + } + } catch (Exception e) { + break; + } + } + + synchronized (this) { + do { + x = 2; + } while (x == 2); + } + + this.wait(666); // Bizarre, but legal + + for (int k = 0; k < 1; k++) { + String innerBlockVariable = ""; + } + + if (System.currentTimeMillis() > 1000) { + return 1; + } else { + return 2; + } + } + + static { + int x = 1; + } + + public enum GreetingsEnum { + HELLO, + GOODBYE + } + + void method2() { + boolean flag = true; + if (flag) { + System.identityHashCode("heh"); + flag = !flag; + } + System.identityHashCode("Xe-xe"); + + if (flag) { + System.identityHashCode("some foo"); + } + } +} + +/** + * Test input for closing brace if that brace terminates a statement or the body of a constructor. + */ +class FooCtorAlone2 { + // violation above 'Top-level class FooCtorAlone2 has to reside in its own source file.' + int test; + + public FooCtorAlone2() { + test = 1; + } +} + +/** Test input for closing brace if that brace terminates a statement or the body of a method. */ +class FooMethodAlone2 { + // violation above 'Top-level class FooMethodAlone2 has to reside in its own source file.' + public void fooMethod() { + int i = 1; + } +} + +/** + * Test input for closing brace if that brace terminates a statement or the body of a named class. + */ +class FooInnerAlone2 { + // violation above 'Top-level class FooInnerAlone2 has to reside in its own source file.' + class InnerFoo { + public void fooInnerMethod() {} + } +} + +// violation below 'Top-level class EnumContainerAlone2 has to reside in its own source file.' +class EnumContainerAlone2 { + private enum Suit { + CLUBS, + HEARTS, + SPADES, + DIAMONDS + } +} + +// violation below 'Top-level class WithArraysAlone2 has to reside in its own source file.' +class WithArraysAlone2 { + String[] ss = {""}; + String[] empty = {}; + String[] s1 = { + "foo", "foo", + }; + String[] s2 = { + "foo", "foo", + }; + String[] s3 = { + "foo", "foo", + }; + String[] s4 = {"foo", "foo"}; +} + +// violation below 'Top-level class Interface2 has to reside in its own source file.' +class Interface2 { + public @interface TestAnnotation {} + + public @interface TestAnnotation1 { + String someValue(); + } + + public @interface TestAnnotation2 { + String someValue(); + } + + public @interface TestAnnotation3 { + String someValue(); + } + + public @interface TestAnnotation4 { + String someValue(); + } +} + +// violation below 'Top-level class TestEnum222 has to reside in its own source file.' +enum TestEnum222 {} + +// violation below 'Top-level class TestEnum12 has to reside in its own source file.' +enum TestEnum12 { + SOME_VALUE; +} + +// violation below 'Top-level class TestEnum22 has to reside in its own source file.' +enum TestEnum22 { + SOME_VALUE; +} + +// violation below 'Top-level class TestEnum32 has to reside in its own source file.' +enum TestEnum32 { + SOME_VALUE; +} + +// violation below 'Top-level class TestEnum42 has to reside in its own source file.' +enum TestEnum42 { + SOME_VALUE; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlySwitchCase.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlySwitchCase.java new file mode 100644 index 00000000000..4703dbc282b --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlySwitchCase.java @@ -0,0 +1,59 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +/** some javadoc. */ +public class InputFormattedRightCurlySwitchCase { + + /** some javadoc. */ + public static void method0() { + int mode = 0; + switch (mode) { + case 1: + int x = 1; + break; + default: + x = 0; + } + } + + /** some javadoc. */ + public static void method1() { + int mode = 0; + switch (mode) { + default: + int x = 0; + } + } + + /** some javadoc. */ + public static void method2() { + int mode = 0; + switch (mode) { + case 1: + int x = 1; + break; + default: + x = 0; + } + } + + /** some javadoc. */ + public static void method3() { + int mode = 0; + switch (mode) { + default: + int x = 0; + } + } + + /** some javadoc. */ + public static void method4() { + int mode = 0; + switch (mode) { + case 1: + int y = 2; + break; + default: + int x = 0; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlySwitchCasesBlocks.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlySwitchCasesBlocks.java new file mode 100644 index 00000000000..4d263002176 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputFormattedRightCurlySwitchCasesBlocks.java @@ -0,0 +1,93 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +/** some javadoc. */ +public class InputFormattedRightCurlySwitchCasesBlocks { + + /** some javadoc. */ + public static void test0() { + int mode = 0; + switch (mode) { + case 1: + { + // violation above ''{' at column 9 should be on the previous line.' + int x = 1; + break; + } + case 2: + { + // violation above ''{' at column 9 should be on the previous line.' + int x = 0; + break; + } + default: + } + } + + /** some javadoc. */ + public static void test() { + int mode = 0; + switch (mode) { + case 1: + { + // violation above ''{' at column 9 should be on the previous line.' + int x = 1; + break; + } + default: + int x = 0; + } + } + + /** some javadoc. */ + public static void test1() { + int k = 0; + switch (k) { + case 1: + { + // violation above ''{' at column 9 should be on the previous line.' + int x = 1; + } + break; + case 2: + int x = 2; + break; + default: + } + } + + /** some javadoc. */ + public static void test2() { + int mode = 0; + switch (mode) { + case 1: + int x = 1; + break; + case 2: + { + // violation above ''{' at column 9 should be on the previous line.' + break; + } + default: + } + } + + /** some javadoc. */ + public static void test3() { + int k = 0; + switch (k) { + case 1: + { + // violation above ''{' at column 9 should be on the previous line.' + int x = 1; + break; + } + case 2: + { + // violation above ''{' at column 9 should be on the previous line.' + int x = 2; + } + break; + default: + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyAnnotations.java index ecf250033dd..973d42b01a8 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyAnnotations.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyAnnotations.java @@ -7,53 +7,61 @@ @TestClassAnnotation class InputLeftCurlyAnnotations -{ //warn + { // violation ''{' at column 3 should be on the previous line.' private static final int X = 10; + @Override - public boolean equals(Object other) - { //warn - return false; + public boolean equals( + Object other) + { // violation ''{' at column 5 should be on the previous line.' + return false; } @Override @SuppressWarnings("unused") public int hashCode() - { //warn - int a = 10; - return 1; + { // violation ''{' at column 5 should be on the previous line.' + int a = 10; + return 1; } - @Override @SuppressWarnings({"unused", "unchecked", "static-access"}) public String toString() - { //warn - Integer i = this.X; - List l = new ArrayList(); - return "SomeString"; + @Override + @SuppressWarnings({"unused", "unchecked", "static-access"}) + public String toString() + { // violation ''{' at column 5 should be on the previous line.' + Integer i = this.X; + List l = new ArrayList(); + return "SomeString"; } -} + } +// violation below '.* InputLeftCurlyAnnotations2 has to reside in its own source file.' @TestClassAnnotation class InputLeftCurlyAnnotations2 { - private static final int X = 10; - @Override - public boolean equals(Object other) { - return false; - } + private static final int X = 10; - @Override - @SuppressWarnings("unused") - public int hashCode() { - int a = 10; - return 1; - } + @Override + public boolean equals(Object other) { + return false; + } - @Override @SuppressWarnings({"unused", "unchecked", "static-access"}) public String toString() - { //warn - Integer i = this.X; - List l = new ArrayList(); - return "SomeString"; + @Override + @SuppressWarnings("unused") + public int hashCode() { + int a = 10; + return 1; + } + + @Override + @SuppressWarnings({"unused", "unchecked", "static-access"}) + public String toString() + { // violation ''{' at column 5 should be on the previous line.' + Integer i = this.X; + List l = new ArrayList(); + return "SomeString"; } } +// violation below 'Top-level class TestClassAnnotation has to reside in its own source file.' @Target(ElementType.TYPE) -@interface TestClassAnnotation { -} +@interface TestClassAnnotation {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyBraces.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyBraces.java deleted file mode 100644 index 92f0c579d14..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyBraces.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; - -class InputLeftCurlyBraces -{ //warn - /** @return helper func **/ - boolean condition() - { //warn - return false; - } - - /** Test do/while loops **/ - void testDoWhile() - { //warn - - do { - testDoWhile(); - } - while (condition()); - - - do testDoWhile(); while (condition()); - } - - /** Test while loops **/ - void testWhile() - { //warn - - while (condition()) { - testWhile(); - } - - - while(condition()); - while (condition()) - testWhile(); - while (condition()) - if (condition()) - testWhile(); - } - - /** Test for loops **/ - void testFor() - { //warn - - for (int i = 1; i < 5; i++) { - testFor(); - } - - - for(int i = 1;i < 5;i++); - for (int i = 1; i < 5; i++) - testFor(); - for (int i = 1; i < 5; - i++) - if (i > 2) - testFor(); - } - - /** Test if constructs **/ - public void testIf() - { //warn - - if (condition()) { - testIf(); - } - else if (condition()) { - testIf(); - } - else { - testIf(); - } - - - if (condition()); - if (condition()) - testIf(); - if (condition()) - testIf(); - else - testIf(); - if (condition()) - testIf(); - else { - testIf(); - } - if (condition()) { - testIf(); - } - else - testIf(); - if (condition()) - if (condition()) - testIf(); - } - - void whitespaceAfterSemi() - { //warn - - int i = 1;int j = 2; - - - for (;;) { - } - } - - /** Empty constructor block. **/ - public InputLeftCurlyBraces() {} - - /** Empty method block. **/ - public void emptyImplementation() {} -} - -class EnumContainerLeft { - private enum Suit { CLUBS, HEARTS, SPADES, DIAMONDS } // ok -} - -class WithArraysLeft { // ok - String[] s = {""}; // ok - String[] empty = {}; // ok - String[] s1 = { // ok - "foo", "foo", - }; - String[] s2 = - { // ok - "foo", "foo", - }; - String[] s3 = - { // ok - "foo", - "foo", - }; - String[] s4 = - {"foo", "foo"}; // ok -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyMethod.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyMethod.java index bf06d8094a4..5b185cf9689 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyMethod.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputLeftCurlyMethod.java @@ -1,82 +1,82 @@ package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; class InputLeftCurlyMethod -{ //warn - InputLeftCurlyMethod() {} //ok - InputLeftCurlyMethod(String aOne) {//ok - } - InputLeftCurlyMethod(int aOne) - { //warn - } + { // violation ''{' at column 3 should be on the previous line.' + InputLeftCurlyMethod() {} + + InputLeftCurlyMethod(String one) {} - void method1() {}//ok - void method2() {//ok + InputLeftCurlyMethod(int one) + { // violation ''{' at column 5 should be on the previous line.' } + + void method1() {} + + void method2() {} + void method3() - { //warn - } - void method4() - { //warn + { // violation ''{' at column 5 should be on the previous line.' } - void method5(String aOne, - String aTwo) - {//warn + + void method4() + { // violation ''{' at column 5 should be on the previous line.' } - void method6(String aOne, - String aTwo) {// ok + + void method5(String one, String two) + { // violation ''{' at column 5 should be on the previous line.' } -} - -enum InputLeftCurlyMethodEnum -{//warn - CONSTANT1("hello") - {//warn - void method1() {}//ok - void method2() { - }//ok - void method3() - {//warn - } - void method4() - { //warn - } - void method5(String aOne, - String aTwo) - {//warn - } - void method6(String aOne, - String aTwo) {//ok - } - }, - CONSTANT2("hello") {//ok + void method6(String one, String two) {} - }, + enum InputLeftCurlyMethodEnum + { // violation ''{' at column 7 should be on the previous line.' + CONSTANT1("hello") + { // violation ''{' at column 17 should be on the previous line.' + void method1() {} - CONSTANT3("hellohellohellohellohellohellohellohellohellohellohellohellohellohello") - {//warn - }; + void method2() {} - private InputLeftCurlyMethodEnum(String value) - {//warn + void method3() + { // violation ''{' at column 21 should be on the previous line.' + } - } + void method4() + { // violation ''{' at column 21 should be on the previous line.' + } - void method1() {}//ok - void method2() {//ok - } - void method3() - {//warn - } - void method4() - {//warn - } - void method5(String aOne, - String aTwo) - {//warn - } - void method6(String aOne, - String aTwo) {// ok - } -} + void method5(String one, String two) + { // violation ''{' at column 21 should be on the previous line.' + } + + void method6(String one, String two) {} + }, + + CONSTANT2("hello") {}, + + CONSTANT3("hellohellohellohellohellohellohellohellohellohellohellohellohellohello") + { // violation ''{' at column 17 should be on the previous line.' + }; + + private InputLeftCurlyMethodEnum(String value) + { // violation ''{' at column 9 should be on the previous line.' + } + + void method1() {} + + void method2() {} + + void method3() + { // violation ''{' at column 9 should be on the previous line.' + } + + void method4() + { // violation ''{' at column 9 should be on the previous line.' + } + + void method5(String one, String two) + { // violation ''{' at column 9 should be on the previous line.' + } + void method6(String one, String two) {} + } + } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputNonemptyBlocksLeftRightCurly.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputNonemptyBlocksLeftRightCurly.java new file mode 100644 index 00000000000..f2e7fc8673f --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputNonemptyBlocksLeftRightCurly.java @@ -0,0 +1,306 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +class InputNonemptyBlocksLeftRightCurly + { // violation ''{' at column 3 should be on the previous line.' + /** + * summary. + * + * @return helper func * + */ + boolean condition() + { // violation ''{' at column 5 should be on the previous line.' + return false; + } + + /** Test do/while loops. */ + void testDoWhile() + { // violation ''{' at column 5 should be on the previous line.' + + do { + testDoWhile(); + } // violation ''}' at column 7 should be on the same line as the next part of .*' + while (condition()); + + do { + testDoWhile(); + } while (condition()); + } + + /** Test while loops. */ + void testWhile() + { // violation ''{' at column 5 should be on the previous line.' + + while (condition()) { + testWhile(); + } + + while (condition()) { + /* foo */ + } + while (condition()) { + testWhile(); + } + while (condition()) { + if (condition()) { + testWhile(); + } + } + } + + /** Test for loops. */ + void testFor() + { // violation ''{' at column 5 should be on the previous line.' + + for (int i = 1; i < 5; i++) { + testFor(); + } + + for (int i = 1; i < 5; i++) { + /* foo */ + } + for (int i = 1; i < 5; i++) { + testFor(); + } + for (int i = 1; i < 5; i++) { + if (i > 2) { + testFor(); + } + } + } + + /** Test if constructs. */ + public void testIf() + { // violation ''{' at column 5 should be on the previous line.' + + if (condition()) { + testIf(); + } // violation ''}' at column 7 should be on the same line as the next part of .*' + else if (condition()) { + testIf(); + } // violation ''}' at column 7 should be on the same line as the next part of .*' + else { + testIf(); + } + + if (condition()) { /* foo */ } + if (condition()) { + testIf(); + } + if (condition()) { + testIf(); + } else { + testIf(); + } + if (condition()) { + testIf(); + } else { + testIf(); + } + if (condition()) { + testIf(); + } // violation ''}' at column 7 should be on the same line as the next part of .*' + else { + testIf(); + } + if (condition()) { + if (condition()) { + testIf(); + } + } + } + + void whitespaceAfterSemi() + { // violation ''{' at column 5 should be on the previous line.' + + int i = 1; + int j = 2; + + for (; ; ) {} + } + + /** Empty constructor block. */ + public InputNonemptyBlocksLeftRightCurly() {} + + /** Empty method block. */ + public void emptyImplementation() {} + } + +// violation below 'Top-level class EnumContainerLeft has to reside in its own source file.' +class EnumContainerLeft { + private enum Suit { + CLUBS, + HEARTS, + SPADES, + DIAMONDS + } // ok +} + +// violation below 'Top-level class WithArraysLeft has to reside in its own source file.' +class WithArraysLeft { // ok + String[] s1 = {""}; // ok + String[] empty = {}; // ok + String[] s2 = { // ok + "foo", "foo", + }; + String[] s3 = { // ok + "foo", "foo", + }; + String[] s4 = { // ok + "foo", "foo", + }; + String[] s5 = {"foo", "foo"}; // ok +} + +// violation below 'Top-level class InputRightCurlyOther2 has to reside in its own source file.' +class InputRightCurlyOther2 + { // violation ''{' at column 3 should be on the previous line.' + /** + * summary. + * + * @see test method * + */ + int foo() + throws InterruptedException + { // violation ''{' at column 5 should be on the previous line.' + int x = 1; + int a = 2; + while (true) + { // violation ''{' at column 9 should be on the previous line.' + try + { // violation ''{' at column 11 should be on the previous line.' + if (x > 0) + { // violation ''{' at column 15 should be on the previous line.' + break; + } else if (x < 0) { // ok + + ; + } // violation ''}' at column 13 should be on the same line as the next part.*' + else + { // violation ''{' at column 15 should be on the previous line.' + break; + } // ok + switch (a) + { // violation ''{' at column 15 should be on the previous line.' + case 0: + break; + default: + break; + } // ok + } // violation ''}' at column 11 should be on the same line as the next part of .*' + catch (Exception e) + { // violation ''{' at column 11 should be on the previous line.' + break; + } // ok + } // ok + + synchronized (this) + { // violation ''{' at column 9 should be on the previous line.' + do + { // violation ''{' at column 11 should be on the previous line.' + x = 2; + } while (x == 2); // ok + } // ok + + this.wait(666); // Bizarre, but legal + + for (int k = 0; k < 1; k++) + { // violation ''{' at column 9 should be on the previous line.' + String innerBlockVariable = ""; + } // ok + + if (System.currentTimeMillis() > 1000) { + return 1; + } else { + return 2; + } + } // ok + + static + { // violation ''{' at column 5 should be on the previous line.' + int x = 1; + } // ok + + /** some javadoc. */ + public enum GreetingsEnum + { // violation ''{' at column 5 should be on the previous line.' + HELLO, + GOODBYE + } // ok + + void method2() + { // violation ''{' at column 5 should be on the previous line.' + boolean flag = true; + if (flag) { + System.identityHashCode("heh"); + // 2 violations 3 lines below: + // ''if' child has incorrect indentation level 6, expected level should be 8.' + // ''}' at column 21 should have line break before.' + flag = !flag; } System + .identityHashCode("Xe-xe"); + + if (flag) { System.identityHashCode("some foo"); } + // violation above ''{' at column 17 should have line break after.' + } // ok + } // ok + +/** + * Test input for closing brace if that brace terminates a statement or the body of a constructor. + */ +// violation below 'Top-level class FooCtor has to reside in its own source file.' +class FooCtor + { // violation ''{' at column 3 should be on the previous line.' + int i3; + + public FooCtor() + { // violation ''{' at column 5 should be on the previous line.' + i3 = 1; + } } // violation ''}' at column 5 should be alone on a line.' + +/** Test input for closing brace if that brace terminates a statement or the body of a method. */ +// violation below 'Top-level class FooMethod has to reside in its own source file.' +class FooMethod + { // violation ''{' at column 3 should be on the previous line.' + public void fooMethod() + { // violation ''{' at column 5 should be on the previous line.' + int i = 1; + } } // violation ''}' at column 5 should be alone on a line.' + +/** + * Test input for closing brace if that brace terminates a statement or the body of a named class. + */ +// violation below 'Top-level class FooInner has to reside in its own source file.' +class FooInner + { // violation ''{' at column 3 should be on the previous line.' + class InnerFoo + { // violation ''{' at column 5 should be on the previous line.' + public void fooInnerMethod() + { // violation ''{' at column 9 should be on the previous line.' + } + } + } // ok + +// violation below 'Top-level class EnumContainer has to reside in its own source file.' +class EnumContainer { + private enum Suit { + CLUBS, + HEARTS, + SPADES, + DIAMONDS + } // ok +} + +// violation below 'Top-level class WithArrays has to reside in its own source file.' +class WithArrays { + String[] test = {""}; // ok + String[] empty = {}; // ok + String[] s1 = { + "foo", "foo", + }; // ok + String[] s2 = { + "foo", "foo", + }; // ok + String[] s3 = { + "foo", "foo", + }; // ok + String[] s4 = {"foo", "foo"}; // ok +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurly.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurly.java new file mode 100644 index 00000000000..8c54b80308a --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurly.java @@ -0,0 +1,13 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +/** some javadoc. */ +public class InputRightCurly { + /** some javadoc. */ + public static void main(String[] args) { + boolean after = false; + try { + /* foo */ + } finally { after = true; } + // violation above ''{' at column 15 should have line break after.' + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurly2.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurly2.java deleted file mode 100644 index 5fc75a4ecc4..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurly2.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; - -public class InputRightCurly2 { - public static void main(String[] args) { - boolean after = false; - try { - } finally { after = true; } - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile.java index fa3de0a0d6f..71351c8eec0 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile.java @@ -2,92 +2,81 @@ import java.util.Scanner; -/** - * Test input for GitHub issue #3090. - * https://github.com/checkstyle/checkstyle/issues/3090 - */ +/** Test input for GitHub issue #3090. https://github.com/checkstyle/checkstyle/issues/3090 . */ public class InputRightCurlyDoWhile { - public void foo1() { - do { - } while (true); - } + public void foo1() { + do {} while (true); + } - public void foo2() { - int i = 1; - while (i < 5) { - String.CASE_INSENSITIVE_ORDER.equals(i + " "); - i++; - } + /** some javadoc. */ + public void foo2() { + int i = 1; + while (i < 5) { + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + i++; } - - public void foo3() { - int i = 1; - do { - i++; - String.CASE_INSENSITIVE_ORDER.equals(i + " "); - } while (i < 5); - } - - public void foo4() { - int prog, user; - prog = (int)(Math.random() * 10) + 1; - Scanner input = new Scanner(System.in, "utf-8"); - if( input.hasNextInt() ) { - do { - user = input.nextInt(); - if(user == prog) { - String.CASE_INSENSITIVE_ORDER.equals("Good!"); - } else { - if (user > 0 && user <= 10) { - String.CASE_INSENSITIVE_ORDER.equals("Bad! "); - if( prog < user ) { - String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours."); - } else { - String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours"); - } - } else { - String.CASE_INSENSITIVE_ORDER.equals("Violation!"); - } - } - } while( user != prog ); + } + + /** some javadoc. */ + public void foo3() { + int i = 1; + do { + i++; + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + } while (i < 5); + } + + /** some javadoc. */ + public void foo4() { + int prog; + int user; + prog = (int) (Math.random() * 10) + 1; + Scanner input = new Scanner(System.in, "utf-8"); + if (input.hasNextInt()) { + do { + user = input.nextInt(); + if (user == prog) { + String.CASE_INSENSITIVE_ORDER.equals("Good!"); } else { + if (user > 0 && user <= 10) { + String.CASE_INSENSITIVE_ORDER.equals("Bad! "); + if (prog < user) { + String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours."); + } else { + String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours"); + } + } else { String.CASE_INSENSITIVE_ORDER.equals("Violation!"); + } } - String.CASE_INSENSITIVE_ORDER.equals("Goodbye!"); - } - - public void foo5() { - do { - } // warn - while (true); - } - - public void foo6() { - do {} // warn - while (true); - } - - public void foo7() { - do - { - - } while (true); - } - - public void foo8() { - do - - { - - } // warn - - while - - (true); - } - - public void foo9() { - do {} while (true); + } while (user != prog); + } else { + String.CASE_INSENSITIVE_ORDER.equals("Violation!"); } + String.CASE_INSENSITIVE_ORDER.equals("Goodbye!"); + } + + public void foo5() { + do {} // violation ''}' at column 9 should be on the same line as the next part of .*' + while (true); + } + + public void foo6() { + do {} // violation ''}' at column 9 should be on the same line as the next part of .*' + while (true); + } + + public void foo7() { + do {} while (true); + } + + public void foo8() { + do {} // violation ''}' at column 9 should be on the same line as the next part of .*' + while (true); + } + + public void foo9() { + do {} while (true); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile2.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile2.java index 5ec1888f15a..c5618a12332 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile2.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyDoWhile2.java @@ -1,93 +1,83 @@ package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; +import java.nio.charset.StandardCharsets; import java.util.Scanner; -/** - * Test input for GitHub issue #3090. - * https://github.com/checkstyle/checkstyle/issues/3090 - */ +/** Test input for GitHub issue #3090. https://github.com/checkstyle/checkstyle/issues/3090 . */ public class InputRightCurlyDoWhile2 { - public void foo1() { - do { - } while (true); - } + public void foo1() { + do {} while (true); + } - public void foo2() { - int i = 1; - while (i < 5) { - String.CASE_INSENSITIVE_ORDER.equals(i + " "); - i++; - } + /** some javadoc. */ + public void foo2() { + int i = 1; + while (i < 5) { + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + i++; } - - public void foo3() { - int i = 1; - do { - i++; - String.CASE_INSENSITIVE_ORDER.equals(i + " "); - } while (i < 5); - } - - public void foo4() { - int prog, user; - prog = (int)(Math.random() * 10) + 1; - Scanner input = new Scanner(System.in, "utf-8"); - if( input.hasNextInt() ) { - do { - user = input.nextInt(); - if(user == prog) { - String.CASE_INSENSITIVE_ORDER.equals("Good!"); - } else { - if (user > 0 && user <= 10) { - String.CASE_INSENSITIVE_ORDER.equals("Bad! "); - if( prog < user ) { - String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours."); - } else { - String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours"); - } - } else { - String.CASE_INSENSITIVE_ORDER.equals("Violation!"); - } - } - } while( user != prog ); + } + + /** some javadoc. */ + public void foo3() { + int i = 1; + do { + i++; + String.CASE_INSENSITIVE_ORDER.equals(i + " "); + } while (i < 5); + } + + /** some javadoc. */ + public void foo4() { + int prog; + int user; + prog = (int) (Math.random() * 10) + 1; + Scanner input = new Scanner(System.in, StandardCharsets.UTF_8); + if (input.hasNextInt()) { + do { + user = input.nextInt(); + if (user == prog) { + String.CASE_INSENSITIVE_ORDER.equals("Good!"); } else { + if (user > 0 && user <= 10) { + String.CASE_INSENSITIVE_ORDER.equals("Bad! "); + if (prog < user) { + String.CASE_INSENSITIVE_ORDER.equals("My number is less than yours."); + } else { + String.CASE_INSENSITIVE_ORDER.equals("My number is greater than yours"); + } + } else { String.CASE_INSENSITIVE_ORDER.equals("Violation!"); + } } - String.CASE_INSENSITIVE_ORDER.equals("Goodbye!"); - } - - public void foo5() { - do { - } // warn - while (true); - } - - public void foo6() { - do {} // warn - while (true); - } - - public void foo7() { - do - { - - } while (true); - } - - public void foo8() { - do - - { - - } // warn - - while - - (true); - } - - public void foo9() { - do {} while (true); + } while (user != prog); + } else { + String.CASE_INSENSITIVE_ORDER.equals("Violation!"); } + String.CASE_INSENSITIVE_ORDER.equals("Goodbye!"); + } + + public void foo5() { + do {} // violation ''}' at column 9 should be on the same line as the next part of .*' + while (true); + } + + public void foo6() { + do {} // violation ''}' at column 9 should be on the same line as the next part of .*' + while (true); + } + + public void foo7() { + do {} while (true); + } + + public void foo8() { + do {} // violation ''}' at column 9 should be on the same line as the next part of .*' + while (true); + } + + public void foo9() { + do {} while (true); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java index 355424a8118..5cbd007d885 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther.java @@ -1,145 +1,175 @@ package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; -class InputRightCurlyOther -{ - /** @see test method **/ - int foo() throws InterruptedException - { - int x = 1; - int a = 2; - while (true) - { - try - { - if (x > 0) - { - break; - } else if (x < 0) { //ok - - ; - } //warn - else - { - break; - }//ok - switch (a) - { - case 0: - break; - default: - break; - } //ok - } //warn - catch (Exception e) - { - break; - }//ok - }//ok - - synchronized (this) - { - do - { - x = 2; - } while (x == 2); //ok - }//ok - - this.wait(666 - ); // Bizarre, but legal - - for (int k = 0; k < 1; k++) - { - String innerBlockVariable = ""; - }//ok - - - if (System.currentTimeMillis() > 1000) - return 1; - else - return 2; - }//ok - - - static - { - int x = 1; - }//ok - - public enum GreetingsEnum - { - HELLO, - GOODBYE - }; //ok - - void method2() - { - boolean flag = true; - if (flag) { - System.identityHashCode("heh"); - flag = !flag; } System. //warn - identityHashCode("Xe-xe"); - - - if (flag) { System.identityHashCode("some foo"); } - } //ok -} //ok +class InputRightCurlyOther { + /** + * summary. + * + * @see test method * + */ + int foo() throws InterruptedException { + int x = 1; + int a = 2; + while (true) { + try { + if (x > 0) { + break; + } else if (x < 0) { + + ; + } // violation ''}' at column 9 should be on the same line as the next part of .*' + else { + break; + } + switch (a) { + case 0: + break; + default: + break; + } + } // violation ''}' at column 7 should be on the same line as the next part of .*' + catch (Exception e) { + break; + } + } + + synchronized (this) { + do { + x = 2; + } while (x == 2); + } + + this.wait(666); // Bizarre, but legal + + for (int k = 0; k < 1; k++) { + String innerBlockVariable = ""; + } + + if (System.currentTimeMillis() > 1000) { + return 1; + } else { + return 2; + } + } + + static { + int x = 1; + } + + public enum GreetingsEnum { + HELLO, + GOODBYE + } + + void method2() { + boolean flag = true; + if (flag) { + System.identityHashCode("heh"); + // 2 violations 3 lines below: + // ''}' at column 21 should have line break before.' + // ''method def' child has incorrect indentation level 6, expected level should be 4.' + flag = !flag; } System + .identityHashCode("Xe-xe"); + + if (flag) { + System.identityHashCode("some foo"); + } + } +} /** - * Test input for closing brace if that brace terminates - * a statement or the body of a constructor. + * Test input for closing brace if that brace terminates a statement or the body of a constructor. */ -class FooCtor -{ - int i; - public FooCtor() - { - i = 1; - }} // warn +class FooCtorAlone { + // violation above 'Top-level class FooCtorAlone has to reside in its own source file.' + int test; -/** -* Test input for closing brace if that brace terminates -* a statement or the body of a method. -*/ -class FooMethod -{ - public void fooMethod() - { - int i = 1; - }} // warn + public FooCtorAlone() { + test = 1; + } } // violation ''}' at column 3 should be alone on a line.' + +/** Test input for closing brace if that brace terminates a statement or the body of a method. */ +class FooMethodAlone { + // violation above 'Top-level class FooMethodAlone has to reside in its own source file.' + public void fooMethod() { + int i = 1; + } } // violation ''}' at column 3 should be alone on a line.' /** -* Test input for closing brace if that brace terminates -* a statement or the body of a named class. -*/ -class FooInner -{ - class InnerFoo - { - public void fooInnerMethod () - { + * Test input for closing brace if that brace terminates a statement or the body of a named class. + */ +class FooInnerAlone { + // violation above 'Top-level class FooInnerAlone has to reside in its own source file.' + class InnerFoo { + public void fooInnerMethod() {} + } +} - } - }} //ok +// violation below 'Top-level class EnumContainerAlone has to reside in its own source file.' +class EnumContainerAlone { + private enum Suit { + CLUBS, + HEARTS, + SPADES, + DIAMONDS + } +} + +// violation below 'Top-level class WithArraysAlone has to reside in its own source file.' +class WithArraysAlone { + String[] ss = {""}; + String[] empty = {}; + String[] s1 = { + "foo", "foo", + }; + String[] s2 = { + "foo", "foo", + }; + String[] s3 = { + "foo", "foo", + }; + String[] s4 = {"foo", "foo"}; +} + +// violation below 'Top-level class Interface has to reside in its own source file.' +class Interface { + public @interface TestAnnotation {} + + public @interface TestAnnotation1 { + String someValue(); + } + + public @interface TestAnnotation2 { + String someValue(); + } + + public @interface TestAnnotation3 { + String someValue(); + } + + public @interface TestAnnotation4 { + String someValue(); + } +} + +// violation below 'Top-level class TestEnum has to reside in its own source file.' +enum TestEnum {} + +// violation below 'Top-level class TestEnum1 has to reside in its own source file.' +enum TestEnum1 { + SOME_VALUE; +} + +// violation below 'Top-level class TestEnum2 has to reside in its own source file.' +enum TestEnum2 { + SOME_VALUE; +} -class EnumContainer { - private enum Suit { CLUBS, HEARTS, SPADES, DIAMONDS } // ok +// violation below 'Top-level class TestEnum3 has to reside in its own source file.' +enum TestEnum3 { + SOME_VALUE; } -class WithArrays { - String[] s = {""}; // ok - String[] empty = {}; // ok - String[] s1 = { - "foo", "foo", - }; // ok - String[] s2 = - { - "foo", "foo", - }; // ok - String[] s3 = - { - "foo", - "foo", - }; // ok - String[] s4 = - {"foo", "foo"}; // ok +// violation below 'Top-level class TestEnum4 has to reside in its own source file.' +enum TestEnum4 { + SOME_VALUE; } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther2.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther2.java deleted file mode 100644 index 711e4ef8b0f..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlyOther2.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; - -class InputRightCurlyOther2 -{ - /** @see test method **/ - int foo() throws InterruptedException - { - int x = 1; - int a = 2; - while (true) - { - try - { - if (x > 0) - { - break; - } else if (x < 0) { //ok - - ; - } // warning - else - { - break; - }//ok - switch (a) - { - case 0: - break; - default: - break; - } //ok - } // warning - catch (Exception e) - { - break; - }//ok - }//ok - - synchronized (this) - { - do - { - x = 2; - } while (x == 2); //ok - }//ok - - this.wait(666 - ); // Bizarre, but legal - - for (int k = 0; k < 1; k++) - { - String innerBlockVariable = ""; - }//ok - - - if (System.currentTimeMillis() > 1000) - return 1; - else - return 2; - }//ok - - - static - { - int x = 1; - }//ok - - public enum GreetingsEnum - { - HELLO, - GOODBYE - }; - - void method2() - { - boolean flag = true; - if (flag) { - System.identityHashCode("heh"); - flag = !flag; } System. // warn - identityHashCode("Xe-xe"); - - - if (flag) { System.identityHashCode("some foo"); } - } //ok -} //ok - -/** - * Test input for closing brace if that brace terminates - * a statement or the body of a constructor. - */ -class FooCtorAlone -{ - int i; - public FooCtorAlone() - { - i = 1; - }} // warn - -/** -* Test input for closing brace if that brace terminates -* a statement or the body of a method. -*/ -class FooMethodAlone -{ - public void fooMethod() - { - int i = 1; - }} // warn - -/** -* Test input for closing brace if that brace terminates -* a statement or the body of a named class. -*/ -class FooInnerAlone -{ - class InnerFoo - { - public void fooInnerMethod () - { - - } - }} - -class EnumContainerAlone { - private enum Suit { CLUBS, HEARTS, SPADES, DIAMONDS } -} - -class WithArraysAlone { - String[] s = {""}; // ok - String[] empty = {}; // ok - String[] s1 = { - "foo", "foo", - }; // ok - String[] s2 = - { - "foo", "foo", - }; // ok - String[] s3 = - { - "foo", - "foo", - }; // ok - String[] s4 = - {"foo", "foo"}; // ok -} - -class Interface { - public @interface TestAnnotation {} - - public @interface TestAnnotation1 { String someValue(); } - - public @interface TestAnnotation2 { - String someValue();} - - public @interface TestAnnotation3 { - String someValue(); - } //ok - - public @interface TestAnnotation4 { String someValue(); - } //ok -} - -enum TestEnum {} - -enum TestEnum1 { SOME_VALUE; } - -enum TestEnum2 { - SOME_VALUE;} - -enum TestEnum3 { - SOME_VALUE; -} - -enum TestEnum4 { SOME_VALUE; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCase.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCase.java index 4bad521c9a6..1600c14da51 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCase.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCase.java @@ -1,50 +1,57 @@ package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; +/** some javadoc. */ public class InputRightCurlySwitchCase { - public static void method0() { - int mode = 0; - switch (mode) { - case 1: - int x = 1; - break; - default : - x = 0; } // warn - } + /** some javadoc. */ + public static void method0() { + int mode = 0; + switch (mode) { + case 1: + int x = 1; + break; + default: + x = 0; } // violation ''}' at column 16 should be alone on a line.' + } - public static void method1() { - int mode = 0; - switch (mode) { - default : - int x = 0; } // warn - } + /** some javadoc. */ + public static void method1() { + int mode = 0; + switch (mode) { + default: + int x = 0; } // violation ''}' at column 20 should be alone on a line.' + } - public static void method2() { - int mode = 0; - switch (mode) { - case 1: - int x = 1; - break; - default: - x = 0; - } // ok + /** some javadoc. */ + public static void method2() { + int mode = 0; + switch (mode) { + case 1: + int x = 1; + break; + default: + x = 0; } + } - public static void method3() { - int mode = 0; - switch (mode) { - default : - int x = 0; - } // ok + /** some javadoc. */ + public static void method3() { + int mode = 0; + switch (mode) { + default: + int x = 0; } + } - public static void method4() { - int mode = 0; - switch (mode) { - case 1 : - int y = 2; - default : - int x = 0; - } // ok + /** some javadoc. */ + public static void method4() { + int mode = 0; + switch (mode) { + case 1: + int y = 2; + break; + default: + int x = 0; } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCasesBlocks.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCasesBlocks.java new file mode 100644 index 00000000000..444901c58c3 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule412nonemptyblocks/InputRightCurlySwitchCasesBlocks.java @@ -0,0 +1,86 @@ +package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks; + +/** some javadoc. */ +public class InputRightCurlySwitchCasesBlocks { + + /** some javadoc. */ + public static void test0() { + int mode = 0; + switch (mode) { + case 1: + { // violation ''{' at column 9 should be on the previous line.' + int x = 1; + break; + } + case 2: + { // violation ''{' at column 9 should be on the previous line.' + int x = 0; + break; + } + default: + } + } + + /** some javadoc. */ + public static void test() { + int mode = 0; + switch (mode) { + case 1: + { // violation ''{' at column 9 should be on the previous line.' + int x = 1; + break; + } default: + int x = 0; + // 2 violations 2 lines above: + // ''}' at column 9 should be alone on a line.' + // ''case' child has incorrect indentation level 8, expected level should be 6.' + } + } + + /** some javadoc. */ + public static void test1() { + int k = 0; + switch (k) { + case 1: + { // violation ''{' at column 9 should be on the previous line.' + int x = 1; } // violation ''}' at column 20 should be alone on a line.' + break; + case 2: + int x = 2; + break; + default: + } + } + + /** some javadoc. */ + public static void test2() { + int mode = 0; + switch (mode) { + case 1: + int x = 1; + break; + case 2: + { // violation ''{' at column 9 should be on the previous line.' + break; + } + default: + } + } + + /** some javadoc. */ + public static void test3() { + int k = 0; + switch (k) { + case 1: + { // violation ''{' at column 9 should be on the previous line.' + int x = 1; + break; + } + case 2: + { // violation ''{' at column 9 should be on the previous line.' + int x = 2; } // violation ''}' at column 20 should be alone on a line.' + break; + default: + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlock.java deleted file mode 100644 index 9096c087b65..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlock.java +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Test case file for checkstyle. -// Created: 2001 -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; - -import java.io.*; -import java.awt.Dimension; -import java.awt.Color; - -class InputEmptyBlock { - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} - finally {} //warn - } - - class Inner { - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} - finally {} //warn - } - } - - Inner anon = new Inner(){ - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} - finally {} //warn - } - }; -} - -interface InterfaceEndingWithSemiColon2 { - public void fooEmpty(); -}; // ok until #7541 diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java deleted file mode 100644 index 0219580f65e..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockBasic.java +++ /dev/null @@ -1,336 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Test case file for checkstyle. -// Created: 2001 -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; - -import java.io.*; -import java.awt.Dimension; -import java.awt.Color; - -class InputEmptyBlockBasic -{ - static {} //ok - - public void fooMethod() - { - InputEmptyBlockBasic r = new InputEmptyBlockBasic(); - int a = 1; - if (a == 1) {} // warn - char[] s = {'1', '2'}; - int index = 2; - if (doSideEffect() == 1) {} // warn - IO in = new IO(); - while ((r = in.read()) != null) {} // ok - for (; index < s.length && s[index] != 'x'; index++) {} // ok - if (a == 1) {} else {System.identityHashCode("a");} // warn - do {} while(a == 1); //ok - switch (a) {} //warn - int[] z = {}; // ok - } - - public int doSideEffect() - { - return 1; - } - - public void emptyMethod() {} -} - -class IO -{ - public InputEmptyBlockBasic read() - { - return new InputEmptyBlockBasic(); - } -} -class Empty {} //ok - -interface EmptyImplement {} //ok - -class WithInner -{ - static {} //ok - - public void emptyMethod() {} - - public int doSideEffect() - { - return 1; - } - - class Inner - { - private void withEmpty() - { - InputEmptyBlockBasic r = new InputEmptyBlockBasic(); - int a = 1; - if (a == 1) {} // warn - char[] s = {'1', '2'}; - int index = 2; - if (doSideEffect() == 1) {} //warn - IO in = new IO(); - while ((r = in.read()) != null) {} // ok - for (; index < s.length && s[index] != 'x'; index++) {} // ok - if (a == 1) {} else {System.identityHashCode("a");} // warn - do {} while(a == 1); //ok - switch (a) {} //warn - int[] z = {}; // ok - } - } -} - -class WithAnon -{ - interface AnonWithEmpty { - public void fooEmpty(); - } - - void method() - { - AnonWithEmpty foo = new AnonWithEmpty() { - - public void emptyMethod() {} - - public void fooEmpty() { - InputEmptyBlockBasic r = new InputEmptyBlockBasic(); - int a = 1; - if (a == 1) {} //warn - char[] s = {'1', '2'}; - int index = 2; - if (doSideEffect() == 1) {} //warn - IO in = new IO(); - while ((r = in.read()) != null) {} // ok - for (; index < s.length && s[index] != 'x'; index++) {} // ok - if (a == 1) {} else {System.identityHashCode("a");} // warn - do {} while(a == 1); //ok - switch (a) {} //warn - int[] z = {}; // ok - } - - public int doSideEffect() - { - return 1; - } - }; - } -} - -class NewClass { - - void foo() { - int a = 1; - - if (a == 1) { - System.identityHashCode("a"); - } else {} // warn - - if (a == 1) { - System.identityHashCode("a"); - } else {/*ignore*/} // OK - - if (a == 1) { - /*ignore*/ - } else { - System.identityHashCode("a"); - } // ok - - if (a == 1) { - System.identityHashCode("a"); - } else if (a != 1) { - /*ignore*/ - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - System.identityHashCode("a"); - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - /*ignore*/ - } else { - System.identityHashCode("a"); - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - /*ignore*/ - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) {} //warn - else {} //warn - - if (a == 1) {} //warn - else if (a != 1) { - /*ignore*/ - } - else {} //warn - - if (a == 1) {} //warn - else if (a != 1) {} //warn - else { - /*ignore*/ - } - } - - class NewInner { - - void foo() { - int a = 1; - - if (a == 1) { - System.identityHashCode("a"); - } else {} // warn - - if (a == 1) { - System.identityHashCode("a"); - } else {/*ignore*/} // OK - - if (a == 1) { - /*ignore*/ - } else { - System.identityHashCode("a"); - } // ok - - if (a == 1) { - System.identityHashCode("a"); - } else if (a != 1) { - /*ignore*/ - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - System.identityHashCode("a"); - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - /*ignore*/ - } else { - System.identityHashCode("a"); - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - /*ignore*/ - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) {} //warn - else {} //warn - - if (a == 1) {} //warn - else if (a != 1) { - /*ignore*/ - } - else {} //warn - - if (a == 1) {} //warn - else if (a != 1) {} //warn - else { - /*ignore*/ - } - } - - NewInner anon = new NewInner() { - - void foo() { - int a = 1; - - if (a == 1) { - System.identityHashCode("a"); - } else {} // warn - - if (a == 1) { - System.identityHashCode("a"); - } else {/*ignore*/} // OK - - if (a == 1) { - /*ignore*/ - } else { - System.identityHashCode("a"); - } // ok - - if (a == 1) { - System.identityHashCode("a"); - } else if (a != 1) { - /*ignore*/ - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - System.identityHashCode("a"); - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - /*ignore*/ - } else { - System.identityHashCode("a"); - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) { - /*ignore*/ - } else { - /*ignore*/ - } - - if (a == 1) { - /*ignore*/ - } else if (a != 1) {} //warn - else {} //warn - - if (a == 1) {} //warn - else if (a != 1) { - /*ignore*/ - } - else {} //warn - - if (a == 1) {} //warn - else if (a != 1) {} //warn - else { - /*ignore*/ - } - } - }; - } -} - -class Example { - - void doNothing() {} // ok - - void doNothingElse() { // ok - - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockCatch.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockCatch.java deleted file mode 100644 index d66d620ad7b..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlockCatch.java +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Test case file for checkstyle. -// Created: 2001 -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; - -import java.io.*; -import java.awt.Dimension; -import java.awt.Color; - -class InputEmptyBlockCatch { - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} //warn - finally {} - } - - class Inner { - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} //warn - finally {} - } - } - - Inner anon = new Inner(){ - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} //warn - finally {} - } - }; - - void foo3() { - try { - foo(); - } catch (Exception e) {} //warn - - try { - foo(); - } catch (Exception e) /*warn*/ { - - } - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocks.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocks.java new file mode 100644 index 00000000000..0801bce98c3 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocks.java @@ -0,0 +1,455 @@ +package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; + +class InputEmptyBlocksAndCatchBlocks { + static { + } + + public void fooMethod() { + InputEmptyBlocksAndCatchBlocks r = new InputEmptyBlocksAndCatchBlocks(); + int a = 1; + if (a == 1) { } // violation 'Empty if block.' + char[] s = {'1', '2'}; + int index = 2; + if (doSideEffect() == 1) { } // violation 'Empty if block.' + Io in = new Io(); + while ((r = in.read()) != null) {} + for (; index < s.length && s[index] != 'x'; index++) {} + if (a == 1) { + } else { // violation above 'Empty if block.' + System.identityHashCode("a"); + } + do {} while (a == 1); + switch (a) { + } + // 2 violations 2 lines above: + // 'switch without "default" clause.' + // 'Empty switch block.' + int[] z = {}; + } + + public int doSideEffect() { + return 1; + } + + public void emptyMethod() {} +} + +// violation below 'Top-level class Io has to reside in its own source file.' +class Io { + public InputEmptyBlocksAndCatchBlocks read() { + return new InputEmptyBlocksAndCatchBlocks(); + } +} + +// violation below 'Top-level class Empty has to reside in its own source file.' +class Empty {} + +// violation below 'Top-level class EmptyImplement has to reside in its own source file.' +interface EmptyImplement {} + +// violation below 'Top-level class WithInner has to reside in its own source file.' +class WithInner { + static { + } + + public void emptyMethod() {} + + public int doSideEffect() { + return 1; + } + + class Inner { + private void withEmpty() { + InputEmptyBlocksAndCatchBlocks r = new InputEmptyBlocksAndCatchBlocks(); + int a = 1; + if (a == 1) { } // violation 'Empty if block.' + char[] s = {'1', '2'}; + int index = 2; + if (doSideEffect() == 1) { } // violation 'Empty if block.' + Io in = new Io(); + while ((r = in.read()) != null) {} + for (; index < s.length && s[index] != 'x'; index++) {} + if (a == 1) { + } else { // violation above 'Empty if block.' + System.identityHashCode("a"); + } + do {} while (a == 1); + switch (a) { + } + // 2 violations 2 lines above: + // 'switch without "default" clause.' + // 'Empty switch block.' + int[] z = {}; + } + } +} + +// violation below 'Top-level class WithAnon has to reside in its own source file.' +class WithAnon { + interface AnonWithEmpty { + public void fooEmpty(); + } + + void method() { + AnonWithEmpty foo = + new AnonWithEmpty() { + + public void emptyMethod() {} + + public void fooEmpty() { + InputEmptyBlocksAndCatchBlocks r = new InputEmptyBlocksAndCatchBlocks(); + int a = 1; + if (a == 1) { } // violation 'Empty if block.' + char[] s = {'1', '2'}; + int index = 2; + if (doSideEffect() == 1) { } // violation 'Empty if block.' + Io in = new Io(); + while ((r = in.read()) != null) {} + for (; index < s.length && s[index] != 'x'; index++) {} + if (a == 1) { + } else { // violation above 'Empty if block.' + System.identityHashCode("a"); + } + do {} while (a == 1); + switch (a) { + } + // 2 violations 2 lines above: + // 'switch without "default" clause.' + // 'Empty switch block.' + int[] z = {}; + } + + public int doSideEffect() { + return 1; + } + }; + } +} + +// violation below 'Top-level class NewClass has to reside in its own source file.' +class NewClass { + + void foo() { + int a = 1; + + if (a == 1) { + System.identityHashCode("a"); + } else { + } // violation above 'Empty else block.' + + if (a == 1) { + System.identityHashCode("a"); + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else { + System.identityHashCode("a"); + } + + if (a == 1) { + System.identityHashCode("a"); + } else if (a != 1) { + /*ignore*/ + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + System.identityHashCode("a"); + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + /*ignore*/ + } else { + System.identityHashCode("a"); + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + /*ignore*/ + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + // violation below 'Empty if block.' + } else if (a != 1) { + } else { + } // violation above 'Empty else block.' + + if (a == 1) { + } else if (a != 1) { // violation above 'Empty if block.' + /*ignore*/ + } else { + } // violation above 'Empty else block.' + + // violation below 'Empty if block.' + if (a == 1) { + } else if (a != 1) { + } else { // violation above 'Empty if block.' + /*ignore*/ + } + } + + class NewInner { + + void foo() { + int a = 1; + + if (a == 1) { + System.identityHashCode("a"); + } else { + } // violation above 'Empty else block.' + + if (a == 1) { + System.identityHashCode("a"); + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else { + System.identityHashCode("a"); + } + + if (a == 1) { + System.identityHashCode("a"); + } else if (a != 1) { + /*ignore*/ + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + System.identityHashCode("a"); + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + /*ignore*/ + } else { + System.identityHashCode("a"); + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + /*ignore*/ + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + // violation below 'Empty if block.' + } else if (a != 1) { + } else { + } // violation above 'Empty else block.' + + // violation below 'Empty if block.' + if (a == 1) { + } else if (a != 1) { + /*ignore*/ + } else { + } // violation above 'Empty else block.' + + // violation below 'Empty if block.' + if (a == 1) { + } else if (a != 1) { + } else { // violation above 'Empty if block.' + /*ignore*/ + } + } + + NewInner anon = + new NewInner() { + + void foo() { + int a = 1; + + if (a == 1) { + System.identityHashCode("a"); + } else { + } // violation above 'Empty else block.' + + if (a == 1) { + System.identityHashCode("a"); + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else { + System.identityHashCode("a"); + } + + if (a == 1) { + System.identityHashCode("a"); + } else if (a != 1) { + /*ignore*/ + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + System.identityHashCode("a"); + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + /*ignore*/ + } else { + System.identityHashCode("a"); + } + + if (a == 1) { + /*ignore*/ + } else if (a != 1) { + /*ignore*/ + } else { + /*ignore*/ + } + + if (a == 1) { + /*ignore*/ + // violation below 'Empty if block.' + } else if (a != 1) { + } else { + } // violation above 'Empty else block.' + + if (a == 1) { + } else if (a != 1) { // violation above 'Empty if block.' + /*ignore*/ + } else { + } // violation above 'Empty else block.' + + // violation below 'Empty if block.' + if (a == 1) { + } else if (a != 1) { + } else { // violation above 'Empty if block.' + /*ignore*/ + } + } + }; + } +} + +// violation below 'Top-level class Example has to reside in its own source file.' +class Example { + + void doNothing() {} + + void doNothingElse() {} +} + +// violation below 'Top-level class TestingEmptyBlockCatch has to reside in its own source file.' +class TestingEmptyBlockCatch { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { + /* ignore */ + } + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + // violation below 'Empty catch block.' + } catch (Exception e) { + } finally { + } // violation above 'Empty finally block.' + } + + class Inner { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { + /* ignore */ + } + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + // violation below 'Empty catch block.' + } catch (Exception e) { + } finally { + } // violation above 'Empty finally block.' + } + } + + Inner anon = + new Inner() { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { + /* ignore */ + } + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + // violation below 'Empty catch block.' + } catch (Exception e) { + } finally { + } // violation above 'Empty finally block.' + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocksNoViolations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocksNoViolations.java new file mode 100644 index 00000000000..f70687fac43 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyBlocksAndCatchBlocksNoViolations.java @@ -0,0 +1,106 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; + +import java.io.IOException; + +/** some javadoc. */ +public class InputEmptyBlocksAndCatchBlocksNoViolations { + private void foo6() { + try { + throw new IOException(); + } catch (IOException expected) { // This is expected + int k = 0; + } + } + + /** some javadoc. */ + public void testTryCatch() { + try { + int y = 0; + int u = 8; + int e = u - y; + return; + } catch (Exception e) { + System.identityHashCode(e); + return; + } finally { + return; + } + } + + /** some javadoc. */ + public void testTryCatch3() { + try { + int y = 0; + int u = 8; + int e = u - y; + } catch (IllegalArgumentException e) { + System.identityHashCode(e); // some comment + return; + } catch (IllegalStateException ex) { + System.identityHashCode(ex); + return; + } + } + + /** some javadoc. */ + public void testTryCatch4() { + int y = 0; + int u = 8; + try { + int e = u - y; + } catch (IllegalArgumentException e) { + System.identityHashCode(e); + return; + } + } + + /** some javadoc. */ + public void setFormats() { + try { + int k = 4; + } catch (Exception e) { + Object k = null; + if (k != null) { + k = "ss"; + } else { + return; + } + } + } + + /** some javadoc. */ + public void testIfElse() { + if (true) { + return; + } else { + return; + } + } + + /** some javadoc. */ + public void testIfElseIfLadder() { + if (true) { + return; + } else if (false) { + return; + } else { + return; + } + } + + /** some javadoc. */ + public void testSwtichCase() { + switch (1) { + case 1: + return; + case 2: + return; + default: + return; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java deleted file mode 100644 index 725aab55d80..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockNoViolations.java +++ /dev/null @@ -1,77 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Test case file for checkstyle. -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; - -import java.io.IOException; - -public class InputEmptyCatchBlockNoViolations -{ - private void foo6() { - try { - throw new IOException(); - } catch (IOException expected) { // This is expected - int k = 0; - } - } - - public void testTryCatch() - { - try { - int y=0; - int u=8; - int e=u-y; - return; - } - catch (Exception e) { - System.identityHashCode(e); - return; - } - finally - { - return; - } - } - - public void testTryCatch3() - { - try { - int y=0; - int u=8; - int e=u-y; - } - catch (IllegalArgumentException e) { - System.identityHashCode(e); //some comment - return; - } - catch (IllegalStateException ex) { - System.identityHashCode(ex); - return; - } - } - - public void testTryCatch4() - { - int y=0; - int u=8; - try { - int e=u-y; - } - catch (IllegalArgumentException e) { - System.identityHashCode(e); - return; - } - } - public void setFormats() { - try { - int k = 4; - } catch (Exception e) { - Object k = null; - if (k != null) - k = "ss"; - else { - return; - } - } - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByComment.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByComment.java index 4cfe3972e7e..3c260f394e4 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByComment.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByComment.java @@ -2,109 +2,107 @@ import java.io.IOException; -public class InputEmptyCatchBlockViolationsByComment -{ - private void foo() { - try { - throw new RuntimeException(); - } catch (Exception expected) //ok - { - //Expected - } +/** some javadoc. */ +public class InputEmptyCatchBlockViolationsByComment { + private void foo() { + try { + throw new RuntimeException(); + } catch (Exception expected) { // ok + // Expected } + } - private void foo1() { - try { - throw new RuntimeException(); - } catch (Exception e) - {} // warn + private void foo1() { + try { + throw new RuntimeException(); + } catch (Exception e) { + } // violation above 'Empty catch block.' + } - } + private void foo2() { + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException ignore) { + } // violation above 'Empty catch block.' + } - private void foo2() { - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException ignore) - /*warn*/ { - } + private void foo3() { // comment + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException e) { // This is expected } + } - private void foo3() { // comment - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException e) { //This is expected - } + private void foo4() { + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException e) { + /* This is expected*/ } + } - private void foo4() { - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException e) { /* This is expected*/ - } + private void foo5() { + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException e) { // singleline comment } + } - private void foo5() { - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException e) { // singleline comment - } - } - private void some() { - try { - throw new IOException(); - } catch (IOException e) //ok - { - /* ololo - * blalba - */ - } + private void some() { + try { + throw new IOException(); + } catch (IOException e) { // ok + /* ololo + * blalba + */ } - private void some1() { - try { - throw new IOException(); - } catch (IOException e) //ok - { - /* lalala - * This is expected - */ - } + } + + private void some1() { + try { + throw new IOException(); + } catch (IOException e) { // ok + /* lalala + * This is expected + */ } - private void some2() { - try { - throw new IOException(); - } catch (IOException e) //ok - { - /* - * This is expected - * lalala - */ - } + } + + private void some2() { + try { + throw new IOException(); + } catch (IOException e) { // ok + /* + * This is expected + * lalala + */ } - private void some3() { - try { - throw new IOException(); - } catch (IOException e) //ok - { - // some comment - //This is expected - } + } + + private void some3() { + try { + throw new IOException(); + } catch (IOException e) { // ok + // some comment + // This is expected } - private void some4() { - try { - throw new IOException(); - } catch (IOException e) //ok - { - //This is expected - // some comment - } + } + + private void some4() { + try { + throw new IOException(); + } catch (IOException e) { // ok + // This is expected + // some comment } - private void some5() { - try { - throw new IOException(); - } catch (IOException e) //ok - { - /* some comment */ - //This is expected - } + } + + private void some5() { + try { + throw new IOException(); + } catch (IOException e) { // ok + /* some comment */ + // This is expected } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByVariableName.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByVariableName.java index 231eb850a67..8a4bede1b87 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByVariableName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyCatchBlockViolationsByVariableName.java @@ -2,62 +2,56 @@ import java.io.IOException; -public class InputEmptyCatchBlockViolationsByVariableName -{ - private void foo() { - try { - throw new RuntimeException(); - } catch (Exception expected) //ok - { - - } - } - - private void foo1() { - try { - throw new RuntimeException(); - } catch (Exception e) - {} // warn - - } - - private void foo2() { - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException expected) //ok - { - } - } +/** some javadoc. */ +public class InputEmptyCatchBlockViolationsByVariableName { + private void foo() { + try { + throw new RuntimeException(); + } catch (Exception expected) { // ok - private void foo3() { // comment - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException e) - /*warn*/ { - } } - - private void foo4() { - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException expected) //ok - { - } + } + + private void foo1() { + try { + throw new RuntimeException(); + } catch (Exception e) { + } // violation above 'Empty catch block.' + } + + private void foo2() { + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException expected) { // ok } - - private void foo5() { - try { - throw new IOException(); - } catch (IOException | NullPointerException | ArithmeticException e) - /*warn*/ { - } - } - private void some() { - try { - throw new IOException(); - } catch (IOException e) - /*warn*/ { - - } + } + + private void foo3() { // comment + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException e) { + } // violation above 'Empty catch block.' + } + + private void foo4() { + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException expected) { // ok } + } + + private void foo5() { + try { + throw new IOException(); + } catch (IOException | NullPointerException | ArithmeticException e) { + } // violation above 'Empty catch block.' + } + + private void some() { + try { + throw new IOException(); + } catch (IOException e) { + + } // violation 2 lines above 'Empty catch block.' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyFinallyBlocks.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyFinallyBlocks.java new file mode 100644 index 00000000000..bf6b38863c0 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule413emptyblocks/InputEmptyFinallyBlocks.java @@ -0,0 +1,100 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2001 +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule413emptyblocks; + +class InputEmptyFinallyBlocks { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { // ok + /* ignore */ + } // ok + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + // violation below 'Empty catch block.' + } catch (Exception e) { + } finally { + } // violation above 'Empty finally block.' + } + + class Inner { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { // ok + /* ignore */ + } // ok + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + // violation below 'Empty catch block.' + } catch (Exception e) { + } finally { + } // violation above 'Empty finally block.' + } + } + + Inner anon = + new Inner() { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { // ok + /* ignore */ + } // ok + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + // violation below 'Empty catch block.' + } catch (Exception e) { + } finally { + } // violation above 'Empty finally block.' + } + }; + + interface InterfaceEndingWithSemiColon2 { + public void fooEmpty(); + } + + ; // ok until #7541 +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/ClassWithChainedMethods.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/ClassWithChainedMethods.java new file mode 100644 index 00000000000..67fbdfbe896 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/ClassWithChainedMethods.java @@ -0,0 +1,31 @@ +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +/** some javadoc. */ +public class ClassWithChainedMethods { + + public ClassWithChainedMethods(Object... params) {} + + /** some javadoc. */ + public static void main(String[] args) { + new ClassWithChainedMethods() + .getInstance("string_one") + .doNothing("string_one".trim(), "string_two"); + // violation above ''method call' child has incorrect indentation level 4, expected .* 8.' + + int length = + new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length(); + // violation above ''new' has incorrect indentation level 4, expected .* 8.' + + int length2 = + new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length(); + // violation above ''new' has incorrect indentation level 4, expected .* 8.' + } + + public String doNothing(String something, String... uselessParams) { + return something; + } + + public ClassWithChainedMethods getInstance(String... uselessParams) { + return this; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/ClassWithChainedMethodsCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/ClassWithChainedMethodsCorrect.java new file mode 100644 index 00000000000..28c95bd78cd --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/ClassWithChainedMethodsCorrect.java @@ -0,0 +1,23 @@ +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +/** some javadoc. */ +public class ClassWithChainedMethodsCorrect { + /** some javadoc. */ + public ClassWithChainedMethodsCorrect() { + + String someString = ""; + + String chained1 = doNothing(someString.concat("zyx").concat("255, 254, 253")); + + doNothing(someString.concat("zyx").concat("255, 254, 253")); + } + + public static void main(String[] args) { + ClassWithChainedMethodsCorrect classWithChainedMethodsCorrect = + new ClassWithChainedMethodsCorrect(); + } + + public String doNothing(String something) { + return something; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputFastMatcher.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputFastMatcher.java index 3d3d24aa96c..383f9d027db 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputFastMatcher.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputFastMatcher.java @@ -1,42 +1,35 @@ package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; -public class InputFastMatcher -{ - - public boolean matches(char c) - { - // OOOO Auto-generated method stub - return false; - } - - public String replaceFrom(CharSequence sequence, CharSequence replacement) - { - // OOOO Auto-generated method stub - return null; - } - - public String collapseFrom(CharSequence sequence, char replacement) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimFrom(CharSequence s) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimLeadingFrom(CharSequence sequence) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimTrailingFrom(CharSequence sequence) - { - // OOOO Auto-generated method stub - return null; - } - +/** some javadoc. */ +public class InputFastMatcher { + + public boolean matches(char c) { + // OOOO Auto-generated method stub + return false; + } + + public String replaceFrom(CharSequence sequence, CharSequence replacement) { + // OOOO Auto-generated method stub + return null; + } + + public String collapseFrom(CharSequence sequence, char replacement) { + // OOOO Auto-generated method stub + return null; + } + + public String trimFrom(CharSequence s) { + // OOOO Auto-generated method stub + return null; + } + + public String trimLeadingFrom(CharSequence sequence) { + // OOOO Auto-generated method stub + return null; + } + + public String trimTrailingFrom(CharSequence sequence) { + // OOOO Auto-generated method stub + return null; + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrect.java index 3fea081a52e..4cda53031fa 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrect.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrect.java @@ -1,113 +1,106 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -import java.util.Map; //indent:0 exp:0 -import java.util.ArrayList;//indent:0 exp:0 - -public abstract class InputIndentationCorrect { //indent:0 exp:0 - - static int i; //indent:2 exp:2 - - int[] c = {1, 2, 3, //indent:2 exp:2 - 4, 5, 6}; //indent:6 exp:6 - - int b; //indent:2 exp:2 - - static { //indent:2 exp:2 - i = 0; //indent:4 exp:4 - } //indent:2 exp:2 - - { //indent:2 exp:2 - b = 2; //indent:4 exp:4 - } //indent:2 exp:2 - - private static abstract class RangesMatcher { //indent:2 exp:2 - - private static final String ZEROES = "0\u0660\u06f0" //indent:4 exp:4 - + "\u0c66\u0ce6" //indent:8 exp:8 - + "\u1c40\u1c50"; //indent:8 exp:8 - - public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = //indent:4 exp:4 - new InputIndentationCorrect() { //indent:8 exp:8 - @Override public boolean matches(char c) { //indent:10 exp:10 - return Character.isLetterOrDigit(c); //indent:12 exp:12 - } //indent:10 exp:10 - }; //indent:8 exp:8 - - /** Matches no characters. */ //indent:4 exp:4 - public static final InputFastMatcher NONE = //indent:4 exp:4 - new InputFastMatcher() { //indent:12 exp:>=8 - @Override public boolean matches(char c) { //indent:6 exp:6 - return false; //indent:8 exp:8 - } //indent:6 exp:6 - - @Override public String replaceFrom(CharSequence seq, CharSequence repl) { //indent:6 exp:6 - checkNotNull(repl); //indent:8 exp:8 - return seq.toString(); //indent:8 exp:8 - } //indent:6 exp:6 - - private void checkNotNull(CharSequence replacement) {} //indent:6 exp:6 - - @Override public String collapseFrom(CharSequence sequence, //indent:6 exp:6 - char replacement) { //indent:10 exp:10 - return sequence.toString(); //indent:8 exp:8 - } //indent:6 exp:6 - - @Override //indent:6 exp:6 - public String trimTrailingFrom(CharSequence sequence) { //indent:6 exp:6 - return sequence.toString(); //indent:8 exp:8 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean matches(char c) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public void foo() { //indent:2 exp:2 - int i = 0; //indent:4 exp:4 - for (; i < 9; i++) { //indent:4 exp:4 - if (veryLongLongLongCondition() //indent:6 exp:6 - || veryLongLongLongCondition2()) { //indent:14 exp:>=10 - someFooMethod("longString", "veryLongString", //indent:8 exp:8 - "superVeryExtraLongString"); //indent:12 exp:12 - if (veryLongLongLongCondition()) { //indent:8 exp:8 - while (veryLongLongLongCondition2() //indent:10 exp:10 - && veryLongLongLongCondition2()) { //indent:16 exp:>=14 - try { //indent:12 exp:12 - doSmth(); //indent:14 exp:14 - } catch (Exception e) { //indent:12 exp:12 - throw new AssertionError(e); //indent:14 exp:14 - } //indent:12 exp:12 - } //indent:10 exp:10 - } //indent:8 exp:8 - } //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean veryLongLongLongCondition() { //indent:2 exp:2 - if (veryLongLongLongCondition2()) { //indent:4 exp:4 - return true; //indent:6 exp:6 - } //indent:4 exp:4 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean veryLongLongLongCondition2() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public void someFooMethod(String longString, //indent:2 exp:2 - String superLongString, String exraSuperLongString) {} //indent:6 exp:6 - - public void fooThrowMethod() //indent:2 exp:2 - throws Exception { //indent:10 exp:>=6 - /* Some code*/ //indent:6 exp:6 - } //indent:2 exp:2 - - public void doSmth() { //indent:2 exp:2 - for (int h //indent:4 exp:4 - : c) { //indent:10 exp:>=8 - someFooMethod("longString", "veryLongString", //indent:6 exp:6 - "superVeryExtraLongString"); //indent:10 exp:10 - } //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +/** some javadoc. */ +public abstract class InputIndentationCorrect { + + static int i; + + static { + i = 0; + } + + int[] pqr = { + 1, 2, 3, + 4, 5, 6 + }; + int abc; + + { + abc = 2; + } + + public boolean matches(char c) { + return false; + } + + /** some javadoc. */ + public void foo() { + int i = 0; + for (; i < 9; i++) { + if (veryLongLongLongCondition() || veryLongLongLongCondition2()) { + someFooMethod("longString", "veryLongString", "superVeryExtraLongString"); + if (veryLongLongLongCondition()) { + while (veryLongLongLongCondition2() && veryLongLongLongCondition2()) { + try { + doSmth(); + } catch (Exception e) { + throw new AssertionError(e); + } + } + } + } + } + } + + public boolean veryLongLongLongCondition() { + return veryLongLongLongCondition2(); + } + + public boolean veryLongLongLongCondition2() { + return false; + } + + public void someFooMethod( + String longString, String superLongString, String exraSuperLongString) {} + + public void fooThrowMethod() throws Exception { + /* Some code*/ + } + + /** some javadoc. */ + public void doSmth() { + for (int h : pqr) { + someFooMethod("longString", "veryLongString", "superVeryExtraLongString"); + } + } + + private abstract static class RangesMatcher { + + public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = + new InputIndentationCorrect() { + @Override + public boolean matches(char c) { + return Character.isLetterOrDigit(c); + } + }; + + /** Matches no characters. */ + public static final InputFastMatcher NONE = + new InputFastMatcher() { + @Override + public boolean matches(char c) { + return false; + } + + @Override + public String replaceFrom(CharSequence seq, CharSequence repl) { + checkNotNull(repl); + return seq.toString(); + } + + private void checkNotNull(CharSequence replacement) {} + + @Override + public String collapseFrom(CharSequence sequence, char replacement) { + return sequence.toString(); + } + + @Override + public String trimTrailingFrom(CharSequence sequence) { + return sequence.toString(); + } + }; + + private static final String ZEROES = "" + ""; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectAnnotationArrayInit.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectAnnotationArrayInit.java new file mode 100644 index 00000000000..dacf946df7f --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectAnnotationArrayInit.java @@ -0,0 +1,13 @@ +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +/** some javadoc. */ +public class InputIndentationCorrectAnnotationArrayInit { + interface MyInterface { + @AnAnnotation(values = {"Hello"}) + void works(); + + @interface AnAnnotation { + String[] values(); + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectClass.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectClass.java index ea6ad0aed79..0531056c381 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectClass.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectClass.java @@ -1,45 +1,33 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -import java.util.Iterator; //indent:0 exp:0 - -public class InputIndentationCorrectClass //indent:0 exp:0 - implements Runnable, Cloneable { //indent:4 exp:4 - - class InnerClass implements //indent:2 exp:2 - Iterable, //indent:10 exp:>=6 - Cloneable { //indent:13 exp:>=6 - @Override //indent:4 exp:4 - public Iterator iterator() { //indent:4 exp:4 - return null; //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClass2 //indent:2 exp:2 - extends //indent:7 exp:>=6 - SecondClassReturnWithVeryVeryVeryLongName { //indent:10 exp:>=6 - public InnerClass2(String string) { //indent:4 exp:4 - super(); //indent:6 exp:6 - // OOOO Auto-generated constructor stub //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - @Override //indent:2 exp:2 - public void run() { //indent:2 exp:2 - SecondClassWithLongLongLongLongName anon = //indent:4 exp:4 - new SecondClassWithLongLongLongLongName() { //indent:10 exp:>=8 - - }; //indent:4 exp:4 - - SecondClassWithLongLongLongLongName anon2 = new //indent:4 exp:4 - SecondClassWithLongLongLongLongName() { //indent:10 exp:>=8 - - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassWithLongLongLongLongName //indent:0 exp:0 - extends //indent:4 exp:4 - InputIndentationCorrectClass{ //indent:9 exp:>=4 - -} //indent:0 exp:0 -class SecondClassReturnWithVeryVeryVeryLongName{} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +import java.util.Iterator; + +/** some javadoc. */ +public class InputIndentationCorrectClass implements Runnable, Cloneable { + + /** some javadoc. */ + @Override + public void run() { + SecondClassWithLongLongLongLongName anon = new SecondClassWithLongLongLongLongName() {}; + + SecondClassWithLongLongLongLongName anon2 = new SecondClassWithLongLongLongLongName() {}; + } + + class InnerClass implements Iterable, Cloneable { + @Override + public Iterator iterator() { + return null; + } + } + + class InnerClass2 extends SecondClassReturnWithVeryVeryVeryLongName { + public InnerClass2(String string) { + super(); + // OOOO Auto-generated constructor stub + } + } + + class SecondClassWithLongLongLongLongName extends InputIndentationCorrectClass {} + + class SecondClassReturnWithVeryVeryVeryLongName {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectFieldAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectFieldAndParameter.java index dcdb3412d6a..732ebb374da 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectFieldAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectFieldAndParameter.java @@ -1,127 +1,156 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -class InputIndentationCorrectFieldAndParameter { //indent:0 exp:0 - - boolean flag = conditionFirst("Loooooooooooooooooong", new //indent:2 exp:2 - SecondFieldLongNam2("Loooooooooooooooooog"). //indent:6 exp:6 - getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:6 exp:6 - new InnerClassFoo()); //indent:6 exp:6 - - boolean secondFlag = conditionSecond(10000000000.0, new //indent:2 exp:2 - SecondFieldLongNam2("Looooooooooooo" //indent:6 exp:6 - + "oooooooooooong").getString(new FooFieldClass(), //indent:6 exp:6 - new SecondFieldLongNam2("loooooooooong"). //indent:6 exp:6 - getInteger(new FooFieldClass(), "loooooooooooooong")), "loooooooooooong") //indent:6 exp:6 - || conditionThird(2048) || conditionFourth(new //indent:6 exp:6 - SecondFieldLongNam2("Looooooooooooooo" //indent:6 exp:6 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:6 exp:6 - conditionFifth(true, new SecondFieldLongNam2(getString(2048, "Looo" //indent:6 exp:6 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:6 exp:6 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:6 exp:6 - SecondFieldLongNam2(getString(100000, "Loooooong" //indent:6 exp:6 - + "Fooooooo><"))) || conditionNoArg() //indent:6 exp:6 - || conditionNoArg() || //indent:6 exp:6 - conditionNoArg() || conditionNoArg(); //indent:6 exp:6 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondFieldLongNam2 instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - boolean flag = conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondFieldLongNam2("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:12 exp:>=8 - new InnerClassFoo()); //indent:13 exp:>=8 - - boolean secondFlag = conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondFieldLongNam2("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooFieldClass(), //indent:11 exp:>=8 - new SecondFieldLongNam2("loooooooooong"). //indent:10 exp:>=8 - getInteger(new FooFieldClass(), "looooooooong")), "loooooooooooong") //indent:12 exp:>=8 - || conditionThird(2048) || conditionFourth(new //indent:13 exp:>=8 - SecondFieldLongNam2("Looooooooooooooo" //indent:16 exp:>=8 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:12 exp:>=8 - conditionFifth(true, new SecondFieldLongNam2(getString(2048, "Looo" //indent:11 exp:>=8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:15 exp:>=8 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:12 exp:>=8 - SecondFieldLongNam2(getString(100000, "Loooooong" //indent:12 exp:>=8 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=8 - || conditionNoArg() || //indent:10 exp:>=8 - conditionNoArg() || conditionNoArg(); //indent:10 exp:>=8 - - FooFieldClass anonymousClass = new FooFieldClass() { //indent:4 exp:4 - boolean secondFlag = conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondFieldLongNam2("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooFieldClass(), //indent:12 exp:>=10 - new SecondFieldLongNam2("loooooooooong"). //indent:15 exp:>=10 - getInteger(new FooFieldClass(), "looooooong")), "loooooooooooong") //indent:13 exp:>=10 - || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=10 - SecondFieldLongNam2("Looooooooooooooo" //indent:17 exp:>=10 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:13 exp:>=10 - conditionFifth(true, new SecondFieldLongNam2(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:16 exp:>=10 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:13 exp:>=8 - SecondFieldLongNam2(getString(100000, "Loooooong" //indent:13 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:17 exp:>=10 - || conditionNoArg() || //indent:11 exp:>=10 - conditionNoArg() || conditionNoArg(); //indent:11 exp:>=10 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondFieldLongNam2 { //indent:0 exp:0 - - public SecondFieldLongNam2(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooFieldClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooFieldClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooFieldClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondFieldLongNam2 getInstance() { //indent:2 exp:2 - return new SecondFieldLongNam2("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooFieldClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +class InputIndentationCorrectFieldAndParameter { + + boolean flag = + conditionFirst( + "Loooooooooooooooooong", + new SecondFieldLongNam2("Loooooooooooooooooog") + .getInteger(new FooFieldClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + + boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + + String getString(int someInt, String someString) { + return "String"; + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondFieldLongNam2 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + boolean flag = + conditionFirst( + "Loooooooooooooooooong", + new SecondFieldLongNam2("Loooooooooooooooooog") + .getInteger(new FooFieldClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + + boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "looooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + + FooFieldClass anonymousClass = + new FooFieldClass() { + final boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "looooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString( + 2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + }; + } + + class SecondFieldLongNam2 { + + public SecondFieldLongNam2(String string) {} + + String getString(FooFieldClass instance, int integer) { + return "String"; + } + + int getInteger(FooFieldClass instance, String string) { + return -1; + } + + boolean getBoolean(FooFieldClass instance, boolean flag) { + return false; + } + + SecondFieldLongNam2 getInstance() { + return new SecondFieldLongNam2("VeryLoooooooooo" + "oongString"); + } + } + + class FooFieldClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectForAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectForAndParameter.java index 3f252ed83d6..1a521b964f4 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectForAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectForAndParameter.java @@ -1,113 +1,126 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -import java.util.ArrayList; //indent:0 exp:0 -import java.util.HashMap; //indent:0 exp:0 -import java.util.Iterator; //indent:0 exp:0 -import java.util.List; //indent:0 exp:0 -import java.util.Map; //indent:0 exp:0 - -class InputIndentationCorrectForAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - for (int i = 1; i < 10; i ++) {} //indent:4 exp:4 - - for (int i = new SecondForClassWithLongName1("Loooooooooooooooooooo" //indent:4 exp:4 - + "oong").getInteger(new FooForClass(), //indent:8 exp:8 - getString(1000000000, "Loooooooooooooooong")); i < 10; i++) {} //indent:10 exp:>=8 - - for (Map.Entry entry : new SecondForClassWithLongName1("Loo" //indent:4 exp:4 - + "ooooooooooooooooooooong").getMap(new //indent:8 exp:8 - FooForClass(), 10000000, //indent:8 exp:8 - getString(10000, "Loooooooooo" //indent:8 exp:8 - + "ooooong")).entrySet()) {} //indent:8 exp:8 - - for (Map.Entry entry : new SecondForClassWithLongName1("Loo" //indent:4 exp:4 - + "ooooooooooooooooooooong").getMap(new //indent:8 exp:8 - FooForClass(), 10000000, //indent:12 exp:>=8 - getString(10000, "Loooooooooo" //indent:10 exp:>=8 - + "ooooong")).entrySet()) {} //indent:15 exp:>=8 - - for (String string : new SecondForClassWithLongName1(getString(1024 //indent:4 exp:4 - , "Looooooooooooooooooong")). //indent:8 exp:8 - getList(new FooForClass(), 1000, getString(1024, //indent:8 exp:8 - "Loooooooooooooooooooooooooooooooo" //indent:8 exp:8 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:8 exp:8 - + "oooooooooong"))) {} //indent:8 exp:8 - - for (String string : new SecondForClassWithLongName1(getString(1024 //indent:4 exp:4 - , "Looooooooooooooooooong")). //indent:8 exp:8 - getList(new FooForClass(), 1000, getString(1024, //indent:12 exp:>=8 - "Loooooooooooooooooooooooooooooooo" //indent:14 exp:>=8 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:10 exp:>=8 - + "oooooooooong"))) {} //indent:13 exp:>=8 - - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - - for (int i = 1; i < 10; i ++) {} //indent:6 exp:6 - - for (int i = new SecondForClassWithLongName1("Loooooooooooooooooooo" //indent:6 exp:6 - + "oong").getInteger(new FooForClass(), //indent:10 exp:10 - getString(1000000000, "Loooooooooooooooong")); i < 10; i++) {} //indent:12 exp:>=10 - - for (Map.Entry entry : new SecondForClassWithLongName1("Loo" //indent:6 exp:6 - + "ooooooooooooooooooooong").getMap(new //indent:10 exp:10 - FooForClass(), 10000000, //indent:10 exp:10 - getString(10000, "Loooooooooo" //indent:10 exp:10 - + "ooooong")).entrySet()) {} //indent:10 exp:10 - - for (Map.Entry entry : new SecondForClassWithLongName1("Loo" //indent:6 exp:6 - + "ooooooooooooooooooooong").getMap(new //indent:12 exp:>=10 - FooForClass(), 10000000, //indent:13 exp:>=10 - getString(10000, "Loooooooooo" //indent:18 exp:>=10 - + "ooooong")).entrySet()) {} //indent:15 exp:>=10 - - for (String string : new SecondForClassWithLongName1(getString(1024 //indent:6 exp:6 - , "Looooooooooooooooooong")). //indent:10 exp:10 - getList(new FooForClass(), 1000, getString(1024, //indent:10 exp:10 - "Loooooooooooooooooooooooooooooooo" //indent:10 exp:10 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:10 exp:10 - + "oooooooooong"))) {} //indent:10 exp:10 - - for (String string : new SecondForClassWithLongName1(getString(1024 //indent:6 exp:6 - , "Looooooooooooooooooong")). //indent:15 exp:>=10 - getList(new FooForClass(), 1000, getString(1024, //indent:13 exp:>=10 - "Loooooooooooooooooooooooooooooooo" //indent:19 exp:>=10 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:21 exp:>=10 - + "oooooooooong"))) {} //indent:10 exp:10 - } //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondForClassWithLongName1 //indent:0 exp:0 - implements Iterable{ //indent:8 exp:>=4 - - public SecondForClassWithLongName1(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - int getInteger(FooForClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - Map getMap(FooForClass instance, int integer, String string) { //indent:2 exp:2 - return new HashMap(); //indent:4 exp:4 - } //indent:2 exp:2 - - List getList(FooForClass instance, long longLong, String string) { //indent:2 exp:2 - return new ArrayList(); //indent:4 exp:4 - } //indent:2 exp:2 - - public Iterator iterator() { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooForClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +class InputIndentationCorrectForAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + for (int i = 1; i < 10; i++) {} + + for (int i = + new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong") + .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong")); + i < 10; + i++) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + } + + class InnerClassFoo { + + void fooMethodWithIf() { + + for (int i = 1; i < 10; i++) {} + + for (int i = + new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong") + .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong")); + i < 10; + i++) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + } + } + + class SecondForClassWithLongName1 implements Iterable { + + public SecondForClassWithLongName1(String string) {} + + int getInteger(FooForClass instance, String string) { + return -1; + } + + Map getMap(FooForClass instance, int integer, String string) { + return new HashMap(); + } + + List getList(FooForClass instance, long longLong, String string) { + return new ArrayList(); + } + + public Iterator iterator() { + return null; + } + } + + class FooForClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectIfAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectIfAndParameter.java index 080ac7a287e..2ff226031e4 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectIfAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectIfAndParameter.java @@ -1,144 +1,180 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -class InputIndentationCorrectIfAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - if (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondClassLongNam3("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:8 exp:8 - new InnerClassFoo())) {} //indent:8 exp:8 - - if (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongNam3("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooIfClass(), //indent:8 exp:8 - new SecondClassLongNam3("loooooooooong"). //indent:8 exp:10,12 warn - getInteger(new FooIfClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongNam3("Looooooooooooooo" //indent:8 exp:8 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongNam3(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooIfClass(), true)) || conditionSixth(false, new //indent:8 exp:10,12 warn - SecondClassLongNam3(getString(100000, "Loooooong" //indent:8 exp:8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:8 exp:8 - conditionNoArg() || conditionNoArg()) {} //indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondClassLongNam3 instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - if (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondClassLongNam3("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())) {} //indent:14 exp:>=10 - - if (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondClassLongNam3("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooIfClass(), //indent:10 exp:10 - new SecondClassLongNam3("loooooooooong"). //indent:10 exp:12,14 warn - getInteger(new FooIfClass(), "loooooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondClassLongNam3("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondClassLongNam3(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooIfClass(), true)) || conditionSixth(false, new //indent:12 exp:14,16 warn - SecondClassLongNam3(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooIfClass anonymousClass = new FooIfClass() { //indent:4 exp:4 - - void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - if (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondClassLongNam3("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())) {} //indent:19 exp:>=12 - - if (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondClassLongNam3("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooIfClass(), //indent:12 exp:12 - new SecondClassLongNam3("loooooooooong"). //indent:12 exp:14,16 warn - getInteger(new FooIfClass(), "looooooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondClassLongNam3("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondClassLongNam3(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooIfClass(), true)) || conditionSixth(false, new //indent:14 exp:16,18 warn - SecondClassLongNam3(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassLongNam3 { //indent:0 exp:0 - - public SecondClassLongNam3(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooIfClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooIfClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooIfClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongNam3 getInstance() { //indent:2 exp:2 - return new SecondClassLongNam3("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooIfClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +class InputIndentationCorrectIfAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) { + /* foo */ + } + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondClassLongNam3 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooIfClass anonymousClass = + new FooIfClass() { + + void fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "looooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName) { + /* foo */ + } + } + }; + + void fooMethodWithIf() { + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) { + /* foo */ + } + } + } + + class SecondClassLongNam3 { + + public SecondClassLongNam3(String string) {} + + String getString(FooIfClass instance, int integer) { + return "String"; + } + + int getInteger(FooIfClass instance, String string) { + return -1; + } + + boolean getBoolean(FooIfClass instance, boolean flag) { + return false; + } + + SecondClassLongNam3 getInstance() { + return new SecondClassLongNam3("VeryLoooooooooo" + "oongString"); + } + } + + class FooIfClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectNewChildren.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectNewChildren.java new file mode 100644 index 00000000000..c040d1bedbc --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectNewChildren.java @@ -0,0 +1,26 @@ +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +/** some javadoc. */ +public class InputIndentationCorrectNewChildren { + + private final StringBuffer filter = + new StringBuffer( + new CharSequence() { + @Override + public char charAt(int index) { + return 'A'; + } + + public int length() { + return 1; + } + + public CharSequence subSequence(int start, int end) { + return this; + } + + public String toString() { + return "Foo"; + } + }); +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectReturnAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectReturnAndParameter.java index 4f8a483598c..8f17cfbcc2a 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectReturnAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectReturnAndParameter.java @@ -1,143 +1,166 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -class InputIndentationCorrectReturnAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean fooMethodWithIf() { //indent:2 exp:2 - - return conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongNam4("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooReturnClass(), //indent:8 exp:8 - new SecondClassLongNam4("loooooooooong"). //indent:8 exp:8 - getInteger(new FooReturnClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongNam4("Looooooooooooooo" //indent:8 exp:8 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongNam4(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondClassLongNam4(getString(100000, "Loooooong" //indent:8 exp:8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:8 exp:8 - conditionNoArg() || conditionNoArg();//indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondClassLongNam4 instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - boolean fooMethodWithIf() { //indent:4 exp:4 - return conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondClassLongNam4("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooReturnClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo()); //indent:14 exp:>=10 - } //indent:4 exp:4 - - boolean fooReturn() { //indent:4 exp:4 - return conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondClassLongNam4("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooReturnClass(), //indent:10 exp:10 - new SecondClassLongNam4("loooooooooong"). //indent:10 exp:10 - getInteger(new FooReturnClass(), "looooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondClassLongNam4("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondClassLongNam4(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondClassLongNam4(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg(); //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooReturnClass anonymousClass = new FooReturnClass() { //indent:4 exp:4 - - boolean fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - return conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondClassLongNam4("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooReturnClass(), //indent:12 exp:12 - new SecondClassLongNam4("loooooooooong"). //indent:12 exp:12 - getInteger(new FooReturnClass(), "looooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondClassLongNam4("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondClassLongNam4(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondClassLongNam4(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName; //indent:21 exp:>=12 - } //indent:6 exp:6 - - boolean fooReturn() { //indent:6 exp:6 - return conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondClassLongNam4("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooReturnClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo()); //indent:19 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassLongNam4 { //indent:0 exp:0 - - public SecondClassLongNam4(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooReturnClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooReturnClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooReturnClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongNam4 getInstance() { //indent:2 exp:2 - return new SecondClassLongNam4("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooReturnClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +class InputIndentationCorrectReturnAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + boolean fooMethodWithIf() { + + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondClassLongNam4 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooReturnClass anonymousClass = + new FooReturnClass() { + + boolean fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "looooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName; + } + + boolean fooReturn() { + return conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam4("Loooooooooooooooooog") + .getInteger(new FooReturnClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + } + }; + + boolean fooMethodWithIf() { + return conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam4("Loooooooooooooooooog") + .getInteger(new FooReturnClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + } + + boolean fooReturn() { + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "looooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + } + } + + class SecondClassLongNam4 { + + public SecondClassLongNam4(String string) {} + + String getString(FooReturnClass instance, int integer) { + return "String"; + } + + int getInteger(FooReturnClass instance, String string) { + return -1; + } + + boolean getBoolean(FooReturnClass instance, boolean flag) { + return false; + } + + SecondClassLongNam4 getInstance() { + return new SecondClassLongNam4("VeryLoooooooooo" + "oongString"); + } + } + + class FooReturnClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectWhileDoWhileAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectWhileDoWhileAndParameter.java index a82cda948d3..59a5b2e7b69 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectWhileDoWhileAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule42blockindentation/InputIndentationCorrectWhileDoWhileAndParameter.java @@ -1,221 +1,270 @@ -package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; //indent:0 exp:0 - -class InputIndentationCorrectWhileDoWhileAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondWhileLongNam1("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:11 exp:>=8 - new InnerClassFoo())) {} //indent:10 exp:>=8 - - do { //indent:4 exp:4 - - } while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondWhileLongNam1("Loooooooooooooooooog"). //indent:9 exp:>=8 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:15 exp:>=8 - new InnerClassFoo())); //indent:9 exp:>=8 - - while (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondWhileLongNam1("Looooooooooooo" //indent:9 exp:>=8 - + "oooooooooooong").getString(new FooWhileClass(), //indent:8 exp:8 - new SecondWhileLongNam1("loooooooooong"). //indent:11 exp:>=8 - getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=8 - SecondWhileLongNam1("Looooooooooooooo" //indent:14 exp:>=8 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondWhileLongNam1( //indent:12 exp:>=8 - getString(2048, "Looo" //indent:12 exp:>=8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondWhileLongNam1(getString(100000, "Loooooong" //indent:11 exp:>=8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:10 exp:>=8 - conditionNoArg() || conditionNoArg()) {} //indent:10 exp:10 - - do { //indent:4 exp:4 - - } while (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondWhileLongNam1("Looooooooooooo" //indent:10 exp:>=8 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:>=8 - new SecondWhileLongNam1("loooooooooong"). //indent:8 exp:8 - getInteger(new FooWhileClass(), "loooooooong")), "loooooooooooong") //indent:13 exp:>=8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondWhileLongNam1("Looooooooooooooo" //indent:11 exp:>=8 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondWhileLongNam1(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondWhileLongNam1(getString(100000, "Loooooong" //indent:11 exp:>=8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:13 exp:>=8 - conditionNoArg() || conditionNoArg()); //indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondWhileLongNam1 instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondWhileLongNam1("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())) {} //indent:14 exp:>=10 - - do { //indent:6 exp:6 - /* Do something*/ //indent:8 exp:8 - } while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondWhileLongNam1("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())); //indent:14 exp:>=10 - - while (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondWhileLongNam1("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10 - new SecondWhileLongNam1("loooooooooong"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "loooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondWhileLongNam1("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondWhileLongNam1(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondWhileLongNam1(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10 - - do { //indent:6 exp:6 - /* Do smth*/ //indent:8 exp:8 - } while (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondWhileLongNam1("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10 - new SecondWhileLongNam1("loooooooooong"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "loooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondWhileLongNam1("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondWhileLongNam1(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondWhileLongNam1(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()); //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooWhileClass anonymousClass = new FooWhileClass() { //indent:4 exp:4 - - void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondWhileLongNam1("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())) {} //indent:19 exp:>=12 - - do { //indent:8 exp:8 - /* Do smth*/ //indent:10 exp:10 - } while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondWhileLongNam1("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())); //indent:19 exp:>=12 - - while (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondWhileLongNam1("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12 - new SecondWhileLongNam1("loooooooooong"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "loooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondWhileLongNam1("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondWhileLongNam1(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondWhileLongNam1(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12 - - do { //indent:8 exp:8 - /* Do smth*/ //indent:10 exp:10 - } while (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondWhileLongNam1("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12 - new SecondWhileLongNam1("loooooooooong"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "loooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondWhileLongNam1("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondWhileLongNam1(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondWhileLongNam1(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName);//indent:21 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondWhileLongNam1 { //indent:0 exp:0 - - public SecondWhileLongNam1(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooWhileClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooWhileClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooWhileClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondWhileLongNam1 getInstance() { //indent:2 exp:2 - return new SecondWhileLongNam1("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooWhileClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule42blockindentation; + +class InputIndentationCorrectWhileDoWhileAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do {} while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) {} + + do {} while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()); + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondWhileLongNam1 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooWhileClass anonymousClass = + new FooWhileClass() { + + void fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do { + /* Do smth*/ + + } while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName) {} + + do { + /* Do smth*/ + + } while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName); + } + }; + + void fooMethodWithIf() { + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do { + /* Do something*/ + + } while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) {} + + do { + /* Do smth*/ + + } while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()); + } + } + + class SecondWhileLongNam1 { + + public SecondWhileLongNam1(String string) {} + + String getString(FooWhileClass instance, int integer) { + return "String"; + } + + int getInteger(FooWhileClass instance, String string) { + return -1; + } + + boolean getBoolean(FooWhileClass instance, boolean flag) { + return false; + } + + SecondWhileLongNam1 getInstance() { + return new SecondWhileLongNam1("VeryLoooooooooo" + "oongString"); + } + } + + class FooWhileClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputFormattedOneStatementPerLine.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputFormattedOneStatementPerLine.java new file mode 100644 index 00000000000..f789495f178 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputFormattedOneStatementPerLine.java @@ -0,0 +1,220 @@ +package com.google.checkstyle.test.chapter4formatting.rule43onestatement; + +// Two import statements on the same line are illegal. + +/** Some javadoc. */ +public class InputFormattedOneStatementPerLine { + + /** Dummy variable to work on. */ + private int one = 0; + + /** Dummy variable to work on. */ + private int two = 0; + + /** Simple legal method. */ + public void doLegal() { + one = 1; + two = 2; + } + + /** The illegal format is used within a String. Therefor the whole method is legal. */ + public void doLegalString() { + one = 1; + two = 2; + System.identityHashCode("one = 1; two = 2"); + } + + /** Within the for-header there are 3 Statements, but this is legal. */ + public void doLegalForLoop() { + for (int i = 0, j = 0, k = 1; i < 20; i++) { // it's ok. + one = i; + } + } + + /** Simplest form of illegal layouts. */ + public void doIllegal() { + one = 1; + two = 2; + if (one == 1) { + one++; + two++; + } + if (one != 1) { + one++; + } else { + one--; + } + int n = 10; + + doLegal(); + doLegal(); + while (one == 1) { + one++; + two--; + } + } + + /** + * While theoretically being distributed over two lines, this is a sample of 2 statements on one + * line. + */ + public void doIllegal2() { + one = 1; + two = 2; + } + + class Inner { + /** Dummy variable to work on. */ + private int one = 0; + + /** Dummy variable to work on. */ + private int two = 0; + + /** Simple legal method. */ + public void doLegal() { + one = 1; + two = 2; + } + + /** Simplest form a an illegal layout. */ + public void doIllegal() { + one = 1; + two = 2; + if (one == 1) { + one++; + two++; + } + if (one != 1) { + one++; + } else { + one--; + } + int n = 10; + + doLegal(); + doLegal(); + while (one == 1) { + one++; + two--; + } + } + } + + /** Two declaration statements on the same line are illegal. */ + int aaaa; + + int bbb; + + /** Two declaration statements which are not on the same line are legal. */ + int ccc; + + int dddd; + + /** Two assignment (declaration) statements on the same line are illegal. */ + int dog = 1; + + int cow = 2; + + /** Two assignment (declaration) statements on the different lines are legal. */ + int test1 = 1; + + int test2 = 2; + + /** This method contains two object creation statements on the same line. */ + private void foo() { + // Two object creation statements on the same line are illegal. + Object obj1 = new Object(); + Object obj2 = new Object(); + } + + int blah; + + int seven = 2; + + /** Two statements on the same line (they both are distributed over two lines) are illegal. */ + int var6 = 5; + + /** Two statements on the same line (they both are distributed over two lines) are illegal. */ + private void foo2() { + toString(); + toString(); + } + + int var11 = 2; + + /** Multiline for loop statement is legal. */ + private void foo3() { + for (int n = 0, k = 1; n < 5; n++, k--) {} + } + + /** This method contains break and while loop statements. */ + private void foo4() { + int var9 = 0; + int var10 = 0; + + do { + var9++; + if (var10 > 4) { + break; // legal + } + var11++; + var9++; + } while (var11 < 7); // legal + + /* + * One statement inside for block is legal + */ + for (int i = 0; i < 10; i++) { + one = 5; + } // legal + + /* + * One statement inside for block where + * increment expression is empty is legal + */ + for (int i = 0; i < 10; ) { + one = 5; + } // legal + + /* + One statement inside for block where + increment and conditional expressions are empty + (forever loop) is legal + */ + for (int i = 0; ; ) { + one = 5; + } // legal + } + + /** Some javadoc. */ + public void foo5() { + // a "forever" loop. + for (; ; ) {} // legal + } + + /** Some javadoc. */ + public void foo6() { + // One statement inside for block is legal + for (; ; ) { + one = 5; + } // legal + } + + int var1 = 0; + int var2 = 0; + + /** One statement inside multiline for loop is legal. */ + private void foo7() { + for (int n = 0, k = 1; n < 5; n++, k--) { + var1++; + } // legal + } + + /** Two statements on the same lne inside multiline for loop are illegal. */ + private void foo8() { + for (int n = 0, k = 1; n < 5; n++, k--) { + var1++; + var2++; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java index bf77830bbd5..11c0ba41572 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule43onestatement/InputOneStatementPerLine.java @@ -1,10 +1,10 @@ package com.google.checkstyle.test.chapter4formatting.rule43onestatement; -/** - * Two import statements on the same line are illegal. - */ -import java.io.EOFException; import java.io.BufferedReader; //warn +// Two import statements on the same line are illegal. +import java.io.BufferedReader; import java.io.EOFException; +// violation above 'Only one statement per line allowed.' +/** Some javadoc. */ public class InputOneStatementPerLine { /** @@ -47,15 +47,23 @@ public void doLegalForLoop() { * Simplest form of illegal layouts. */ public void doIllegal() { - one = 1; two = 2; //warn + one = 1; two = 2; // violation 'Only one statement per line allowed.' if (one == 1) { - one++; two++; //warn + one++; two++; // violation 'Only one statement per line allowed.' } - if (one != 1) { one++; } else { one--; } //warn + if (one != 1) { one++; } else { one--; } + // 3 violations above: + // ''{' at column 19 should have line break after.' + // ''{' at column 35 should have line break after.' + // 'Only one statement per line allowed.' int n = 10; - doLegal(); doLegal(); //warn - while (one == 1) {one++; two--;} //warn + doLegal(); doLegal(); // violation 'Only one statement per line allowed.' + while (one == 1) { one++; two--; } + // 3 violations above: + // ''{' at column 22 should have line break after.' + // 'Only one statement per line allowed.' + // ''}' at column 38 should be alone on a line.' } @@ -65,69 +73,80 @@ public void doIllegal() { */ public void doIllegal2() { one = 1 - ; two = 2; //warn + ; two = 2; // violation 'Only one statement per line allowed.' } - class Inner - { - /** - * Dummy variable to work on. - */ - private int one = 0; - - /** - * Dummy variable to work on. - */ - private int two = 0; - - /** - * Simple legal method. - */ - public void doLegal() { - one = 1; - two = 2; - } + class Inner { + /** + * Dummy variable to work on. + */ + private int one = 0; - /** - * Simplest form a an illegal layout. - */ - public void doIllegal() { - one = 1; two = 2; //warn - if (one == 1) { - one++; two++; //warn - } - if (one != 1) { one++; } else { one--; } //warn - int n = 10; + /** + * Dummy variable to work on. + */ + private int two = 0; - doLegal(); doLegal(); //warn - while (one == 1) {one++; two--;} //warn + /** + * Simple legal method. + */ + public void doLegal() { + one = 1; + two = 2; + } + /** + * Simplest form a an illegal layout. + */ + public void doIllegal() { + one = 1; two = 2; // violation 'Only one statement per line allowed.' + if (one == 1) { + one++; two++; // violation 'Only one statement per line allowed.' + } + if (one != 1) { one++; } else { one--; } + // 3 violations above: + // ''{' at column 21 should have line break after.' + // ''{' at column 37 should have line break after.' + // 'Only one statement per line allowed.' + int n = 10; + + doLegal(); doLegal(); // violation 'Only one statement per line allowed.' + while (one == 1) { + one++; two--; // violation 'Only one statement per line allowed.' } + + } } /** * Two declaration statements on the same line are illegal. */ - int a; int b; //warn + int aaaa; int bbb; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' /** * Two declaration statements which are not on the same line * are legal. */ - int c; - int d; + int ccc; + int dddd; /** * Two assignment (declaration) statements on the same line are illegal. */ - int e = 1; int f = 2; //warn + int dog = 1; int cow = 2; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' /** * Two assignment (declaration) statements on the different lines * are legal. */ - int g = 1; - int h = 2; + int test1 = 1; + int test2 = 2; /** * This method contains @@ -135,47 +154,53 @@ public void doIllegal() { */ private void foo() { //Two object creation statements on the same line are illegal. - Object obj1 = new Object(); Object obj2 = new Object(); //warn + Object obj1 = new Object(); Object obj2 = new Object(); + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' } /** * One multiline assignment (declaration) statement * is legal. */ - int i = 1, j = 2, - k = 5; + int ijk = 1, jkl = 2, // violation 'Each variable declaration must be in its own statement.' + klm = 5; /** * One multiline assignment (declaration) statement * is legal. */ - int l = 1, - m = 2, - n = 5; + int lmn = 1, // violation 'Each variable declaration must be in its own statement.' + mnp = 2, + npq = 5; /** * One multiline assignment (declaration) statement * is legal. */ - int w = 1, - x = 2, - y = 5 - ; + int wxy = 1, // violation 'Each variable declaration must be in its own statement.' + xyzz = 2, + yys = 5 + ; /** * Two multiline assignment (declaration) statements * are illegal. */ - int o = 1, p = 2, - r = 5; int t; //warn + // 2 violations 3 lines below: + // 'Each variable declaration must be in its own statement.' + // 'Only one variable definition per line allowed.' + int abc = 1, pqr = 2, + xyz = 5; int blah; // violation 'Only one statement per line allowed.' /** * Two assignment (declaration) statement * which are not on the same lines and are legal. */ - int four = 1, - five = 5 - ; + int four = 1, // violation 'Each variable declaration must be in its own statement.' + five = 5 + ; int seven = 2; /** @@ -183,17 +208,23 @@ private void foo() { * (they both are distributed over two lines) * are illegal. */ + // 2 violations 3 lines below: + // 'Each variable declaration must be in its own statement.' + // 'Only one variable definition per line allowed.' int var1 = 5, - var4 = 5; int var2 = 6, - var3 = 5; //warn + var4 = 5; int var2 = 6, // violation 'Each variable declaration must be in its own statement.' + var3 = 5; // violation 'Only one statement per line allowed.' /** * Two statements on the same line * (they both are distributed over two lines) * are illegal. */ + // 2 violations 3 lines below: + // 'Only one variable definition per line allowed.' + // 'Each variable declaration must be in its own statement.' int var6 = 5; int var7 = 6, - var8 = 5; //warn + var8 = 5; // violation 'Only one statement per line allowed.' /** * Two statements on the same line @@ -203,9 +234,12 @@ private void foo() { private void foo2() { toString( - ); toString ( + ); toString(// violation ''method call' .* incorrect indentation level 4, expected .* 6.' - ); //warn + ); + // 2 violations above: + // ''method call rparen' has incorrect indentation level 8, expected level should be 4.' + // 'Only one statement per line allowed.' } @@ -213,8 +247,8 @@ private void foo2() { * While theoretically being distributed over two lines, this is a sample * of 2 statements on one line. */ - int var9 = 1, var10 = 5 - ; int var11 = 2; //warn + int var9 = 1, var10 = 5 // violation 'Each variable declaration must be in its own statement.' + ; int var11 = 2; // violation 'Only one statement per line allowed.' /** @@ -222,9 +256,9 @@ private void foo2() { */ private void foo3() { for (int n = 0, - k = 1; - n < 5; n++, - k--) { + k = 1; + n < 5; n++, + k--) { } } @@ -232,10 +266,11 @@ private void foo3() { /** * Two multiline statements (which are not on the same line) * are legal. + * Violations are not related to "OneStatementPerLine", but to "MultipleVariableDeclarations". */ - int var12, + int var12, // violation 'Each variable declaration must be in its own statement.' var13 = 12; - int var14 = 5, + int var14 = 5, // violation 'Each variable declaration must be in its own statement.' var15 = 6; /** @@ -251,59 +286,72 @@ private void foo4() { var9++; } while (var11 < 7); //legal - /** + /* * One statement inside for block is legal */ - for (int i = 0; i < 10; i++) one = 5; //legal + for (int i = 0; i < 10; i++) { one = 5; } //legal + // 2 violations above: + // ''{' at column 34 should have line break after.' + // ''}' at column 45 should be alone on a line.' - /** + /* * One statement inside for block where * increment expression is empty is legal */ - for (int i = 0; i < 10;) one = 5; //legal - - /** - * One statement inside for block where - * increment and conditional expressions are empty - * (forever loop) is legal + for (int i = 0; i < 10;) { one = 5; } //legal + // 2 violations above: + // ''{' at column 30 should have line break after.' + // ''}' at column 41 should be alone on a line.' + + /* + One statement inside for block where + increment and conditional expressions are empty + (forever loop) is legal */ - for (int i = 0;;) one = 5; //legal + for (int i = 0;;) { one = 5; } //legal + // 2 violations above: + // ''{' at column 23 should have line break after.' + // ''}' at column 34 should be alone on a line.' } + /** Some javadoc. */ public void foo5() { - /** - * a "forever" loop. - */ - for(;;){} //legal + // a "forever" loop. + for (;;){} //legal } + /** Some javadoc. */ public void foo6() { - /** - * One statement inside for block is legal - */ - for (;;) { one = 5; } //legal + // One statement inside for block is legal + for (;;) { + one = 5; + } //legal } /** * One statement inside multiline for loop is legal. */ private void foo7() { - for(int n = 0, - k = 1 - ; n<5 - ; - n++, k--) { var1++; } //legal - } + for (int n = 0, + k = 1 + ; n < 5 + ; + n++, k--) { + var1++; + } //legal + } /** * Two statements on the same lne * inside multiline for loop are illegal. */ private void foo8() { - for(int n = 0, - k = 1 - ; n<5 - ; - n++, k--) { var1++; var2++; } //warn + for (int n = 0, + k = 1 + ; n < 5 + ; + n++, k--) { + var1++; var2++; // violation 'Only one statement per line allowed.' } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputColumnLimit.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputColumnLimit.java new file mode 100644 index 00000000000..0762b09c472 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputColumnLimit.java @@ -0,0 +1,53 @@ +package com.google.checkstyle.test.chapter4formatting.rule44columnlimit; // ok + +import com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule.PackageStatementTest; // ok + +final class InputColumnLimit { + // Long line + // ---------------------------------------------------------------------------------------------------- + // violation above 'Line is longer than 100 characters (found 105).' + + private int[] testing = + new int[] { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27 + // violation above 'Line is longer than 100 characters (found 105).' + }; + + /** + * Some javadoc. + * + * @param badFormat1 bad format + * @param badFormat2 bad format + * @param badFormat3 bad format + * @return hack + * @throws java.lang.Exception abc + */ + int test1(int badFormat1, int badFormat2, final int badFormat3) throws java.lang.Exception { + return 0; + } + + /** + * Some javadoc. + * Very long url with https: https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java + */ + String https = "200 OK"; + + /** + * Some javadoc. + * Very long url with http: http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java + */ + String http = "200 OK"; + + // Very long url with ftp: ftp://ftp.example.com/areallyyyyyyyyyyyylongggggggggggggggggggggggurlllll.text + int ftp = 0; + + // violation below 'Line is longer than 100 characters (found 144).' + // Very long url with invalid href: href="www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search + int invalidHref = 88; + + // Very long url with valid href: href="www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search" + int validHref = 54; + + // Very long url with valid href: href = "www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search" + int validHrefWithWhiteSpaces = 54; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputFormattedColumnLimit.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputFormattedColumnLimit.java new file mode 100644 index 00000000000..3ae25945b49 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputFormattedColumnLimit.java @@ -0,0 +1,43 @@ +package com.google.checkstyle.test.chapter4formatting.rule44columnlimit; // ok + +final class InputFormattedColumnLimit { + + private int[] testing = + new int[] { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27 + }; + + /** + * Some javadoc. + * + * @param badFormat1 bad format + * @param badFormat2 bad format + * @param badFormat3 bad format + * @return hack + * @throws Exception abc + */ + int test1(int badFormat1, int badFormat2, final int badFormat3) throws Exception { + return 0; + } + + /** + * Some javadoc. Very long url with https: + * https://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java + */ + String https = "200 OK"; + + /** + * Some javadoc. Very long url with http: + * http://github.com/checkstyle/checkstyle/blob/master/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java + */ + String http = "200 OK"; + + // Very long url with ftp: + // ftp://ftp.example.com/areallyyyyyyyyyyyylongggggggggggggggggggggggurlllll.text + int ftp = 0; + + // Very long url with valid href: + // href="www.google.com/search?hl=en&q=java+style+guide+checkstyle+check+href+length+limit&btnG=Google+Search" + int validHref = 54; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputLineLength.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputLineLength.java deleted file mode 100644 index 392f4dff017..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule44columnlimit/InputLineLength.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule44columnlimit; //ok -import com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule.*; //ok -final class InputLineLength -{ - // Long line ---------------------------------------------------------------------------------------- //warn - // Contains a tab -> <- - // Contains trailing whitespace -> - - // Name format tests - // - /** Invalid format **/ - public static final int badConstant = 2; - /** Valid format **/ - public static final int MAX_ROWS = 2; - - /** Invalid format **/ - private static int badStatic = 2; - /** Valid format **/ - private static int sNumCreated = 0; - - /** Invalid format **/ - private int badMember = 2; - /** Valid format **/ - private int mNumCreated1 = 0; - /** Valid format **/ - protected int mNumCreated2 = 0; - - /** commas are wrong **/ - private int[] mInts = new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, }; //warn - - // - // Accessor tests - // - /** should be private **/ - public static int sTest1; - /** should be private **/ - protected static int sTest3; - /** should be private **/ - static int sTest2; - - /** should be private **/ - int mTest1; - /** should be private **/ - public int mTest2; - - // - // Parameter name format tests - // - - /** - * @return hack - * @param badFormat1 bad format - * @param badFormat2 bad format - * @param badFormat3 bad format - * @throws java.lang.Exception abc - **/ - int test1(int badFormat1,int badFormat2, - final int badFormat3) - throws java.lang.Exception - { - return 0; - } - - /** method that is 20 lines long **/ - private void longMethod() - { - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - } - - /** constructor that is 10 lines long **/ - private InputLineLength() - { - // a line - // a line - // a line - // a line - // a line - // a line - // a line - // a line - } - - /** test local variables */ - private void localVariables() - { - // normal decl - int abc = 0; - int ABC = 0; - - // final decls - final int cde = 0; - final int CDE = 0; - - // decl in for loop init statement - for (int k = 0; k < 1; k++) - { - String innerBlockVariable = ""; - } - for (int I = 0; I < 1; I++) - { - String InnerBlockVariable = ""; - } - } - - /** test method pattern */ - void ALL_UPPERCASE_METHOD() - { - } - - /** test illegal constant **/ - private static final int BAD__NAME = 3; - - // A very, very long line that is OK because it matches the regexp "^.*is OK.*regexp.*$" - // long line that has a tab -> <- and would be OK if tab counted as 1 char - // tabs that count as one char because of their position -> <- -> <-, OK - - /** some lines to test the column after tabs */ - void violateColumnAfterTabs() - { - // with tab-width 8 all statements below start at the same column, - // with different combinations of ' ' and '\t' before the statement - int tab0 =1; - int tab1 =1; - int tab2 =1; - int tab3 =1; - int tab4 =1; - int tab5 =1; - } - - // MEMME: - /* MEMME: a - * MEMME: - * OOOO - */ - /* NOTHING */ - /* YES */ /* MEMME: x */ /* YES!! */ - - /** test long comments **/ - void veryLong() - { - /* - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - blah blah blah blah - enough talk */ - } - - /** - * @see to lazy to document all args. Testing excessive # args - **/ - void toManyArgs(int aArg1, int aArg2, int aArg3, int aArg4, int aArg5, - int aArg6, int aArg7, int aArg8, int aArg9) - { - } -} - -/** Test class for variable naming in for each clause. */ -class InputSimple2 -{ - /** Some more Javadoc. */ - public void doSomething() - { - //"O" should be named "o" - for (Object O : new java.util.ArrayList()) - { - - } - } -} - -/** Test enum for member naming check */ -enum MyEnum1 -{ - /** ABC constant */ - ABC, - - /** XYZ constant */ - XYZ; - - /** Should be mSomeMember */ - private int someMember; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedLambdaBodyWrap.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedLambdaBodyWrap.java new file mode 100644 index 00000000000..1e2c02164af --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedLambdaBodyWrap.java @@ -0,0 +1,67 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +import java.util.Arrays; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Supplier; + +/** Some javdoc. */ +public class InputFormattedLambdaBodyWrap { + + private List names = Arrays.asList("Alice", "Bob", "Charlie"); + + private BiFunction add = (a, b) -> a + b; + + private Supplier getMessage = () -> "Hello, world!"; + + private void printNames() { + names.forEach(name -> System.out.println(name)); + } + + private void runTask() { + Runnable runTask = + () -> { + System.out.println("Starting task"); + System.out.println("Task completed"); + }; + } + + private void executeNestedLambda() { + Function, Integer> applyFunc = f -> f.apply(5); + System.out.println(applyFunc.apply(x -> x * x)); + } + + private void sumOfSquares() { + List numbers = Arrays.asList(1, 2, 3, 4, 5); + int sum = numbers.stream().filter(n -> n % 2 == 1).mapToInt(n -> n * n).sum(); + } + + private void showComplexNestedLambda() { + // terminology: () - parentheses, [] - brackets, {} - braces + // Code below is definitely "unbraced expression" and it is single (but not a single-line), + // fact that is parentheses-ed is still definition of single. + // Multiple expressions will imply curly braces and `;`. + // so case below is ok + Function> createAdder = x -> (y -> x + y); + } + + private void foo() { + BiFunction r = + (String label, Long value) -> { + return value; + }; + + java.util.function.Predicate predicate = + str -> { + return str.isEmpty(); + }; + + Function> s = + (String label) -> { + return (a, b) -> { + return a + " " + b; + }; + }; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedMethodParamPad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedMethodParamPad.java new file mode 100644 index 00000000000..bf9a2f93eea --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedMethodParamPad.java @@ -0,0 +1,137 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +import java.util.HashMap; +import java.util.Map; + +class InputFormattedMethodParamPad { + class Inner { + void testGenerics1() { + Comparable c = new String(); + Map map = new HashMap(); + boolean flag = false; + + int init = 9; + } + } + + Inner anon = + new Inner() { + void testGenerics1() { + Comparable c = new String(); + Map map = new HashMap(); + boolean flag = false; + int init = 9; + } + }; +} + +// violation below 'Top-level class ExtraAsInput1 has to reside in its own source file.' +class ExtraAsInput1 { + int abc = 0; + String string = "string"; + double pi = 3.1415; +} + +// violation below 'Top-level class ExtraTernary2 has to reside in its own source file.' +class ExtraTernary2 { + void foo() { + boolean flag = true; + int i2 = flag == true ? 1 : 2; + int i3 = flag == true ? 1 : 2; + } +} + +// violation below 'Top-level class ExtraAssignClass3 has to reside in its own source file.' +class ExtraAssignClass3 { + void foo() { + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; + } + + class InnerClass { + void foo() { + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; + } + } + + InnerClass anon = + new InnerClass() { + void foo() { + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; + } + }; + + enum TestEnum { + FIRST() {}, + + SECOND() {} + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedOperatorWrap.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedOperatorWrap.java new file mode 100644 index 00000000000..b7d7e62058e --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedOperatorWrap.java @@ -0,0 +1,206 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +class InputFormattedOperatorWrap { + void test() { + int x = 1 + 2 - 3 - 4; + x = x + 2; + boolean y = true && false; + y = true && false; + y = false && true; + /* Note: The three tests below will be used when issue #3381 is closed */ + Arrays.sort(null, String::compareToIgnoreCase); + Arrays.sort(null, String::compareToIgnoreCase); + Arrays.sort(null, String::compareToIgnoreCase); + } + + void testAssignment() { + int x = 0; + int y = 0; + } + + void testGenerics1() { + Comparable c = new String(); + Map map = new HashMap(); + + boolean flag = false; + + int init = 9; + + for (Map.Entry entry : map.entrySet()) { + int i = flag == true ? 1 : 2; + } + + if (init != 9) { + /* ignore */ + } + + while (init == 10) {} + + if (init > 10) { + /* ignore */ + } + + while (init < 10 || !flag) {} + } + + class Inner { + void testGenerics1() { + Comparable c = new String(); + Map map = new HashMap(); + boolean flag = false; + + int init = 9; + + for (Map.Entry entry : map.entrySet()) { + int i = flag == true ? 1 : 2; + } + + if (init != 9) { + /* ignore */ + } + + while (init == 10) {} + + if (init > 10) { + /* ignore */ + } + + while (init < 10 || !flag) {} + } + } + + Inner anon = + new Inner() { + void testGenerics1() { + Comparable c = new String(); + Map map = new HashMap(); + boolean flag = false; + int init = 9; + + for (Map.Entry entry : map.entrySet()) { + int i = flag == true ? 1 : 2; + } + + if (init != 9) { + /* ignore */ + } + + while (init == 10) {} + + if (init > 10) { + /* ignore */ + } + + while (init < 10 || !flag) {} + } + }; + + class AsInput { + int abc = 0; + String string = "string"; + double pi = 3.1415; + } + + class Ternary { + void foo() { + boolean flag = true; + int i = flag == true ? 1 : 2; + int i2 = flag == true ? 1 : 2; + int i3 = flag == true ? 1 : 2; + } + } + + class AssignClass { + void foo() { + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; + } + + class InnerClass { + void foo() { + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; + } + } + + InnerClass anon = + new InnerClass() { + void foo() { + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; + } + }; + + void testWrapBeforeOperator() {} + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrap.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrap.java new file mode 100644 index 00000000000..bfb52e269be --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrap.java @@ -0,0 +1,40 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +/** Some javadoc. */ +public class InputFormattedSeparatorWrap { + /** Some javadoc. */ + public void goodCase() { + int i = 0; + String s = "ffffooooString"; + s.isEmpty(); // ok + s.isEmpty(); + + foo(i, s); // ok + } + + public static void foo(int i, String s) {} +} + +// violation below 'Top-level class ExtraBadCase has to reside in its own source file.' +class ExtraBadCase { + + public void goodCase(int... foo) { + int i = 0; + + String s = "ffffooooString"; + boolean b = s.isEmpty(); + foo(i, s); + int[] j; + } + + public static String foo(int i, String s) { + String maxLength = "123"; + int truncationLength = 1; + CharSequence seq = null; + Object truncationIndicator = null; + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength) + .append(truncationIndicator) + .toString(); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapArrayDeclarator.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapArrayDeclarator.java new file mode 100644 index 00000000000..97445afc000 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapArrayDeclarator.java @@ -0,0 +1,8 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +class InputFormattedSeparatorWrapArrayDeclarator { + + protected int[] arrayDeclarationWithGoodWrapping = new int[] {1, 2}; + + protected int[] arrayDeclarationWithBadWrapping = new int[] {1, 2}; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapComma.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapComma.java new file mode 100644 index 00000000000..5ac13b16166 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapComma.java @@ -0,0 +1,42 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +/** Some javadoc. */ +public class InputFormattedSeparatorWrapComma { + /** Some javadoc. */ + public void goodCase() { + int i = 0; + String s = "ffffooooString"; + s.isEmpty(); // ok + s.isEmpty(); + + foo(i, s); // ok + } + + public static void foo(int i, String s) {} +} + +// violation below 'Top-level class ExtraBadCaseComma has to reside in its own source file.' +class ExtraBadCaseComma { + + /** Some javadoc. */ + public void goodCase(int... foo) { + int i = 0; + + String s = "ffffooooString"; + boolean b = s.isEmpty(); + foo(i, s); + int[] j; + } + + /** Some javadoc. */ + public static String foo(int i, String s) { + String maxLength = "123"; + int truncationLength = 1; + CharSequence seq = null; + Object truncationIndicator = null; + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength) + .append(truncationIndicator) + .toString(); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapEllipsis.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapEllipsis.java new file mode 100644 index 00000000000..1bedbc46035 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapEllipsis.java @@ -0,0 +1,8 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +class InputFormattedSeparatorWrapEllipsis { + + public void testMethodWithGoodWrapping(String... parameters) {} + + public void testMethodWithBadWrapping(String... parameters) {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapMethodRef.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapMethodRef.java new file mode 100644 index 00000000000..1d14b2a0172 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputFormattedSeparatorWrapMethodRef.java @@ -0,0 +1,21 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +import java.util.Arrays; + +/** Some javdoc. */ +public class InputFormattedSeparatorWrapMethodRef { + + void goodCase() { + String[] stringArray = { + "Barbara", "James", "Mary", "John", "Patricia", "Robert", "Michael", "Linda" + }; + Arrays.sort(stringArray, String::compareToIgnoreCase); + } + + void badCase() { + String[] stringArray = { + "Barbara", "James", "Mary", "John", "Patricia", "Robert", "Michael", "Linda" + }; + Arrays.sort(stringArray, String::compareToIgnoreCase); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputLambdaBodyWrap.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputLambdaBodyWrap.java new file mode 100644 index 00000000000..3eaa35d7c14 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputLambdaBodyWrap.java @@ -0,0 +1,88 @@ +package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; + +import java.util.Arrays; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Function; +import java.util.function.Supplier; + +/** Some javdoc. */ +public class InputLambdaBodyWrap { + + private List names = Arrays.asList("Alice", "Bob", "Charlie"); + + private BiFunction add = (a, b) -> a + b; + + private Supplier getMessage = + () -> + + "Hello, world!"; + + private void printNames() { + names.forEach(name -> System.out.println(name)); + } + + private void runTask() { + Runnable runTask = () + -> { + System.out.println("Starting task"); + System.out.println("Task completed"); + }; + } + + private void executeNestedLambda() { + Function, Integer> applyFunc = f -> f.apply(5); + System.out.println( + applyFunc.apply( + x -> + x * x)); + } + + private void sumOfSquares() { + List numbers = Arrays.asList(1, 2, 3, 4, 5); + int sum = + numbers.stream() + .filter(n -> n % 2 == 1) + .mapToInt( + n -> + n * n) + .sum(); + } + + private void showComplexNestedLambda() { + // terminology: () - parentheses, [] - brackets, {} - braces + // Code below is definitely "unbraced expression" and it is single (but not a single-line), + // fact that is parentheses-ed is still definition of single. + // Multiple expressions will imply curly braces and `;`. + // so case below is ok + Function> createAdder = + x -> + (y -> + x + y); + } + + private void foo() { + BiFunction r = + (String label, Long value) -> { + return value; + }; + + // violation 3 lines below ''{' at column 11 should be on the previous line.' + java.util.function.Predicate predicate = str + -> + { + return str.isEmpty(); + }; + + // violation 3 lines below ''{' at column 11 should be on the previous line.' + Function> s = + (String label) -> + { + return (a, b) -> + { + return a + " " + b; + }; + }; + // violation 4 lines above ''{' at column 15 should be on the previous line.' + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputMethodParamPad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputMethodParamPad.java index 1326477d75c..4037cf66301 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputMethodParamPad.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputMethodParamPad.java @@ -3,360 +3,201 @@ import java.util.HashMap; import java.util.Map; -class InputMethodParamPad -{ - void test() - { - int x = 1 + - 2 - - 3 - - - 4; - x = x + 2; - boolean y = true - && - false; - y = true && - false; - y = false - && true; +class InputMethodParamPad { + class Inner { + void testGenerics1 + () { // violation ''(' should be on the previous line.' + Comparable + < + String + > + c = new String(); + Map map = new HashMap(); + boolean flag = false; + + int init = 9; } + } - void testAssignment() - { - int x - = 0; - int y = - 0; - } - - < - T extends Comparable & - java.io.Serializable - > - void testGenerics1() - { - Comparable - < - String - > - c = new String(); - Map map = new HashMap(); - - boolean flag = false; - - int init = 9; - - /*ok*/ for (Map.Entry entry : - map.entrySet()) - { - int i = flag == true ? - 1 : 2; - } - - if (init != - 9) - { - - } - - while (init == - 10) - { - - } - - if (init > - 10) - { - - } else {} - - while (init < 10 || - !flag) { - - } - } - - class Inner { - void testGenerics1 - () //warn - { - Comparable - < - String - > - c = new String(); - Map map = new HashMap(); - boolean flag = false; - - int init = 9; - - /*ok*/ for (Map.Entry entry : - map.entrySet()) - { - int i = flag == true ? - 1 : 2; - } - - if (init != - 9) - { - - } - - while (init == - 10) - { - - } - - if (init > - 10) - { - - } else {} - - while (init < 10 || - !flag) { - - } - } - } - - Inner anon = new Inner - (){ //warn + Inner anon = new Inner + () { + // 2 violations above: + // ''new lparen' has incorrect indentation level 6, expected level should be 2.' + // ''(' should be on the previous line.' void testGenerics1 - () //warn - { - Comparable - < - String - > - c = new String(); - Map map = new HashMap(); - boolean flag = false; - int init = 9; - - /*ok*/ for (Map.Entry entry : - map.entrySet()) - { - int i = flag == true ? - 1 : 2; - } - - if (init != - 9) - { - - } - - while (init == - 10) - { - - } - - if (init > - 10) - { - - } else {} - - while (init < 10 || - !flag) { - - } + () { // violation ''(' should be on the previous line.' + Comparable + < + String + > + c = new String(); + Map map = new HashMap(); + boolean flag = false; + int init = 9; } - }; + }; } +// violation below 'Top-level class AsInput1 has to reside in its own source file.' class AsInput1 { - int abc = 0; - String string - = "string"; - double PI = // ok - 3.1415; + int abc = 0; + String string + = "string"; + double pi = + 3.1415; } +// violation below 'Top-level class Ternary2 has to reside in its own source file.' class Ternary2 { - void foo() { - boolean flag = true; - int i = flag == true ? - 1 : - 2; - int i2 = flag == true - ? - 1 - : - 2; - int i3 = flag == true - ? 1 - : 2; - - } + void foo() { + boolean flag = true; + int i2 = flag == true + ? + 1 + : + 2; + int i3 = flag == true + ? 1 + : 2; + } } +// violation below 'Top-level class AssignClass3 has to reside in its own source file.' class AssignClass3 { + void foo() { + int i = 0; + int j = 0; + i += + 1; + j + += 2; + i -= + 1; + j + -= 2; + i /= + 1; + j + /= 2; + i *= + 1; + j + *= 2; + i %= + 1; + j + %= 2; + i ^= + 1; + j + ^= 2; + i |= + 1; + j + |= 2; + i &= + 1; + j + &= 2; + i >>= + 1; + j + >>= 2; + i >>>= + 1; + j + >>>= 2; + i <<= + 1; + j + <<= 2; + } + + class InnerClass { void foo() { - int i = 0; - int j = 0; - i += - 1; - j - += 2; - i -= - 1; - j - -= 2; - i /= - 1; - j - /= 2; - i *= - 1; - j - *= 2; - i %= - 1; - j - %= 2; - i ^= - 1; - j - ^= 2; - i |= - 1; - j - |= 2; - i &= - 1; - j - &= 2; - i >>= - 1; - j - >>= 2; - i >>>= - 1; - j - >>>= 2; - i <<= - 1; - j - <<= 2; - } - - class InnerClass { - void foo() { - int i = 0; - int j = 0; - i += - 1; - j - += 2; - i -= - 1; - j - -= 2; - i /= - 1; - j - /= 2; - i *= - 1; - j - *= 2; - i %= - 1; - j - %= 2; - i ^= - 1; - j - ^= 2; - i |= - 1; - j - |= 2; - i &= - 1; - j - &= 2; - i >>= - 1; - j - >>= 2; - i >>>= - 1; - j - >>>= 2; - i <<= - 1; - j - <<= 2; - } + int i = 0; + int j = 0; + i += 1; + j += 2; + i -= 1; + j -= 2; + i /= 1; + j /= 2; + i *= 1; + j *= 2; + i %= 1; + j %= 2; + i ^= 1; + j ^= 2; + i |= 1; + j |= 2; + i &= 1; + j &= 2; + i >>= 1; + j >>= 2; + i >>>= 1; + j >>>= 2; + i <<= 1; + j <<= 2; } + } - InnerClass anon = new InnerClass() { + InnerClass anon = + new InnerClass() { void foo() { - int i = 0; - int j = 0; - i += - 1; - j - += 2; - i -= - 1; - j - -= 2; - i /= - 1; - j - /= 2; - i *= - 1; - j - *= 2; - i %= - 1; - j - %= 2; - i ^= - 1; - j - ^= 2; - i |= - 1; - j - |= 2; - i &= - 1; - j - &= 2; - i >>= - 1; - j - >>= 2; - i >>>= - 1; - j - >>>= 2; - i <<= - 1; - j - <<= 2; + int i = 0; + int j = 0; + i += + 1; + j + += 2; + i -= + 1; + j + -= 2; + i /= + 1; + j + /= 2; + i *= + 1; + j + *= 2; + i %= + 1; + j + %= 2; + i ^= + 1; + j + ^= 2; + i |= + 1; + j + |= 2; + i &= + 1; + j + &= 2; + i >>= + 1; + j + >>= 2; + i >>>= + 1; + j + >>>= 2; + i <<= + 1; + j + <<= 2; } - }; + }; - enum TestEnum { - FIRST () // warn - { - }, + enum TestEnum { + FIRST () {}, // violation ''(' is preceded with whitespace.' - SECOND - () // warn - { - } - } + SECOND + () {} // violation ''(' should be on the previous line.' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputOperatorWrap.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputOperatorWrap.java index 4e653f12bfb..a12b70410c2 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputOperatorWrap.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputOperatorWrap.java @@ -4,363 +4,316 @@ import java.util.HashMap; import java.util.Map; -class InputOperatorWrap -{ - void test() - { - /*warn*/int x = 1 + - /*warn*/ 2 - +class InputOperatorWrap { + void test() { + int x = 1 + // violation ''\+' should be on a new line.' + 2 - // violation ''-' should be on a new line.' 3 - 4; - x = x + 2; - boolean y = true - && - false; - /*warn*/ y = true && - false; - y = false - && true; - /* Note: The three tests below will be used when issue #3381 is closed */ - Arrays.sort(null, String - :: - compareToIgnoreCase); - Arrays.sort(null, String:: /*warn*/ - compareToIgnoreCase); - Arrays.sort(null, String - ::compareToIgnoreCase); + x = x + 2; + boolean y = true + && + false; + y = true && // violation ''&&' should be on a new line.' + false; + y = false + && true; + /* Note: The three tests below will be used when issue #3381 is closed */ + Arrays.sort(null, String + // violation below ''::' should be on a new line.' + :: + compareToIgnoreCase); + Arrays.sort(null, String:: // violation ''::' should be on a new line.' + compareToIgnoreCase); + Arrays.sort(null, String + ::compareToIgnoreCase); + } + + void testAssignment() { + int x + = 0; + int y = + 0; + } + + + void testGenerics1() { + Comparable + < + String + > + c = new String(); + Map map = new HashMap(); + + boolean flag = false; + + int init = 9; + + for (Map.Entry entry : + map.entrySet()) { + int i = flag == true ? // violation ''?' should be on a new line.' + 1 : 2; } - void testAssignment() - { - int x - = 0; - int y = - 0; - } + if (init != // violation ''!=' should be on a new line.' + 9) { /* ignore */ } - < - /*warn*/ T extends Comparable & - java.io.Serializable - > - void testGenerics1() - { - Comparable - < - String - > - c = new String(); - Map map = new HashMap(); + while (init == // violation ''==' should be on a new line.' + 10) { } - boolean flag = false; + if (init > // violation ''>' should be on a new line.' + 10) { /* ignore */ } - int init = 9; + while (init < 10 || // violation ''\|\|' should be on a new line.' + !flag) { } + } - /*ok*/ for (Map.Entry entry : - map.entrySet()) - { - /*warn*/int i = flag == true ? - 1 : 2; - } + class Inner { + void testGenerics1() { + Comparable + < + String + > + c = new String(); + Map map = new HashMap(); + boolean flag = false; - /*warn*/ if (init != - 9) - { + int init = 9; - } + for (Map.Entry entry : + map.entrySet()) { + int i = flag == true ? // violation ''?' should be on a new line.' + 1 : 2; + } - /*warn*/ while (init == - 10) - { + if (init != // violation ''!=' should be on a new line.' + 9) { /* ignore */ } - } + while (init == // violation ''==' should be on a new line.' + 10) { } - /*warn*/ if (init > - 10) - { + if (init > // violation ''>' should be on a new line.' + 10) { /* ignore */ } - } else {} - - /*warn*/ while (init < 10 || - !flag) { - - } + while (init < 10 || // violation ''\|\|' should be on a new line.' + !flag) {} } - - class Inner { - void testGenerics1 - () - { - Comparable - < - String - > - c = new String(); - Map map = new HashMap(); - boolean flag = false; - - int init = 9; - - /*ok*/ for (Map.Entry entry : - map.entrySet()) - { - /*warn*/int i = flag == true ? - 1 : 2; - } - - /*warn*/ if (init != - 9) - { - - } - - /*warn*/ while (init == - 10) - { - - } - - /*warn*/ if (init > - 10) - { - - } else {} - - /*warn*/ while (init < 10 || - !flag) { - - } - } - } - - Inner anon = new Inner - (){ - void testGenerics1 - () - { - Comparable - < - String - > - c = new String(); - Map map = new HashMap(); - boolean flag = false; - int init = 9; - - /*ok*/ for (Map.Entry entry : - map.entrySet()) - { - /*warn*/int i = flag == true ? - 1 : 2; - } - - /*warn*/ if (init != - 9) - { - - } - - /*warn*/ while (init == - 10) - { - - } - - /*warn*/ if (init > - 10) - { - - } else {} - - /*warn*/ while (init < 10 || - !flag) { - - } + } + + Inner anon = + new Inner() { + void testGenerics1() { + Comparable + < + String + > + c = new String(); + Map map = new HashMap(); + boolean flag = false; + int init = 9; + + for (Map.Entry entry : + map.entrySet()) { + int i = flag == true ? // violation ''?' should be on a new line.' + 1 : 2; + } + + if (init != // violation ''!=' should be on a new line.' + 9) { /* ignore */ } + + while (init == // violation ''==' should be on a new line.' + 10) { } + + if (init > // violation ''>' should be on a new line.' + 10) { /* ignore */ } + + while (init < 10 || // violation ''\|\|' should be on a new line.' + !flag) {} } - }; -} + }; -class AsInput { + class AsInput { int abc = 0; String string - = "string"; - double PI = // ok + = "string"; + double pi = 3.1415; -} + } -class Ternary { + class Ternary { void foo() { - boolean flag = true; - /*warn*/int i = flag == true ? - 1 : - 2; - int i2 = flag == true - ? - 1 - : - 2; - int i3 = flag == true - ? 1 - : 2; - + boolean flag = true; + int i = flag == true ? // violation ''?' should be on a new line.' + 1 : + 2; + int i2 = flag == true + ? + 1 + : + 2; + int i3 = flag == true + ? 1 + : 2; } -} + } -class AssignClass { + class AssignClass { void foo() { + int i = 0; + int j = 0; + i += + 1; + j + += 2; + i -= + 1; + j + -= 2; + i /= + 1; + j + /= 2; + i *= + 1; + j + *= 2; + i %= + 1; + j + %= 2; + i ^= + 1; + j + ^= 2; + i |= + 1; + j + |= 2; + i &= + 1; + j + &= 2; + i >>= + 1; + j + >>= 2; + i >>>= + 1; + j + >>>= 2; + i <<= + 1; + j + <<= 2; + } + + class InnerClass { + void foo() { int i = 0; int j = 0; i += 1; j - += 2; + += 2; i -= 1; j - -= 2; + -= 2; i /= 1; j - /= 2; + /= 2; i *= 1; j - *= 2; + *= 2; i %= 1; j - %= 2; + %= 2; i ^= 1; j - ^= 2; + ^= 2; i |= 1; j - |= 2; + |= 2; i &= 1; j - &= 2; + &= 2; i >>= 1; j - >>= 2; + >>= 2; i >>>= 1; j - >>>= 2; + >>>= 2; i <<= 1; j - <<= 2; - } - - class InnerClass { - void foo() { - int i = 0; - int j = 0; - i += - 1; - j - += 2; - i -= - 1; - j - -= 2; - i /= - 1; - j - /= 2; - i *= - 1; - j - *= 2; - i %= - 1; - j - %= 2; - i ^= - 1; - j - ^= 2; - i |= - 1; - j - |= 2; - i &= - 1; - j - &= 2; - i >>= - 1; - j - >>= 2; - i >>>= - 1; - j - >>>= 2; - i <<= - 1; - j <<= 2; - } + } } - InnerClass anon = new InnerClass() { - void foo() { - int i = 0; - int j = 0; - i += - 1; - j - += 2; - i -= - 1; - j - -= 2; - i /= - 1; - j - /= 2; - i *= - 1; - j - *= 2; - i %= - 1; - j - %= 2; - i ^= - 1; - j - ^= 2; - i |= - 1; - j - |= 2; - i &= - 1; - j - &= 2; - i >>= - 1; - j - >>= 2; - i >>>= - 1; - j - >>>= 2; - i <<= - 1; - j - <<= 2; - } - }; + InnerClass anon = + new InnerClass() { + void foo() { + int i = 0; + int j = 0; + i += + 1; + j + += 2; + i -= + 1; + j + -= 2; + i /= + 1; + j + /= 2; + i *= + 1; + j + *= 2; + i %= + 1; + j + %= 2; + i ^= + 1; + j + ^= 2; + i |= + 1; + j + |= 2; + i &= + 1; + j + &= 2; + i >>= + 1; + j + >>= 2; + i >>>= + 1; + j + >>>= 2; + i <<= + 1; + j + <<= 2; + } + }; - void testWrapBeforeOperator() - { - } + void testWrapBeforeOperator() {} + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrap.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrap.java index 773508fab00..6951609c70a 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrap.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrap.java @@ -1,45 +1,45 @@ package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; +/** Some javadoc. */ public class InputSeparatorWrap { - public void goodCase() - { - int i = 0; - String s = "ffffooooString"; - s - .isEmpty(); //ok - s.isEmpty(); + /** Some javadoc. */ + public void goodCase() { + int i = 0; + String s = "ffffooooString"; + s + .isEmpty(); // ok + s.isEmpty(); - foo(i, - s); //ok - } - public static void foo(int i, String s) - { + foo(i, + s); // ok + } - } + public static void foo(int i, String s) {} } -class badCase { +// violation below 'Top-level class BadCase has to reside in its own source file.' +class BadCase { - public void goodCase(int... aFoo) - { - int i = 0; + public void goodCase(int... foo) { + int i = 0; - String s = "ffffooooString"; - /*warn*/boolean b = s. + String s = "ffffooooString"; + // violation below ''.' should be on a new line.' + boolean b = s. isEmpty(); - foo(i - ,s); - int[] j; - } - public static String foo(int i, String s) - { - String maxLength = "123"; - int truncationLength = 1; - CharSequence seq = null; - Object truncationIndicator = null; - return new StringBuilder(maxLength ) - .append(seq, 0, truncationLength ) - .append(truncationIndicator) - .toString(); - } + foo(i + , s); // violation '',' should be on the previous line.' + int[] j; + } + + public static String foo(int i, String s) { + String maxLength = "123"; + int truncationLength = 1; + CharSequence seq = null; + Object truncationIndicator = null; + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength) + .append(truncationIndicator) + .toString(); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapArrayDeclarator.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapArrayDeclarator.java index acbcdd9b895..1d46fee10d7 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapArrayDeclarator.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapArrayDeclarator.java @@ -2,11 +2,8 @@ class InputSeparatorWrapArrayDeclarator { - protected int[] arrayDeclarationWithGoodWrapping = new int[ - ] {1, 2}; // ok - - protected int[] arrayDeclarationWithBadWrapping = new int - [] {1, 2}; // warn + protected int[] arrayDeclarationWithGoodWrapping = new int[] {1, 2}; + protected int[] arrayDeclarationWithBadWrapping = new int + [] {1, 2}; // violation ''\[' should be on the previous line.' } - diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapComma.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapComma.java index ed3f009af35..adbba61afdf 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapComma.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapComma.java @@ -1,45 +1,45 @@ package com.google.checkstyle.test.chapter4formatting.rule451wheretobreak; +/** Some javadoc. */ public class InputSeparatorWrapComma { - public void goodCase() - { - int i = 0; - String s = "ffffooooString"; - s - .isEmpty(); //ok - s.isEmpty(); + /** Some javadoc. */ + public void goodCase() { + int i = 0; + String s = "ffffooooString"; + s.isEmpty(); // ok + s.isEmpty(); - foo(i, - s); //ok - } - public static void foo(int i, String s) - { + foo(i, s); // ok + } - } + public static void foo(int i, String s) {} } -class badCaseComma { +// violation below 'Top-level class BadCaseComma has to reside in its own source file.' +class BadCaseComma { - public void goodCase(int... aFoo) - { - int i = 0; + /** Some javadoc. */ + public void goodCase(int... foo) { + int i = 0; - String s = "ffffooooString"; - boolean b = s. + String s = "ffffooooString"; + // violation below ''.' should be on a new line.' + boolean b = s. isEmpty(); - foo(i - ,s); //warn - int[] j; - } - public static String foo(int i, String s) - { - String maxLength = "123"; - int truncationLength = 1; - CharSequence seq = null; - Object truncationIndicator = null; - return new StringBuilder(maxLength ) - .append(seq, 0, truncationLength ) - .append(truncationIndicator) - .toString(); - } + foo(i + , s); // violation '',' should be on the previous line.' + int[] j; + } + + /** Some javadoc. */ + public static String foo(int i, String s) { + String maxLength = "123"; + int truncationLength = 1; + CharSequence seq = null; + Object truncationIndicator = null; + return new StringBuilder(maxLength) + .append(seq, 0, truncationLength) + .append(truncationIndicator) + .toString(); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapEllipsis.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapEllipsis.java index d9620466890..e4d23e5d161 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapEllipsis.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapEllipsis.java @@ -2,15 +2,8 @@ class InputSeparatorWrapEllipsis { - public void testMethodWithGoodWrapping(String... // ok - parameters) { - - } - - public void testMethodWithBadWrapping(String - ...parameters) { // warn - - } + public void testMethodWithGoodWrapping(String... parameters) {} + public void testMethodWithBadWrapping(String + ... parameters) {} // violation ''...' should be on the previous line.' } - diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapMethodRef.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapMethodRef.java index af314afdd04..6178bb4329f 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapMethodRef.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule451wheretobreak/InputSeparatorWrapMethodRef.java @@ -2,19 +2,23 @@ import java.util.Arrays; +/** Some javdoc. */ public class InputSeparatorWrapMethodRef { - void goodCase() { - String[] stringArray = { "Barbara", "James", "Mary", "John", - "Patricia", "Robert", "Michael", "Linda" }; - Arrays.sort(stringArray, String - ::compareToIgnoreCase); - } + void goodCase() { + String[] stringArray = { + "Barbara", "James", "Mary", "John", "Patricia", "Robert", "Michael", "Linda" + }; + Arrays.sort(stringArray, String::compareToIgnoreCase); + } - void badCase() { - String[] stringArray = { "Barbara", "James", "Mary", "John", - "Patricia", "Robert", "Michael", "Linda" }; - /*warn*/ Arrays.sort(stringArray, String:: - compareToIgnoreCase); - } + void badCase() { + String[] stringArray = { + "Barbara", "James", "Mary", "John", "Patricia", "Robert", "Michael", "Linda" + }; + Arrays.sort( + stringArray, + String:: // violation ''::' should be on a new line.' + compareToIgnoreCase); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/ClassWithChainedMethods.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/ClassWithChainedMethods.java new file mode 100644 index 00000000000..2235ee14653 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/ClassWithChainedMethods.java @@ -0,0 +1,31 @@ +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +/** some javadoc. */ +public class ClassWithChainedMethods { + + public ClassWithChainedMethods(Object... params) {} + + /** some javadoc. */ + public static void main(String[] args) { + new ClassWithChainedMethods() + .getInstance("string_one") + .doNothing("string_one".trim(), "string_two"); + // violation above ''method call' child has incorrect indentation level 4, expected .* 8.' + + int length = + new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length(); + // violation above ''new' has incorrect indentation level 4, expected .* 8.' + + int length2 = + new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length(); + // violation above ''new' has incorrect indentation level 4, expected .* 8.' + } + + public String doNothing(String something, String... uselessParams) { + return something; + } + + public ClassWithChainedMethods getInstance(String... uselessParams) { + return this; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/ClassWithChainedMethodsCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/ClassWithChainedMethodsCorrect.java new file mode 100644 index 00000000000..ed974cfcbdb --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/ClassWithChainedMethodsCorrect.java @@ -0,0 +1,23 @@ +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +/** some javadoc. */ +public class ClassWithChainedMethodsCorrect { + /** some javadoc. */ + public ClassWithChainedMethodsCorrect() { + + String someString = ""; + + String chained1 = doNothing(someString.concat("zyx").concat("255, 254, 253")); + + doNothing(someString.concat("zyx").concat("255, 254, 253")); + } + + public static void main(String[] args) { + ClassWithChainedMethodsCorrect classWithChainedMethodsCorrect = + new ClassWithChainedMethodsCorrect(); + } + + public String doNothing(String something) { + return something; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputFastMatcher.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputFastMatcher.java index 6e0908b3bdc..38058a4f80f 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputFastMatcher.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputFastMatcher.java @@ -1,42 +1,35 @@ package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; -public class InputFastMatcher -{ - - public boolean matches(char c) - { - // OOOO Auto-generated method stub - return false; - } - - public String replaceFrom(CharSequence sequence, CharSequence replacement) - { - // OOOO Auto-generated method stub - return null; - } - - public String collapseFrom(CharSequence sequence, char replacement) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimFrom(CharSequence s) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimLeadingFrom(CharSequence sequence) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimTrailingFrom(CharSequence sequence) - { - // OOOO Auto-generated method stub - return null; - } - +/** some javadoc. */ +public class InputFastMatcher { + + public boolean matches(char c) { + // OOOO Auto-generated method stub + return false; + } + + public String replaceFrom(CharSequence sequence, CharSequence replacement) { + // OOOO Auto-generated method stub + return null; + } + + public String collapseFrom(CharSequence sequence, char replacement) { + // OOOO Auto-generated method stub + return null; + } + + public String trimFrom(CharSequence s) { + // OOOO Auto-generated method stub + return null; + } + + public String trimLeadingFrom(CharSequence sequence) { + // OOOO Auto-generated method stub + return null; + } + + public String trimTrailingFrom(CharSequence sequence) { + // OOOO Auto-generated method stub + return null; + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrect.java index b0c9a627cac..d511b85c882 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrect.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrect.java @@ -1,113 +1,106 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -import java.util.Map; //indent:0 exp:0 -import java.util.ArrayList;//indent:0 exp:0 - -public abstract class InputIndentationCorrect { //indent:0 exp:0 - - static int i; //indent:2 exp:2 - - int[] c = {1, 2, 3, //indent:2 exp:2 - 4, 5, 6}; //indent:6 exp:6 - - int b; //indent:2 exp:2 - - static { //indent:2 exp:2 - i = 0; //indent:4 exp:4 - } //indent:2 exp:2 - - { //indent:2 exp:2 - b = 2; //indent:4 exp:4 - } //indent:2 exp:2 - - private static abstract class RangesMatcher { //indent:2 exp:2 - - private static final String ZEROES = "0\u0660\u06f0" //indent:4 exp:4 - + "\u0c66\u0ce6" //indent:8 exp:8 - + "\u1c40\u1c50"; //indent:8 exp:8 - - public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = //indent:4 exp:4 - new InputIndentationCorrect() { //indent:8 exp:8 - @Override public boolean matches(char c) { //indent:10 exp:10 - return Character.isLetterOrDigit(c); //indent:12 exp:12 - } //indent:10 exp:10 - }; //indent:8 exp:8 - - /** Matches no characters. */ //indent:4 exp:4 - public static final InputFastMatcher NONE = //indent:4 exp:4 - new InputFastMatcher() { //indent:12 exp:>=8 - @Override public boolean matches(char c) { //indent:6 exp:6 - return false; //indent:8 exp:8 - } //indent:6 exp:6 - - @Override public String replaceFrom(CharSequence seq, CharSequence repl) { //indent:6 exp:6 - checkNotNull(repl); //indent:8 exp:8 - return seq.toString(); //indent:8 exp:8 - } //indent:6 exp:6 - - private void checkNotNull(CharSequence replacement) {} //indent:6 exp:6 - - @Override public String collapseFrom(CharSequence sequence, //indent:6 exp:6 - char replacement) { //indent:10 exp:10 - return sequence.toString(); //indent:8 exp:8 - } //indent:6 exp:6 - - @Override //indent:6 exp:6 - public String trimTrailingFrom(CharSequence sequence) { //indent:6 exp:6 - return sequence.toString(); //indent:8 exp:8 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean matches(char c) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public void foo() { //indent:2 exp:2 - int i = 0; //indent:4 exp:4 - for (; i < 9; i++) { //indent:4 exp:4 - if (veryLongLongLongCondition() //indent:6 exp:6 - || veryLongLongLongCondition2()) { //indent:14 exp:>=10 - someFooMethod("longString", "veryLongString", //indent:8 exp:8 - "superVeryExtraLongString"); //indent:12 exp:12 - if (veryLongLongLongCondition()) { //indent:8 exp:8 - while (veryLongLongLongCondition2() //indent:10 exp:10 - && veryLongLongLongCondition2()) { //indent:16 exp:>=14 - try { //indent:12 exp:12 - doSmth(); //indent:14 exp:14 - } catch (Exception e) { //indent:12 exp:12 - throw new AssertionError(e); //indent:14 exp:14 - } //indent:12 exp:12 - } //indent:10 exp:10 - } //indent:8 exp:8 - } //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean veryLongLongLongCondition() { //indent:2 exp:2 - if (veryLongLongLongCondition2()) { //indent:4 exp:4 - return true; //indent:6 exp:6 - } //indent:4 exp:4 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean veryLongLongLongCondition2() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public void someFooMethod(String longString, //indent:2 exp:2 - String superLongString, String exraSuperLongString) {} //indent:6 exp:6 - - public void fooThrowMethod() //indent:2 exp:2 - throws Exception { //indent:10 exp:>=6 - /* Some code*/ //indent:6 exp:6 - } //indent:2 exp:2 - - public void doSmth() { //indent:2 exp:2 - for (int h //indent:4 exp:4 - : c) { //indent:10 exp:>=8 - someFooMethod("longString", "veryLongString", //indent:6 exp:6 - "superVeryExtraLongString"); //indent:10 exp:10 - } //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +/** some javadoc. */ +public abstract class InputIndentationCorrect { + + static int i; + + static { + i = 0; + } + + int[] pqr = { + 1, 2, 3, + 4, 5, 6 + }; + int abc; + + { + abc = 2; + } + + public boolean matches(char c) { + return false; + } + + /** some javadoc. */ + public void foo() { + int i = 0; + for (; i < 9; i++) { + if (veryLongLongLongCondition() || veryLongLongLongCondition2()) { + someFooMethod("longString", "veryLongString", "superVeryExtraLongString"); + if (veryLongLongLongCondition()) { + while (veryLongLongLongCondition2() && veryLongLongLongCondition2()) { + try { + doSmth(); + } catch (Exception e) { + throw new AssertionError(e); + } + } + } + } + } + } + + public boolean veryLongLongLongCondition() { + return veryLongLongLongCondition2(); + } + + public boolean veryLongLongLongCondition2() { + return false; + } + + public void someFooMethod( + String longString, String superLongString, String exraSuperLongString) {} + + public void fooThrowMethod() throws Exception { + /* Some code*/ + } + + /** some javadoc. */ + public void doSmth() { + for (int h : pqr) { + someFooMethod("longString", "veryLongString", "superVeryExtraLongString"); + } + } + + private abstract static class RangesMatcher { + + public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = + new InputIndentationCorrect() { + @Override + public boolean matches(char c) { + return Character.isLetterOrDigit(c); + } + }; + + /** Matches no characters. */ + public static final InputFastMatcher NONE = + new InputFastMatcher() { + @Override + public boolean matches(char c) { + return false; + } + + @Override + public String replaceFrom(CharSequence seq, CharSequence repl) { + checkNotNull(repl); + return seq.toString(); + } + + private void checkNotNull(CharSequence replacement) {} + + @Override + public String collapseFrom(CharSequence sequence, char replacement) { + return sequence.toString(); + } + + @Override + public String trimTrailingFrom(CharSequence sequence) { + return sequence.toString(); + } + }; + + private static final String ZEROES = "" + ""; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectAnnotationArrayInit.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectAnnotationArrayInit.java new file mode 100644 index 00000000000..8b85c83bd72 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectAnnotationArrayInit.java @@ -0,0 +1,13 @@ +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +/** some javadoc. */ +public class InputIndentationCorrectAnnotationArrayInit { + interface MyInterface { + @AnAnnotation(values = {"Hello"}) + void works(); + + @interface AnAnnotation { + String[] values(); + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectClass.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectClass.java index 54baa77ca9b..0d95326d3dc 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectClass.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectClass.java @@ -1,44 +1,33 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -import java.util.Iterator; //indent:0 exp:0 - -public class InputIndentationCorrectClass //indent:0 exp:0 - implements Runnable, Cloneable { //indent:4 exp:4 - - class InnerClass implements //indent:2 exp:2 - Iterable, //indent:10 exp:>=6 - Cloneable { //indent:13 exp:>=6 - @Override //indent:4 exp:4 - public Iterator iterator() { //indent:4 exp:4 - return null; //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClass2 //indent:2 exp:2 - extends //indent:7 exp:>=6 - SecondClassWithLongLongLongLongName { //indent:10 exp:>=6 - public InnerClass2(String string) { //indent:4 exp:4 - super(); //indent:6 exp:6 - // OOOO Auto-generated constructor stub //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - @Override //indent:2 exp:2 - public void run() { //indent:2 exp:2 - SecondClassWithLongLongLongLongName anon = //indent:4 exp:4 - new SecondClassWithLongLongLongLongName() { //indent:10 exp:>=8 - - }; //indent:4 exp:4 - - SecondClassWithLongLongLongLongName anon2 = new //indent:4 exp:4 - SecondClassWithLongLongLongLongName() { //indent:10 exp:>=8 - - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassWithLongLongLongLongName //indent:0 exp:0 - extends //indent:4 exp:4 - InputIndentationCorrectClass{ //indent:9 exp:>=4 - -} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +import java.util.Iterator; + +/** some javadoc. */ +public class InputIndentationCorrectClass implements Runnable, Cloneable { + + /** some javadoc. */ + @Override + public void run() { + SecondClassWithLongLongLongLongName anon = new SecondClassWithLongLongLongLongName() {}; + + SecondClassWithLongLongLongLongName anon2 = new SecondClassWithLongLongLongLongName() {}; + } + + class InnerClass implements Iterable, Cloneable { + @Override + public Iterator iterator() { + return null; + } + } + + class InnerClass2 extends SecondClassReturnWithVeryVeryVeryLongName { + public InnerClass2(String string) { + super(); + // OOOO Auto-generated constructor stub + } + } + + class SecondClassWithLongLongLongLongName extends InputIndentationCorrectClass {} + + class SecondClassReturnWithVeryVeryVeryLongName {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectFieldAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectFieldAndParameter.java index 49f29828ac6..bb81ea3704b 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectFieldAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectFieldAndParameter.java @@ -1,127 +1,156 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -class InputIndentationCorrectFieldAndParameter { //indent:0 exp:0 - - boolean flag = conditionFirst("Loooooooooooooooooong", new //indent:2 exp:2 - SecondFieldWithName("Loooooooooooooooooog"). //indent:6 exp:6 - getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:6 exp:6 - new InnerClassFoo()); //indent:6 exp:6 - - boolean secondFlag = conditionSecond(10000000000.0, new //indent:2 exp:2 - SecondFieldWithName("Looooooooooooo" //indent:6 exp:6 - + "oooooooooooong").getString(new FooFieldClass(), //indent:6 exp:6 - new SecondFieldWithName("loooooooooong"). //indent:6 exp:6 - getInteger(new FooFieldClass(), "loooooooooooooong")), "loooooooooooong") //indent:6 exp:6 - || conditionThird(2048) || conditionFourth(new //indent:6 exp:6 - SecondFieldWithName("Looooooooooooooo" //indent:6 exp:6 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:6 exp:6 - conditionFifth(true, new SecondFieldWithName(getString(2048, "Looo" //indent:6 exp:6 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:6 exp:6 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:6 exp:6 - SecondFieldWithName(getString(100000, "Loooooong" //indent:6 exp:6 - + "Fooooooo><"))) || conditionNoArg() //indent:6 exp:6 - || conditionNoArg() || //indent:6 exp:6 - conditionNoArg() || conditionNoArg(); //indent:6 exp:6 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondFieldWithName instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - boolean flag = conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondFieldWithName("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:12 exp:>=8 - new InnerClassFoo()); //indent:13 exp:>=8 - - boolean secondFlag = conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondFieldWithName("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooFieldClass(), //indent:11 exp:>=8 - new SecondFieldWithName("loooooooooong"). //indent:10 exp:>=8 - getInteger(new FooFieldClass(), "looooooooong")), "loooooooooooong") //indent:12 exp:>=8 - || conditionThird(2048) || conditionFourth(new //indent:13 exp:>=8 - SecondFieldWithName("Looooooooooooooo" //indent:16 exp:>=8 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:12 exp:>=8 - conditionFifth(true, new SecondFieldWithName(getString(2048, "Looo" //indent:11 exp:>=8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:15 exp:>=8 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:12 exp:>=8 - SecondFieldWithName(getString(100000, "Loooooong" //indent:12 exp:>=8 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=8 - || conditionNoArg() || //indent:10 exp:>=8 - conditionNoArg() || conditionNoArg(); //indent:10 exp:>=8 - - FooFieldClass anonymousClass = new FooFieldClass() { //indent:4 exp:4 - boolean secondFlag = conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondFieldWithName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooFieldClass(), //indent:12 exp:>=10 - new SecondFieldWithName("loooooooooong"). //indent:15 exp:>=10 - getInteger(new FooFieldClass(), "looooooong")), "loooooooooooong") //indent:13 exp:>=10 - || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=10 - SecondFieldWithName("Looooooooooooooo" //indent:17 exp:>=10 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:13 exp:>=10 - conditionFifth(true, new SecondFieldWithName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:16 exp:>=10 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:13 exp:>=8 - SecondFieldWithName(getString(100000, "Loooooong" //indent:13 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:17 exp:>=10 - || conditionNoArg() || //indent:11 exp:>=10 - conditionNoArg() || conditionNoArg(); //indent:11 exp:>=10 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondFieldWithName { //indent:0 exp:0 - - public SecondFieldWithName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooFieldClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooFieldClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooFieldClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondFieldWithName getInstance() { //indent:2 exp:2 - return new SecondFieldWithName("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooFieldClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +class InputIndentationCorrectFieldAndParameter { + + boolean flag = + conditionFirst( + "Loooooooooooooooooong", + new SecondFieldLongNam2("Loooooooooooooooooog") + .getInteger(new FooFieldClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + + boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + + String getString(int someInt, String someString) { + return "String"; + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondFieldLongNam2 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + boolean flag = + conditionFirst( + "Loooooooooooooooooong", + new SecondFieldLongNam2("Loooooooooooooooooog") + .getInteger(new FooFieldClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + + boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "looooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + + FooFieldClass anonymousClass = + new FooFieldClass() { + final boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "looooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString( + 2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + }; + } + + class SecondFieldLongNam2 { + + public SecondFieldLongNam2(String string) {} + + String getString(FooFieldClass instance, int integer) { + return "String"; + } + + int getInteger(FooFieldClass instance, String string) { + return -1; + } + + boolean getBoolean(FooFieldClass instance, boolean flag) { + return false; + } + + SecondFieldLongNam2 getInstance() { + return new SecondFieldLongNam2("VeryLoooooooooo" + "oongString"); + } + } + + class FooFieldClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectForAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectForAndParameter.java index a9ce244565c..7ac31e6039d 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectForAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectForAndParameter.java @@ -1,113 +1,126 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -import java.util.ArrayList; //indent:0 exp:0 -import java.util.HashMap; //indent:0 exp:0 -import java.util.Iterator; //indent:0 exp:0 -import java.util.List; //indent:0 exp:0 -import java.util.Map; //indent:0 exp:0 - -class InputIndentationCorrectForAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - for (int i = 1; i < 10; i ++) {} //indent:4 exp:4 - - for (int i = new SecondForClassWithLongName("Loooooooooooooooooooo" //indent:4 exp:4 - + "oong").getInteger(new FooForClass(), //indent:8 exp:8 - getString(1000000000, "Loooooooooooooooong")); i < 10; i++) {} //indent:10 exp:>=8 - - for (Map.Entry entry : new SecondForClassWithLongName("Loo" //indent:4 exp:4 - + "ooooooooooooooooooooong").getMap(new //indent:8 exp:8 - FooForClass(), 10000000, //indent:8 exp:8 - getString(10000, "Loooooooooo" //indent:8 exp:8 - + "ooooong")).entrySet()) {} //indent:8 exp:8 - - for (Map.Entry entry : new SecondForClassWithLongName("Loo" //indent:4 exp:4 - + "ooooooooooooooooooooong").getMap(new //indent:8 exp:8 - FooForClass(), 10000000, //indent:12 exp:>=8 - getString(10000, "Loooooooooo" //indent:10 exp:>=8 - + "ooooong")).entrySet()) {} //indent:15 exp:>=8 - - for (String string : new SecondForClassWithLongName(getString(1024 //indent:4 exp:4 - , "Looooooooooooooooooong")). //indent:8 exp:8 - getList(new FooForClass(), 1000, getString(1024, //indent:8 exp:8 - "Loooooooooooooooooooooooooooooooo" //indent:8 exp:8 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:8 exp:8 - + "oooooooooong"))) {} //indent:8 exp:8 - - for (String string : new SecondForClassWithLongName(getString(1024 //indent:4 exp:4 - , "Looooooooooooooooooong")). //indent:8 exp:8 - getList(new FooForClass(), 1000, getString(1024, //indent:12 exp:>=8 - "Loooooooooooooooooooooooooooooooo" //indent:14 exp:>=8 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:10 exp:>=8 - + "oooooooooong"))) {} //indent:13 exp:>=8 - - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - - for (int i = 1; i < 10; i ++) {} //indent:6 exp:6 - - for (int i = new SecondForClassWithLongName("Loooooooooooooooooooo" //indent:6 exp:6 - + "oong").getInteger(new FooForClass(), //indent:10 exp:10 - getString(1000000000, "Loooooooooooooooong")); i < 10; i++) {} //indent:12 exp:>=10 - - for (Map.Entry entry : new SecondForClassWithLongName("Loo" //indent:6 exp:6 - + "ooooooooooooooooooooong").getMap(new //indent:10 exp:10 - FooForClass(), 10000000, //indent:10 exp:10 - getString(10000, "Loooooooooo" //indent:10 exp:10 - + "ooooong")).entrySet()) {} //indent:10 exp:10 - - for (Map.Entry entry : new SecondForClassWithLongName("Loo" //indent:6 exp:6 - + "ooooooooooooooooooooong").getMap(new //indent:12 exp:>=10 - FooForClass(), 10000000, //indent:13 exp:>=10 - getString(10000, "Loooooooooo" //indent:18 exp:>=10 - + "ooooong")).entrySet()) {} //indent:15 exp:>=10 - - for (String string : new SecondForClassWithLongName(getString(1024 //indent:6 exp:6 - , "Looooooooooooooooooong")). //indent:10 exp:10 - getList(new FooForClass(), 1000, getString(1024, //indent:10 exp:10 - "Loooooooooooooooooooooooooooooooo" //indent:10 exp:10 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:10 exp:10 - + "oooooooooong"))) {} //indent:10 exp:10 - - for (String string : new SecondForClassWithLongName(getString(1024 //indent:6 exp:6 - , "Looooooooooooooooooong")). //indent:15 exp:>=10 - getList(new FooForClass(), 1000, getString(1024, //indent:13 exp:>=10 - "Loooooooooooooooooooooooooooooooo" //indent:19 exp:>=10 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:21 exp:>=10 - + "oooooooooong"))) {} //indent:10 exp:10 - } //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondForClassWithLongName //indent:0 exp:0 - implements Iterable{ //indent:8 exp:>=4 - - public SecondForClassWithLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - int getInteger(FooForClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - Map getMap(FooForClass instance, int integer, String string) { //indent:2 exp:2 - return new HashMap(); //indent:4 exp:4 - } //indent:2 exp:2 - - List getList(FooForClass instance, long longLong, String string) { //indent:2 exp:2 - return new ArrayList(); //indent:4 exp:4 - } //indent:2 exp:2 - - public Iterator iterator() { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooForClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +class InputIndentationCorrectForAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + for (int i = 1; i < 10; i++) {} + + for (int i = + new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong") + .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong")); + i < 10; + i++) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + } + + class InnerClassFoo { + + void fooMethodWithIf() { + + for (int i = 1; i < 10; i++) {} + + for (int i = + new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong") + .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong")); + i < 10; + i++) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + } + } + + class SecondForClassWithLongName1 implements Iterable { + + public SecondForClassWithLongName1(String string) {} + + int getInteger(FooForClass instance, String string) { + return -1; + } + + Map getMap(FooForClass instance, int integer, String string) { + return new HashMap(); + } + + List getList(FooForClass instance, long longLong, String string) { + return new ArrayList(); + } + + public Iterator iterator() { + return null; + } + } + + class FooForClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectIfAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectIfAndParameter.java index 101e49676c1..eddeb342131 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectIfAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectIfAndParameter.java @@ -1,144 +1,180 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -class InputIndentationCorrectIfAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - if (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondClassLongNam8("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:8 exp:8 - new InnerClassFoo())) {} //indent:8 exp:8 - - if (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongNam8("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooIfClass(), //indent:8 exp:8 - new SecondClassLongNam8("loooooooooong"). //indent:8 exp:8 - getInteger(new FooIfClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongNam8("Looooooooooooooo" //indent:8 exp:8 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongNam8(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooIfClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondClassLongNam8(getString(100000, "Loooooong" //indent:8 exp:8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:8 exp:8 - conditionNoArg() || conditionNoArg()) {} //indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondClassLongNam8 instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - if (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondClassLongNam8("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())) {} //indent:14 exp:>=10 - - if (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondClassLongNam8("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooIfClass(), //indent:10 exp:10 - new SecondClassLongNam8("loooooooooong"). //indent:10 exp:10 - getInteger(new FooIfClass(), "loooooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondClassLongNam8("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondClassLongNam8(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooIfClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondClassLongNam8(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooIfClass anonymousClass = new FooIfClass() { //indent:4 exp:4 - - void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - if (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondClassLongNam8("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())) {} //indent:19 exp:>=12 - - if (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondClassLongNam8("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooIfClass(), //indent:12 exp:12 - new SecondClassLongNam8("loooooooooong"). //indent:12 exp:12 - getInteger(new FooIfClass(), "loooooo ooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondClassLongNam8("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondClassLongNam8(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooIfClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondClassLongNam8(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassLongNam8 { //indent:0 exp:0 - - public SecondClassLongNam8(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooIfClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooIfClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooIfClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongNam8 getInstance() { //indent:2 exp:2 - return new SecondClassLongNam8("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooIfClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +class InputIndentationCorrectIfAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) { + /* foo */ + } + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondClassLongNam3 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooIfClass anonymousClass = + new FooIfClass() { + + void fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "looooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName) { + /* foo */ + } + } + }; + + void fooMethodWithIf() { + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) { + /* foo */ + } + } + } + + class SecondClassLongNam3 { + + public SecondClassLongNam3(String string) {} + + String getString(FooIfClass instance, int integer) { + return "String"; + } + + int getInteger(FooIfClass instance, String string) { + return -1; + } + + boolean getBoolean(FooIfClass instance, boolean flag) { + return false; + } + + SecondClassLongNam3 getInstance() { + return new SecondClassLongNam3("VeryLoooooooooo" + "oongString"); + } + } + + class FooIfClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectNewChildren.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectNewChildren.java new file mode 100644 index 00000000000..eee5fa7eb5c --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectNewChildren.java @@ -0,0 +1,26 @@ +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +/** some javadoc. */ +public class InputIndentationCorrectNewChildren { + + private final StringBuffer filter = + new StringBuffer( + new CharSequence() { + @Override + public char charAt(int index) { + return 'A'; + } + + public int length() { + return 1; + } + + public CharSequence subSequence(int start, int end) { + return this; + } + + public String toString() { + return "Foo"; + } + }); +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectReturnAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectReturnAndParameter.java index b2436fa9b64..72dacaceec4 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectReturnAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectReturnAndParameter.java @@ -1,143 +1,166 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -class InputIndentationCorrectReturnAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean fooMethodWithIf() { //indent:2 exp:2 - - return conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongName("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooReturnClass(), //indent:8 exp:8 - new SecondClassLongName("loooooooooong"). //indent:8 exp:8 - getInteger(new FooReturnClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongName("Looooooooooooooo" //indent:8 exp:8 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongName(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondClassLongName(getString(100000, "Loooooong" //indent:8 exp:8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:8 exp:8 - conditionNoArg() || conditionNoArg();//indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondClassLongName instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - boolean fooMethodWithIf() { //indent:4 exp:4 - return conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondClassLongName("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooReturnClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo()); //indent:14 exp:>=10 - } //indent:4 exp:4 - - boolean fooReturn() { //indent:4 exp:4 - return conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondClassLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooReturnClass(), //indent:10 exp:10 - new SecondClassLongName("loooooooooong"). //indent:10 exp:10 - getInteger(new FooReturnClass(), "looooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondClassLongName("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondClassLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondClassLongName(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg(); //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooReturnClass anonymousClass = new FooReturnClass() { //indent:4 exp:4 - - boolean fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - return conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondClassLongName("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooReturnClass(), //indent:12 exp:12 - new SecondClassLongName("loooooooooong"). //indent:12 exp:12 - getInteger(new FooReturnClass(), "looooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondClassLongName("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondClassLongName(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondClassLongName(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName; //indent:21 exp:>=12 - } //indent:6 exp:6 - - boolean fooReturn() { //indent:6 exp:6 - return conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondClassLongName("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooReturnClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo()); //indent:19 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassLongName { //indent:0 exp:0 - - public SecondClassLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooReturnClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooReturnClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooReturnClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongName getInstance() { //indent:2 exp:2 - return new SecondClassLongName("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooReturnClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +class InputIndentationCorrectReturnAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + boolean fooMethodWithIf() { + + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondClassLongNam4 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooReturnClass anonymousClass = + new FooReturnClass() { + + boolean fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "looooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName; + } + + boolean fooReturn() { + return conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam4("Loooooooooooooooooog") + .getInteger(new FooReturnClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + } + }; + + boolean fooMethodWithIf() { + return conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam4("Loooooooooooooooooog") + .getInteger(new FooReturnClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + } + + boolean fooReturn() { + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "looooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + } + } + + class SecondClassLongNam4 { + + public SecondClassLongNam4(String string) {} + + String getString(FooReturnClass instance, int integer) { + return "String"; + } + + int getInteger(FooReturnClass instance, String string) { + return -1; + } + + boolean getBoolean(FooReturnClass instance, boolean flag) { + return false; + } + + SecondClassLongNam4 getInstance() { + return new SecondClassLongNam4("VeryLoooooooooo" + "oongString"); + } + } + + class FooReturnClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectWhileDoWhileAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectWhileDoWhileAndParameter.java index 6c4bb492181..8bc42ddf8bd 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectWhileDoWhileAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule452indentcontinuationlines/InputIndentationCorrectWhileDoWhileAndParameter.java @@ -1,221 +1,270 @@ -package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; //indent:0 exp:0 - -class InputIndentationCorrectWhileDoWhileAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondWhileLongName("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:11 exp:>=8 - new InnerClassFoo())) {} //indent:10 exp:>=8 - - do { //indent:4 exp:4 - - } while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondWhileLongName("Loooooooooooooooooog"). //indent:9 exp:>=8 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:15 exp:>=8 - new InnerClassFoo())); //indent:9 exp:>=8 - - while (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondWhileLongName("Looooooooooooo" //indent:9 exp:>=8 - + "oooooooooooong").getString(new FooWhileClass(), //indent:8 exp:8 - new SecondWhileLongName("loooooooooong"). //indent:11 exp:>=8 - getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=8 - SecondWhileLongName("Looooooooooooooo" //indent:14 exp:>=8 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondWhileLongName( //indent:12 exp:>=8 - getString(2048, "Looo" //indent:12 exp:>=8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondWhileLongName(getString(100000, "Loooooong" //indent:11 exp:>=8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:10 exp:>=8 - conditionNoArg() || conditionNoArg()) {} //indent:10 exp:10 - - do { //indent:4 exp:4 - - } while (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondWhileLongName("Looooooooooooo" //indent:10 exp:>=8 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:>=8 - new SecondWhileLongName("loooooooooong"). //indent:8 exp:8 - getInteger(new FooWhileClass(), "loooooooong")), "loooooooooooong") //indent:13 exp:>=8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondWhileLongName("Looooooooooooooo" //indent:11 exp:>=8 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:8 exp:8 - SecondWhileLongName(getString(100000, "Loooooong" //indent:11 exp:>=8 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:13 exp:>=8 - conditionNoArg() || conditionNoArg()); //indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondWhileLongName instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondWhileLongName("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())) {} //indent:14 exp:>=10 - - do { //indent:6 exp:6 - /* Do something*/ //indent:8 exp:8 - } while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondWhileLongName("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())); //indent:14 exp:>=10 - - while (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondWhileLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10 - new SecondWhileLongName("loooooooooong"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "loooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondWhileLongName("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondWhileLongName(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10 - - do { //indent:6 exp:6 - /* Do smth*/ //indent:8 exp:8 - } while (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondWhileLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10 - new SecondWhileLongName("loooooooooong"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "loooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondWhileLongName("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10 - SecondWhileLongName(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()); //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooWhileClass anonymousClass = new FooWhileClass() { //indent:4 exp:4 - - void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondWhileLongName("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())) {} //indent:19 exp:>=12 - - do { //indent:8 exp:8 - /* Do smth*/ //indent:10 exp:10 - } while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondWhileLongName("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())); //indent:19 exp:>=12 - - while (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondWhileLongName("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12 - new SecondWhileLongName("loooooooooong"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "loooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondWhileLongName("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondWhileLongName(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12 - - do { //indent:8 exp:8 - /* Do smth*/ //indent:10 exp:10 - } while (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondWhileLongName("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12 - new SecondWhileLongName("loooooooooong"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "loooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondWhileLongName("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12 - SecondWhileLongName(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName);//indent:21 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondWhileLongName { //indent:0 exp:0 - - public SecondWhileLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooWhileClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooWhileClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooWhileClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondWhileLongName getInstance() { //indent:2 exp:2 - return new SecondWhileLongName("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooWhileClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule452indentcontinuationlines; + +class InputIndentationCorrectWhileDoWhileAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do {} while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) {} + + do {} while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()); + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondWhileLongNam1 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooWhileClass anonymousClass = + new FooWhileClass() { + + void fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do { + /* Do smth*/ + + } while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName) {} + + do { + /* Do smth*/ + + } while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName); + } + }; + + void fooMethodWithIf() { + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do { + /* Do something*/ + + } while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) {} + + do { + /* Do smth*/ + + } while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()); + } + } + + class SecondWhileLongNam1 { + + public SecondWhileLongNam1(String string) {} + + String getString(FooWhileClass instance, int integer) { + return "String"; + } + + int getInteger(FooWhileClass instance, String string) { + return -1; + } + + boolean getBoolean(FooWhileClass instance, boolean flag) { + return false; + } + + SecondWhileLongNam1 getInstance() { + return new SecondWhileLongNam1("VeryLoooooooooo" + "oongString"); + } + } + + class FooWhileClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputEmptyLineSeparator.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputEmptyLineSeparator.java deleted file mode 100644 index 04e11986aae..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputEmptyLineSeparator.java +++ /dev/null @@ -1,126 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; //warn -import java.io.Serializable; //warn -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.Collections; -import java.util.Calendar; -import java.util.Set; - -import javax.swing.AbstractAction; - -import org.apache.commons.beanutils.locale.converters.ByteLocaleConverter; -class InputEmptyLineSeparator //warn -{ - public static final double FOO_PI = 3.1415; - private boolean flag = true; - static { //warn - //empty static initializer - } - - { - //empty instance initializer - } - - /** - * - * - * - */ - private InputEmptyLineSeparator() - { - //empty - } - - public int compareTo(InputEmptyLineSeparator aObject) - { - int number = 0; - return 0; - } - /** - * - * @param task - * @param result - * @return - */ - public static Callable callable(Runnable task, T result) // warn - { - return null; - } - - public int getBeastNumber() - { - return 666; - } - interface IntEnum { //warn - } - - class InnerClass { - - public static final double FOO_PI_INNER = 3.1415; - private boolean flagInner = true; - { //warn - //empty instance initializer - } - - private InnerClass() - { - //empty - } - - } - - class InnerClass2 { //ok - private InnerClass2() //ok - { - //empty - } - } - - class InnerClass3 { //ok - public int compareTo(InputEmptyLineSeparator aObject) //ok - { - int number = 0; - return 0; - } - - } -} - -class Clazz { //ok - private Clazz() {} //ok -} -class Class2{ //warn - public int compareTo(InputEmptyLineSeparator aObject) //ok - { - int number = 0; - return 0; - } - Class2 anon = new Class2(){ //warn - public int compareTo(InputEmptyLineSeparator aObject) //ok - { - int number = 0; - return 0; - } - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputFormattedVerticalWhitespace.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputFormattedVerticalWhitespace.java new file mode 100644 index 00000000000..805223e882d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputFormattedVerticalWhitespace.java @@ -0,0 +1,109 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; + +import java.util.concurrent.Callable; + +class InputFormattedVerticalWhitespace { + public static final double FOO_PI = 3.1415; + private boolean flag = true; + + static { + // empty static initializer + } + + { + // empty instance initializer + } + + /** Some javadoc. */ + private InputFormattedVerticalWhitespace() { + // empty + } + + public int compareTo(InputFormattedVerticalWhitespace obj) { + int number = 0; + return 0; + } + + /** + * Some javadoc. + * + * @param task some description. + * @param result some description. + * @return some description. + */ + public static Callable callable(Runnable task, T result) { + + return null; + } + + public int getBeastNumber() { + return 666; + } + + interface IntEnum {} + + class InnerClass { + + public static final double FOO_PI_INNER = 3.1415; + private boolean flagInner = true; + + { + // empty instance initializer + } + + private InnerClass() { + // empty + } + } + + class InnerClass2 { // ok + private InnerClass2() { // ok + // empty + } + } + + class InnerClass3 { // ok + public int compareTo(InputFormattedVerticalWhitespace obj) { // ok + int number = 0; + return 0; + } + } + + class Clazz { // ok + private Clazz() {} // ok + } + + class Class2 { + public int compareTo(InputFormattedVerticalWhitespace obj) { // ok + int number = 0; + return 0; + } + + Class2 anon = + new Class2() { + public int compareTo(InputFormattedVerticalWhitespace obj) { // ok + int number = 0; + return 0; + } + }; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputVerticalWhitespace.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputVerticalWhitespace.java new file mode 100644 index 00000000000..dc90901a6e9 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule461verticalwhitespace/InputVerticalWhitespace.java @@ -0,0 +1,102 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// +// violation below ''package' should be separated from previous line.' +package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace; +import java.util.concurrent.Callable; // violation ''import' should be separated from previous line.' +class InputVerticalWhitespace { // violation ''CLASS_DEF' should be separated from previous line.' + public static final double FOO_PI = 3.1415; + private boolean flag = true; + static { // violation ''STATIC_INIT' should be separated from previous line.' + // empty static initializer + } + + { + // empty instance initializer + } + + /** Some javadoc. */ + private InputVerticalWhitespace() { + // empty + } + + public int compareTo(InputVerticalWhitespace obj) { + int number = 0; + return 0; + } + /** + * Some javadoc. + * + * @param task some description. + * @param result some description. + * @return some description. + */ + public static Callable callable(Runnable task, T result) { + // violation above ''METHOD_DEF' should be separated from previous line.' + return null; + } + + public int getBeastNumber() { + return 666; + } + interface IntEnum { // violation ''INTERFACE_DEF' should be separated from previous line.' + } + + class InnerClass { + + public static final double FOO_PI_INNER = 3.1415; + private boolean flagInner = true; + { // violation ''INSTANCE_INIT' should be separated from previous line.' + // empty instance initializer + } + + private InnerClass() { + // empty + } + } + + class InnerClass2 { // ok + private InnerClass2() { // ok + // empty + } + } + + class InnerClass3 { // ok + public int compareTo(InputVerticalWhitespace obj) { // ok + int number = 0; + return 0; + } + } + + class Clazz { // ok + private Clazz() {} // ok + } + class Class2 { // violation ''CLASS_DEF' should be separated from previous line.' + public int compareTo(InputVerticalWhitespace obj) { // ok + int number = 0; + return 0; + } + Class2 anon = // violation ''VARIABLE_DEF' should be separated from previous line.' + new Class2() { + public int compareTo(InputVerticalWhitespace obj) { // ok + int number = 0; + return 0; + } + }; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedGenericWhitespace.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedGenericWhitespace.java new file mode 100644 index 00000000000..cf153b4d199 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedGenericWhitespace.java @@ -0,0 +1,54 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; + +class InputFormattedGenericWhitespace + implements Comparable, Serializable { + InputFormattedGenericWhitespace(List things, int i) {} + + public InputFormattedGenericWhitespace(List things) {} + + public static Callable callable(Runnable task, T result) { + return null; + } + + public static Callable callable2(Runnable task, T result) { + Map, Integer> x = new HashMap, Integer>(); + for (final Map.Entry, Integer> entry : x.entrySet()) { + entry.getValue(); + } + Class[] parameterClasses = new Class[0]; + return null; + } + + void meth() { + List x = new ArrayList(); + List> y = new ArrayList>(); + List a = new ArrayList(); + List> b = new ArrayList>(); + } + + public int compareTo(InputFormattedGenericWhitespace obj) { + return 0; + } + + public int getConstructor(Class... parameterTypes) { + Collections.emptySet(); + Collections.emptySet(); + return 666; + } + + public interface IntEnum {} + + public static class IntEnumValueType & IntEnum> {} + + public static class IntEnumValueType2 & IntEnum> {} + + public static class IntEnumValueType3 & IntEnum> {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedGenericWhitespaceEndsTheLine.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedGenericWhitespaceEndsTheLine.java new file mode 100644 index 00000000000..f82769268d4 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedGenericWhitespaceEndsTheLine.java @@ -0,0 +1,9 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/** some javadoc. */ +public class InputFormattedGenericWhitespaceEndsTheLine { + /** some javadoc. */ + public boolean returnsGenericObjectAtEndOfLine(Object otherObject) { + return otherObject instanceof Enum; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedMethodParamPad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedMethodParamPad.java new file mode 100644 index 00000000000..4e933c72ea7 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedMethodParamPad.java @@ -0,0 +1,53 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import java.util.Vector; + +/** Test input for MethodDefPadCheck. */ +public class InputFormattedMethodParamPad { + public InputFormattedMethodParamPad() { + super(); + } + + public InputFormattedMethodParamPad(int param) { + super(); + } + + public void method() {} + + public void method(int param) {} + + /** some javadoc. */ + public void method(double param) { + // invoke constructor + InputFormattedMethodParamPad pad = new InputFormattedMethodParamPad(); + pad = new InputFormattedMethodParamPad(); + pad = new InputFormattedMethodParamPad(); + + // call method + method(); + method(); + } + + /** some javadoc. */ + public void dottedCalls() { + this.method(); + this.method(); + this.method(); + + InputFormattedMethodParamPad p = new InputFormattedMethodParamPad(); + p.method(); + p.method(); + p.method(); + + Integer.parseInt("0"); + Integer.parseInt("0"); + Integer.parseInt("0"); + } + + /** some javadoc. */ + public void newArray() { + int[] a = new int[] {0, 1}; + Vector v = new Vector(); + Vector v1 = new Vector(); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeAnnotations.java new file mode 100644 index 00000000000..1375ede5b99 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeAnnotations.java @@ -0,0 +1,35 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +/** some javadoc. */ +public class InputFormattedNoWhitespaceBeforeAnnotations { + + @Target(ElementType.TYPE_USE) + @interface NonNull {} + + @NonNull int @NonNull [] @NonNull [] fiel1; // ok until #8205 + @NonNull int @NonNull [] @NonNull [] field2; // ok + + public void foo(final char @NonNull [] param) {} // ok + + // @NonNull int @NonNull ... field3; // non-compilable + // @NonNull int @NonNull... field4; // non-compilable + + public void foo1(final char[] param) {} // ok + + public void foo2(final char[] param) {} // ok + + public void foo3(final char @NonNull [] param) {} // ok until #8205 + + public void foo4(final char @NonNull [] param) {} // ok + + void test1(String... param) {} // ok until #8205 + + void test2(String... param) {} // ok until #8205 + + void test3(String @NonNull ... param) {} // ok until #8205 + + void test4(String @NonNull ... param) {} // ok +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeCaseDefaultColon.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeCaseDefaultColon.java new file mode 100644 index 00000000000..1fd991bc226 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeCaseDefaultColon.java @@ -0,0 +1,15 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/** some javadoc. */ +public class InputFormattedNoWhitespaceBeforeCaseDefaultColon { + { + switch (1) { + case 1: + break; + case 2: + break; + default: + break; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeColonOfLabel.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeColonOfLabel.java new file mode 100644 index 00000000000..82455665342 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeColonOfLabel.java @@ -0,0 +1,16 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/** some javadoc. */ +public class InputFormattedNoWhitespaceBeforeColonOfLabel { + + { + label1: + for (int i = 0; i < 10; i++) {} + } + + /** some javadoc. */ + public void foo() { + label2: + while (true) {} + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeEmptyForLoop.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeEmptyForLoop.java new file mode 100644 index 00000000000..310d5d54766 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedNoWhitespaceBeforeEmptyForLoop.java @@ -0,0 +1,24 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/** some javadoc. */ +public class InputFormattedNoWhitespaceBeforeEmptyForLoop { + + /** some javadoc. */ + public static void foo() { + for (; ; ) { // ok + break; + } + for (int x = 0; ; ) { // ok + break; + } + for (int x = 0; ; ) { + break; + } + for (int x = 0; x < 10; ) { // ok + break; + } + for (int x = 0; x < 10; ) { + break; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedParenPad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedParenPad.java new file mode 100644 index 00000000000..91f5ddb2feb --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedParenPad.java @@ -0,0 +1,239 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; + +/** some javadoc. */ +public class InputFormattedParenPad { + boolean fooo = this.bar((true && false) && true); + + String foo() { + return ((Object) bar((1 > 2) ? ((3 < 4) ? false : true) : ((1 == 1) ? false : true))) + .toString(); + } + + /** some javadoc. */ + @MyAnnotation + public boolean bar(boolean a) { + assert (true); + return true; + } + + class ParenPadNoSpace { + ParenPadNoSpace() { + this(0); + } + + ParenPadNoSpace(int i) { + super(); + } + + @SuppressWarnings("") + void method(boolean status) { + try (Writer writer = new StringWriter()) { + do { + writer.append("a"); + } while (status); + } catch (IOException e) { + while (status) { + for (int i = 0; i < (long) (2 * (4 / 2)); i++) { + if (i > 2) { + synchronized (this) { + switch (i) { + case 3: + case (4): + case 5: + break; + default: + } + } + } + } + } + } + } + } + + class ParenPadSpaceLeft { + ParenPadSpaceLeft() { + this(0); + } + + ParenPadSpaceLeft(int i) { + super(); + } + + @SuppressWarnings("") + void method(boolean status) { + try (Writer writer = new StringWriter()) { + do { + writer.append("a"); + } while (status); + } catch (IOException e) { + while (status) { + for (int i = 0; i < (long) (2 * (4 / 2)); i++) { + if (i > 2) { + synchronized (this) { + switch (i) { + case 3: + case (4): + case 5: + break; + default: + } + } + } + } + } + } + } + } + + class ParenPadSpaceRight { + ParenPadSpaceRight() { + this(0); + } + + ParenPadSpaceRight(int i) { + super(); + } + + @SuppressWarnings("") + void method(boolean status) { + try (Writer writer = new StringWriter()) { + do { + writer.append("a"); + } while (status); + } catch (IOException e) { + while (status) { + for (int i = 0; i < (long) (2 * (4 / 2)); i++) { + if (i > 2) { + synchronized (this) { + switch (i) { + case 3: + case (4): + case 5: + break; + default: + } + } + } + } + } + } + } + } + + enum MyEnum { + SOME_CONSTANT() { + final int testing = 2 * (4 / 2); + }; + + private Object exam; + + private static String getterName(Exception t) { + if (t instanceof ClassNotFoundException) { + return ((ClassNotFoundException) t).getMessage(); + } else { + return "?"; + } + } + + /** some javadoc. */ + public void myMethod() { + String s = "test"; + Object o = s; + ((String) o).length(); + ((String) o).length(); + } + + /** some javadoc. */ + public void crisRon() { + Object leo = "messi"; + Object ibra = leo; + ((String) leo).compareTo((String) ibra); + Math.random(); + } + + /** some javadoc. */ + public void intStringConv() { + Object a = 5; + Object b = "string"; + int w = Integer.parseInt((String) a); + int x = Integer.parseInt((String) a); + double y = Double.parseDouble((String) a); + float z = Float.parseFloat((String) a); + String d = ((String) b); + } + + /** some javadoc. */ + public int something(Object o) { + if (o == null || !(o instanceof Float)) { + return -1; + } + return Integer.valueOf(22).compareTo((Integer) o); + } + + private void launch(Integer number) { + String myInt = (number.toString() + '\0'); + boolean result = number == 123; + } + + /** some javadoc. */ + public String testing() { + return (this.exam != null) ? ((Enum) this.exam).name() : null; + } + + Object stringReturnValue(Object result) { + if (result instanceof String) { + result = ((String) result).length(); + } + return result; + } + + private void except() { + java.util.ArrayList arrlist = new java.util.ArrayList(5); + arrlist.add(20); + arrlist.add(15); + arrlist.add(30); + arrlist.add(45); + try { + (arrlist).remove(2); + } catch (IndexOutOfBoundsException x) { + x.getMessage(); + } + org.junit.Assert.assertThat("123", org.hamcrest.CoreMatchers.is("123")); + org.junit.Assert.assertThat("Help! Integers don't work", 0, org.hamcrest.CoreMatchers.is(1)); + } + + private void tryWithResources() throws Exception { + try (AutoCloseable a = null) { + /* foo */ + } + try (AutoCloseable a = null; + AutoCloseable b = null) { + /* foo */ + } + try (AutoCloseable a = null; + AutoCloseable b = null) { + /* foo */ + } + try (AutoCloseable a = null; + AutoCloseable b = null) { + /* foo */ + } + try (AutoCloseable a = null) { + /* foo */ + } + try (AutoCloseable a = null; + AutoCloseable b = null) { + /* foo */ + } + } + } + + @interface MyAnnotation { + String someField() default "Hello world"; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAfterBad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAfterBad.java new file mode 100644 index 00000000000..9630b594b4a --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAfterBad.java @@ -0,0 +1,82 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/** some javadoc. */ +public class InputFormattedWhitespaceAfterBad { + /** some javadoc. */ + public void check1(int x, int y) { + // violation below ''for' construct must use '{}'s.' + for (int a = 1, b = 2; a < 5; a++, b--) + ; + while (x == 0) { + int a = 0; + int b = 1; + } + do { + System.out.println("Testing"); + } while (x == 0 || y == 2); + } + + /** some javadoc. */ + public void check2(final int a, final int b) { + if ((float) a == 0.0) { + System.out.println("true"); + } else { + System.out.println("false"); + } + } + + /** some javadoc. */ + public void check3(int... a) { + Runnable r2 = () -> String.valueOf("Hello world two!"); + switch (a[0]) { + default: + break; + } + } + + /** some javadoc. */ + public void check4() throws java.io.IOException { + try (java.io.InputStream ignored = System.in; ) { + /* foo */ + } + } + + /** some javadoc. */ + public void check5() { + try { + /* foo */ + } finally { + /* foo */ + } + try { + /* foo */ + } catch (Exception e) { + /* foo */ + } finally { + /* foo */ + } + } + + /** some javadoc. */ + public void check6() { + try { + /* foo */ + } catch (Exception e) { + /* foo */ + } + } + + /** some javadoc. */ + public void check7() { + synchronized (this) { + } + + synchronized (this) { + } + } + + /** some javadoc. */ + public String check8() { + return ("a" + "b"); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAfterGood.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAfterGood.java new file mode 100644 index 00000000000..12159f10c2d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAfterGood.java @@ -0,0 +1,81 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/** some javadoc. */ +public class InputFormattedWhitespaceAfterGood { + + int xyz; // multiple space between content and double slash. + int abc; // multiple space between double slash and comment's text. + int pqr; // testing both. + + /** some javadoc. */ + public void check1(int x, int y) { + // violation below ''for' construct must use '{}'s.' + for (int a = 1, b = 2; a < 5; a++, b--) + ; + while (x == 0) { + int a = 0; + int b = 1; + } + do { + System.out.println("Testing"); + } while (x == 0 || y == 2); + } + + /** some javadoc. */ + public void check2(final int a, final int b) { + if ((float) a == 0.0) { + System.out.println("true"); + } else { + System.out.println("false"); + } + } + + /** some javadoc. */ + public void check3(int... a) { + Runnable r2 = () -> String.valueOf("Hello world two!"); + switch (a[0]) { + default: + break; + } + } + + /** some javadoc. */ + public void check4() throws java.io.IOException { + try (java.io.InputStream ignored = System.in) { + /* foo */ + } + try { + /* foo. */ + } catch (Exception e) { + /* foo. */ + } + } + + /** some javadoc. */ + public void check5() { + + try { + /* foo. */ + } catch (Exception e) { + /* foo. */ + } + } + + /** some javadoc. */ + public void check6() { + try { + /* foo. */ + } catch (Exception e) { + /* foo. */ + } + } + + public void check7() { + synchronized (this) { + } + } + + public String check8() { + return ("a" + "b"); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundBasic.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundBasic.java new file mode 100644 index 00000000000..c28e751301e --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundBasic.java @@ -0,0 +1,233 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +/* + * Bug 806242 (NoWhitespaceBeforeCheck violation with an interface). + * + * @author o_sukhodolsky + * @version 1.0 + */ + +/** Class for testing whitespace issues. violation missing author tag. */ +class InputFormattedWhitespaceAroundBasic { + private final int var1 = 1; + private final int var2 = 1; + + /** Should be ok. */ + private final int var3 = 1; + + /** skip blank lines between comment and code, should be ok. */ + private final int var4 = 1; + + int xyz; // multiple space between content and double slash. + int abc; // multiple space between double slash and comment's text. + int pqr; // testing both. + + /** bug 806243 (NoWhitespaceBeforeCheck violation for anonymous inner class). */ + private int test; + + private int i4; + private int i5; + private int i6; + + /** method. */ + void method1() { + final int a = 1; + int b = 1; + b = 1; + b += 1; + b -= -1 + (+b); + b = b++ + b--; // ok + b = ++b - --b; // ok + } + + /** method. */ + void method2() { + synchronized (this) { + } + try { + /* foo */ + } catch (RuntimeException e) { + /* foo */ + } + } + + /** test WS after void return. */ + private void fastExit() { + boolean complicatedStuffNeeded = true; + if (!complicatedStuffNeeded) { + // should not complain about missing WS after return + } else { + // do complicated stuff + } + } + + /** + * test WS after non void return. + * + * @return 2 + */ + private int nonVoid() { + if (true) { + return (2); + } else { + return 2; // this is ok + } + } + + /** test casts. */ + private void testCasts() { + Object o = (Object) new Object(); // ok + o = (Object) o; // ok + o = (Object) o; // ok + o = (Object) o; // ok + } + + /** test questions. */ + private void testQuestions() { + + boolean b = (1 == 2) ? false : true; + } + + /** star test. */ + private void starTest() { + int x = 2 * 3 * 4; + } + + /** boolean test. */ + private void boolTest() { + boolean a = true; + boolean x = !a; + int z = ~1 + ~2; + } + + /** division test. */ + private void divTest() { + int a = 4 % 2; + int b = 4 % 2; + int c = 4 % 2; + int d = 4 % 2; + int e = 4 / 2; + int f = 4 / 2; + int g = 4 / 2; + } + + /** + * summary. + * + * @return dot test * + */ + private String dotTest() { + Object o = new Object(); + o.toString(); + o.toString(); + o.toString(); + return o.toString(); + } + + /** assert statement test. */ + public void assertTest() { + // OK + assert true; + + // OK + assert true : "Whups"; + + // evil colons, should be OK + assert "OK".equals(null) ? false : true : "Whups"; + + // missing WS around assert + assert (true); + + // missing WS around colon + assert true : "Whups"; + } + + /** another check. */ + void donBradman(Runnable run) { + donBradman( + new Runnable() { + public void run() {} + }); + + final Runnable r = + new Runnable() { + public void run() {} + }; + } + + /** rfe 521323, detect whitespace before ';'. */ + void rfe521323() { + doStuff(); + for (int i = 0; i < 5; i++) {} + } + + /** bug 806243 (NoWhitespaceBeforeCheck violation for anonymous inner class). */ + void bug806243() { + Object o = + new InputFormattedWhitespaceAroundBasic() { + private int test; + }; + } + + void doStuff() {} + + interface Foo { + void foo(); + } + + /** + * Avoid Whitespace violations in for loop. + * + * @author lkuehne + * @version 1.0 + */ + class SpecialCasesInForLoop { + void forIterator() { + // avoid conflict between WhiteSpaceAfter ';' and ParenPad(nospace) + for (int i = 0; i++ < 5; ) { + // ^ no whitespace + } + + // bug 895072 + // avoid conflict between ParenPad(space) and NoWhiteSpace before ';' + int i = 0; + for (; i < 5; i++) { + // ^ whitespace + } + for (int anInt : getSomeInts()) { + // Should be ignored + } + } + + int[] getSomeInts() { + int i = 2 / 3; + return null; + } + + void forColon() { + int[] ll = new int[10]; + for (int x : ll) {} + for (int x : ll) {} + for (int x : ll) {} + for (int x : ll) {} // ok + } + } + + /** Operators mentioned in Google Coding Standards 2016-07-12. */ + class NewGoogleOperators { + NewGoogleOperators() { + Runnable l; + + l = () -> {}; + l = () -> {}; + l = () -> {}; // ok + l = () -> {}; // ok + + java.util.Arrays.sort(null, String::compareToIgnoreCase); + java.util.Arrays.sort(null, String::compareToIgnoreCase); + + new Object().toString(); + new Object().toString(); + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundEmptyTypesAndCycles.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundEmptyTypesAndCycles.java new file mode 100644 index 00000000000..da07af09b6d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundEmptyTypesAndCycles.java @@ -0,0 +1,22 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import java.util.function.Function; +import java.util.function.Supplier; + +class InputFormattedWhitespaceAroundEmptyTypesAndCycles { + + private void foo() { + int i = 0; + String[][] x = {{"foo"}}; + for (int first = 0; first < 5; first++) {} // ok + int j = 0; + while (j == 1) {} // ok + do {} while (i == 1); // ok + } + + enum EmptyFooEnum {} // ok + + interface SupplierFunction extends Function, T> {} // ok + + class EmptyFoo {} // ok +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundGenerics.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundGenerics.java new file mode 100644 index 00000000000..2716c33ec17 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputFormattedWhitespaceAroundGenerics.java @@ -0,0 +1,35 @@ +package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + +import java.util.Collection; +import java.util.Map; + +// we need these interfaces for generics +// violation below 'Top-level class Foo3 has to reside in its own source file.' +interface Foo3 {} + +// violation below 'Top-level class Foo22 has to reside in its own source file.' +interface Foo22 {} + +/** some javadoc. */ +public class InputFormattedWhitespaceAroundGenerics {} + +// No whitespace after commas +// violation below 'Top-level class BadCommas2 has to reside in its own source file.' +class BadCommas2> { + private final java.util.Hashtable test = new java.util.Hashtable(); +} + +// violation below 'Top-level class Wildcard2 has to reside in its own source file.' +class Wildcard2 { + public static void foo(Collection collection) { + // A statement is important in this method to flush out any + // issues with parsing the wildcard in the signature + collection.size(); + } + + public static void foo2(Collection collection) { + // A statement is important in this method to flush out any + // issues with parsing the wildcard in the signature + collection.size(); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespace.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespace.java index 1f58f18f2da..ce43d98e66d 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespace.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespace.java @@ -2,64 +2,86 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Callable; -import java.util.Collections; -class InputGenericWhitespace implements Comparable, Serializable -{ - void meth() - { - List x = new ArrayList(); - List> y = new ArrayList>(); - List < Integer > a = new ArrayList < Integer > (); // warn - List < List < Integer > > b = new ArrayList < List < Integer > > (); // warn - } - public int compareTo(InputGenericWhitespace aObject) - { - return 0; - } +class InputGenericWhitespace implements Comparable, Serializable { + InputGenericWhitespace(List things, int i) {} - public static Callable callable(Runnable task, T result) - { - return null; - } + public InputGenericWhitespace(List things) {} - public staticCallable callable2(Runnable task, T result) // warn - { - Map, Integer> x = new HashMap, Integer>(); - for (final Map.Entry, Integer> entry : x.entrySet()) { - entry.getValue(); - } - Class[] parameterClasses = new Class[0]; - return null; - } - public int getConstructor(Class... parameterTypes) - { - Collections.emptySet(); - Collections. emptySet(); // warn - return 666; - } + public static Callable callable(Runnable task, T result) { + return null; + } - InputGenericWhitespace(List things, int i) - { + // 2 violations 3 lines below: + // ''\<' is not preceded with whitespace.' + // ''\>' should followed by whitespace.' + public staticCallable callable2(Runnable task, T result) { + Map, Integer> x = new HashMap, Integer>(); + for (final Map.Entry, Integer> entry : x.entrySet()) { + entry.getValue(); } + Class[] parameterClasses = new Class[0]; + return null; + } - public InputGenericWhitespace(List things) - { - } + void meth() { + List x = new ArrayList(); + List> y = new ArrayList>(); + List < Integer > a = new ArrayList < Integer >(); + // 6 violations above: + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + List < List < Integer > > b = new ArrayList < List < Integer > >(); + // 14 violations above: + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is followed by whitespace.' + // ''\>' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is followed by whitespace.' + // ''\>' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + } - public interface IntEnum { - } + public int compareTo(InputGenericWhitespace obj) { + return 0; + } - public static class IntEnumValueType & IntEnum> { - } + public int getConstructor(Class... parameterTypes) { + Collections.emptySet(); + Collections. emptySet(); + // 2 violations above: + // ''\<' is preceded with whitespace.' + // ''\>' is followed by whitespace.' + return 666; + } - public static class IntEnumValueType2& IntEnum> { // warn - } + public interface IntEnum {} - public static class IntEnumValueType3 & IntEnum> { // warn - } + public static class IntEnumValueType & IntEnum> {} + + public static class IntEnumValueType2& IntEnum> { + // 2 violations above: + // ''&' is not preceded with whitespace.' + // ''&' is not preceded with whitespace.' + } + + public static class IntEnumValueType3 & IntEnum> { + // violation above ''\>' is followed by whitespace.' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespaceEndsTheLine.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespaceEndsTheLine.java index ace8dcd7daa..8aca09152c7 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespaceEndsTheLine.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputGenericWhitespaceEndsTheLine.java @@ -1,7 +1,9 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; +/** some javadoc. */ public class InputGenericWhitespaceEndsTheLine { - public boolean returnsGenericObjectAtEndOfLine(Object otherObject) { - return otherObject instanceof Enum; - } + /** some javadoc. */ + public boolean returnsGenericObjectAtEndOfLine(Object otherObject) { + return otherObject instanceof Enum; + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputMethodParamPad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputMethodParamPad.java index 059314709b5..a5f4f9715c4 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputMethodParamPad.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputMethodParamPad.java @@ -1,63 +1,57 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; + import java.util.Vector; -/** Test input for MethodDefPadCheck */ -public class InputMethodParamPad -{ - public InputMethodParamPad() - { - super(); - } - - public InputMethodParamPad (int aParam) // warn - { - super (); // warn - } - - public void method() - { - } - - public void method (int aParam) // warn - { - } - - public void - method(double aParam) - { - // invoke constructor - InputMethodParamPad pad = new InputMethodParamPad(); - pad = new InputMethodParamPad (); // warn - pad = new + +/** Test input for MethodDefPadCheck. */ +public class InputMethodParamPad { + public InputMethodParamPad() { + super(); + } + + public InputMethodParamPad (int param) { // violation ''(' is preceded with whitespace.' + super (); // violation ''(' is preceded with whitespace.' + } + + public void method() {} + + public void method (int param) {} // violation ''(' is preceded with whitespace.' + + /** some javadoc. */ + public void method(double param) { + // invoke constructor + InputMethodParamPad pad = new InputMethodParamPad(); + pad = new InputMethodParamPad (); // violation ''(' is preceded with whitespace.' + pad = new InputMethodParamPad(); - // call method - method(); - method (); // warn - } - - public void dottedCalls() - { - this.method(); - this.method (); // warn - this. - method(); - - InputMethodParamPad p = new InputMethodParamPad(); - p.method(); - p.method (); // warn - p. - method(); - - java.lang.Integer.parseInt("0"); - java.lang.Integer.parseInt ("0"); // warn - java.lang.Integer. - parseInt("0"); - } - - public void newArray() - { - int[] a = new int[]{0, 1}; - java.util.Vector v = new java.util.Vector(); - java.util.Vector v1 = new Vector(); - } + // call method + method(); + method (); // violation ''(' is preceded with whitespace.' + } + + /** some javadoc. */ + public void dottedCalls() { + this.method(); + this.method (); // violation ''(' is preceded with whitespace.' + this + .method(); + + InputMethodParamPad p = new InputMethodParamPad(); + p.method(); + p.method (); // violation ''(' is preceded with whitespace.' + p + .method(); + + java.lang.Integer.parseInt("0"); + java.lang.Integer.parseInt ("0"); // violation ''(' is preceded with whitespace.' + java.lang.Integer + .parseInt("0"); + } + + /** some javadoc. */ + public void newArray() { + int[] a = new int[]{0, 1}; + java.util.Vector v = new java.util.Vector(); + java.util.Vector v1 = new Vector(); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeAnnotations.java index dc05c8cdb6a..7b68d197306 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeAnnotations.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeAnnotations.java @@ -3,42 +3,33 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Target; -@Target(ElementType.TYPE_USE) -@interface NonNull { - -} - +/** some javadoc. */ public class InputNoWhitespaceBeforeAnnotations { - public void foo(final char @NonNull [] param) {} // ok + @Target(ElementType.TYPE_USE) + @interface NonNull {} + + @NonNull int @NonNull [] @NonNull [] fiel1; // ok until #8205 + @NonNull int @NonNull [] @NonNull [] field2; // ok - @NonNull int @NonNull[] @NonNull[] fiel1; // ok until #8205 - @NonNull int @NonNull [] @NonNull [] field2; // ok - //@NonNull int @NonNull ... field3; // non-compilable - //@NonNull int @NonNull... field4; // non-compilable + public void foo(final char @NonNull [] param) {} // ok + // @NonNull int @NonNull ... field3; // non-compilable + // @NonNull int @NonNull... field4; // non-compilable - public void foo1(final char[] param) { // ok - } + public void foo1(final char[] param) {} // ok - public void foo2(final char [] param) { // ok - } + public void foo2(final char[] param) {} // ok - public void foo3(final char @NonNull[] param) { // ok until #8205 - } + public void foo3(final char @NonNull [] param) {} // ok until #8205 - public void foo4(final char @NonNull [] param) { // ok - } + public void foo4(final char @NonNull [] param) {} // ok - void test1(String... param) { // ok until #8205 - } + void test1(String... param) {} // ok until #8205 - void test2(String ... param) { // ok until #8205 - } + void test2(String... param) {} // ok until #8205 - void test3(String @NonNull... param) { // ok until #8205 - } + void test3(String @NonNull ... param) {} // ok until #8205 - void test4(String @NonNull ... param) { // ok - } + void test4(String @NonNull ... param) {} // ok } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeCaseDefaultColon.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeCaseDefaultColon.java index 38c74603473..1a3481e0206 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeCaseDefaultColon.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeCaseDefaultColon.java @@ -1,14 +1,15 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; +/** some javadoc. */ public class InputNoWhitespaceBeforeCaseDefaultColon { - { - switch(1) { - case 1 : // warn - break; - case 2: - break; - default : // warn - break; - } + { + switch (1) { + case 1 : // violation '':' is preceded with whitespace.' + break; + case 2: + break; + default : // violation '':' is preceded with whitespace.' + break; } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeColonOfLabel.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeColonOfLabel.java index 5443104d86d..aa28c9ee291 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeColonOfLabel.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeColonOfLabel.java @@ -1,14 +1,18 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; +/** some javadoc. */ public class InputNoWhitespaceBeforeColonOfLabel { - { - label1 : // warn - for(int i = 0; i < 10; i++) {} + { + label1 : // violation '':' is preceded with whitespace.' + for (int i = 0; i < 10; i++) { } + } - public void foo() { - label2: - while (true) {} + /** some javadoc. */ + public void foo() { + label2: + while (true) { } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeEmptyForLoop.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeEmptyForLoop.java index c6d72ef4e57..0b0cac55627 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeEmptyForLoop.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeEmptyForLoop.java @@ -1,22 +1,24 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; +/** some javadoc. */ public class InputNoWhitespaceBeforeEmptyForLoop { - public static void f() { - for (; ; ) { // ok - break; - } - for (int x = 0; ; ) { // ok - break; - } - for (int x = 0 ; ; ) { // warning - break; - } - for (int x = 0; x < 10; ) { // ok - break; - } - for (int x = 0; x < 10 ; ) { // warning - break; - } + /** some javadoc. */ + public static void foo() { + for (; ; ) { // ok + break; } + for (int x = 0; ; ) { // ok + break; + } + for (int x = 0 ; ; ) { // violation '';' is preceded with whitespace.' + break; + } + for (int x = 0; x < 10; ) { // ok + break; + } + for (int x = 0; x < 10 ; ) { // violation '';' is preceded with whitespace.' + break; + } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputParenPad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputParenPad.java index f2ee15f7d1e..264df256702 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputParenPad.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputParenPad.java @@ -4,220 +4,378 @@ import java.io.StringWriter; import java.io.Writer; -public class InputParenPad -{ - class ParenPadNoSpace { - ParenPadNoSpace() { - this(0); - } +/** some javadoc. */ +public class InputParenPad { + boolean fooo = this.bar(( true && false ) && true); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' - ParenPadNoSpace(int i) { - super(); - } + String foo() { + return ( (Object // violation ''(' is followed by whitespace.' + ) + bar( ( 1 > 2 ) ? + // 4 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // ''?' should be on a new line.' + ( ( 3 < 4 ) ? false : true ) : + // 4 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + ( ( 1 == 1 ) ? false : true) ) ).toString(); + // 5 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + } + + /** some javadoc. */ + @MyAnnotation + public boolean bar(boolean a) { + assert ( true ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + return true; + } + + class ParenPadNoSpace { + ParenPadNoSpace() { + this(0); + } - @SuppressWarnings("") - void method(boolean status) { - try (Writer writer = new StringWriter()) { - do { - writer.append("a"); - } while (status); - } catch (IOException e) { - while (status) { - for (int i = 0; i < (long) (2 * (4 / 2)); i++) { - if (i > 2) { - synchronized (this) { - switch (i) { - case 3: - case (4): - case 5: - break; - } - } - } - } + ParenPadNoSpace(int i) { + super(); + } + + @SuppressWarnings("") + void method(boolean status) { + try (Writer writer = new StringWriter()) { + do { + writer.append("a"); + } while (status); + } catch (IOException e) { + while (status) { + for (int i = 0; i < (long) (2 * (4 / 2)); i++) { + if (i > 2) { + synchronized (this) { + switch (i) { + case 3: + case (4): + case 5: + break; + default: } + } } + } } + } } + } - class ParenPadSpaceLeft { - ParenPadSpaceLeft( ) { // warning - this( 0); // warning - } + class ParenPadSpaceLeft { + ParenPadSpaceLeft( ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + this( 0); // violation ''(' is followed by whitespace.' + } - ParenPadSpaceLeft( int i) { // warning - super( ); // warning - } + ParenPadSpaceLeft( int i) { // violation ''(' is followed by whitespace.' + super( ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + } - @SuppressWarnings( "") // warning - void method( boolean status) { // warning - try ( Writer writer = new StringWriter( )) { // warning - do { - writer.append("a"); - } while ( status); // warning - } catch ( IOException e) { // warning - while ( status) { // warning - for ( int i = 0; i < ( long) ( 2 * ( 4 / 2)); i++) { // warning - if ( i > 2) { // warning - synchronized ( this) { // warning - switch ( i) { // warning - case 3: - case ( 4): // warning - case 5: - break; - } - } - } - } + @SuppressWarnings( "") // violation ''(' is followed by whitespace.' + void method( boolean status) { // violation ''(' is followed by whitespace.' + try ( Writer writer = new StringWriter( )) { + // 3 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + do { + writer.append("a"); + } while ( status); // violation ''(' is followed by whitespace.' + } catch ( IOException e) { // violation ''(' is followed by whitespace.' + while ( status) { // violation ''(' is followed by whitespace.' + for ( int i = 0; i < ( long) ( 2 * ( 4 / 2)); i++) { + // 3 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + if ( i > 2) { // violation ''(' is followed by whitespace.' + synchronized ( this) { // violation ''(' is followed by whitespace.' + switch ( i) { // violation ''(' is followed by whitespace.' + case 3: + case ( 4): // violation ''(' is followed by whitespace.' + case 5: + break; + default: } + } } + } } + } } + } - class ParenPadSpaceRight { - ParenPadSpaceRight( ) { // warning - this(0 ); // warning - } + class ParenPadSpaceRight { + ParenPadSpaceRight( ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + this(0 ); // violation '')' is preceded with whitespace.' + } - ParenPadSpaceRight(int i ) { // warning - super( ); // warning - } + ParenPadSpaceRight(int i ) { // violation '')' is preceded with whitespace.' + super( ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + } - @SuppressWarnings("" ) // warning - void method(boolean status ) { // warning - try (Writer writer = new StringWriter( ) ) { // warning - do { - writer.append("a" ); // warning - } while (status ); // warning - } catch (IOException e ) { // warning - while (status ) { // warning - for (int i = 0; i < (long ) (2 * (4 / 2 ) ); i++ ) { // warning - if (i > 2 ) { // warning - synchronized (this ) { // warning - switch (i ) { // warning - case 3: - case (4 ): // warning - case 5: - break; - } - } - } - } + @SuppressWarnings("" ) // violation '')' is preceded with whitespace.' + void method(boolean status ) { // violation '')' is preceded with whitespace.' + try (Writer writer = new StringWriter( ) ) { + // 3 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + do { + writer.append("a" ); // violation '')' is preceded with whitespace.' + } while (status ); // violation '')' is preceded with whitespace.' + } catch (IOException e ) { // violation '')' is preceded with whitespace.' + while (status ) { // violation '')' is preceded with whitespace.' + for (int i = 0; i < (long ) (2 * (4 / 2 ) ); i++ ) { + // 3 violations above: + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + if (i > 2 ) { // violation '')' is preceded with whitespace.' + synchronized (this ) { // violation '')' is preceded with whitespace.' + switch (i ) { // violation '')' is preceded with whitespace.' + case 3: + case (4 ): // violation '')' is preceded with whitespace.' + case 5: + break; + default: } + } } + } } + } } + } - String foo() { - return ( (Object // warning - ) bar( ( 1 > 2 ) ? // warning - ( ( 3 < 4 )? false : true ) : // warning - ( ( 1 == 1 ) ? false : true) ) ).toString(); // warning - } - @MyAnnotation - public boolean bar(boolean a) { - assert ( true ); // warning - return true; - } + enum MyEnum { + SOME_CONSTANT( ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + final int testing = 2 * (4 / 2); + }; - boolean fooo = this.bar(( true && false ) && true); // warning -} -@interface MyAnnotation { - String someField( ) default "Hello world"; // warning -} + private Object exam; -enum MyEnum { - SOME_CONSTANT( ) { // warning - int i = (int) (2 * (4 / 2) - ); - }; + private static String getterName( Exception t) { // violation ''(' is followed by whitespace.' + if (t instanceof ClassNotFoundException ) { // violation '')' is preceded with whitespace.' + return ( (ClassNotFoundException) t ).getMessage(); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + } else { + return "?"; + } + } + /** some javadoc. */ public void myMethod() { - String s = "test"; - Object o = s; - ((String)o).length(); - ( (String)o ).length(); // warning + String s = "test"; + Object o = s; + ((String) o).length(); + ( (String) o ).length(); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' } + /** some javadoc. */ public void crisRon() { - Object leo = "messi"; - Object ibra = leo; - ((String)leo).compareTo( (String)ibra ); // warning - Math.random(); + Object leo = "messi"; + Object ibra = leo; + ((String) leo).compareTo( (String) ibra ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + Math.random(); } + /** some javadoc. */ public void intStringConv() { - Object a = 5; - Object b = "string"; - int w = Integer.parseInt((String)a); - int x = Integer.parseInt( (String)a); // warning - double y = Double.parseDouble((String)a ); // warning - float z = Float.parseFloat( (String)a ); // warning - String d = ((String)b); - } - - public int something( Object o ) { // warning - if ( o == null || !( o instanceof Float ) ) { // warning - return -1; - } - return Integer.valueOf( 22 ).compareTo( (Integer) o ); // warning + Object a = 5; + Object b = "string"; + int w = Integer.parseInt((String) a); + int x = Integer.parseInt( (String) a); // violation ''(' is followed by whitespace.' + double y = Double.parseDouble((String) a ); // violation '')' is preceded with whitespace.' + float z = Float.parseFloat( (String) a ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + String d = ((String) b); } - private void launch(Integer number ) { // warning - String myInt = ( number.toString() + '\0' ); // warning - boolean result = false; - if (number == 123) - result = true; + /** some javadoc. */ + public int something( Object o ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + if ( o == null || !( o instanceof Float ) ) { + // 4 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + return -1; + } + return Integer.valueOf( 22 ).compareTo( (Integer) o ); + // 4 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' } - private static String getterName( Exception t) { // warning - if (t instanceof ClassNotFoundException ) { // warning - return ( (ClassNotFoundException) t ).getMessage(); // warning - } - else { - return "?"; - } + private void launch(Integer number ) { // violation '')' is preceded with whitespace.' + String myInt = ( number.toString() + '\0' ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + boolean result = number == 123; } - private Object exam; - + /** some javadoc. */ public String testing() { - return ( this.exam != null ) // warning - ? ( ( Enum )this.exam ).name() // warning - : null; + return ( this.exam != null ) + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + ? ( ( Enum ) this.exam ).name() + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + : null; } - Object stringReturnValue( Object result ) { // warning - if ( result instanceof String ) { // warning - result = ( (String) result ).length(); // warning - } - return result; + Object stringReturnValue( Object result ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + if ( result instanceof String ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + result = ( (String) result ).length(); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + } + return result; } - - private void except() { - java.util.ArrayList arrlist = new java.util.ArrayList( 5 ); // warning - arrlist.add( 20); // warning - arrlist.add(15 ); // warning - arrlist.add( 30 ); // warning - arrlist.add(45); - try { - ( arrlist ).remove( 2); // warning - } catch ( IndexOutOfBoundsException x ) { // warning - x.getMessage(); - } - org.junit.Assert.assertThat( "123", org.hamcrest.CoreMatchers.is( "123" ) ); // warning - org.junit.Assert.assertThat( "Help! Integers don't work", // warning - 0, org.hamcrest.CoreMatchers.is( 1 ) ); // warning + java.util.ArrayList arrlist = new java.util.ArrayList( 5 ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + arrlist.add( 20); // violation ''(' is followed by whitespace.' + arrlist.add(15 ); // violation '')' is preceded with whitespace.' + arrlist.add( 30 ); + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + arrlist.add(45); + try { + ( arrlist ).remove( 2); + // 3 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // ''(' is followed by whitespace.' + } catch ( IndexOutOfBoundsException x ) { + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + x.getMessage(); + } + org.junit.Assert.assertThat( "123", org.hamcrest.CoreMatchers.is( "123" ) ); + // 4 violations above: + // ''(' is followed by whitespace.' + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' + org.junit.Assert.assertThat( "Help! Integers don't work", + // violation above ''(' is followed by whitespace.' + 0, org.hamcrest.CoreMatchers.is( 1 ) ); + // 3 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + // '')' is preceded with whitespace.' } private void tryWithResources() throws Exception { - try (AutoCloseable a = null) {} // ok - try (AutoCloseable a = null; AutoCloseable b = null) {} // ok - try (AutoCloseable a = null; AutoCloseable b = null; ) {} // ok - try (AutoCloseable a = null; AutoCloseable b = null; ) {} // ok - try (AutoCloseable a = null ) {} // warning - try (AutoCloseable a = null; AutoCloseable b = null ) {} // warning + try (AutoCloseable a = null) {} + // 3 violations above: + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + try (AutoCloseable a = null; + AutoCloseable b = null) {} + // 3 violations above: + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + try (AutoCloseable a = null; + AutoCloseable b = null) {} + // 3 violations above: + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + try (AutoCloseable a = null; + AutoCloseable b = null) {} + // 3 violations above: + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + try (AutoCloseable a = null ) {} + // 4 violations above: + // '')' is preceded with whitespace.' + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + try (AutoCloseable a = null; + AutoCloseable b = null ) {} + // 4 violations above: + // '')' is preceded with whitespace.' + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' } + } + + @interface MyAnnotation { + String someField( ) default "Hello world"; + // 2 violations above: + // ''(' is followed by whitespace.' + // '')' is preceded with whitespace.' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterBad.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterBad.java index 423f3013da0..851695dfc31 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterBad.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterBad.java @@ -1,51 +1,133 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; +/** some javadoc. */ public class InputWhitespaceAfterBad { - public void check1(int x,int y){ //warn - for(int a=1,b=2;a<5;a++,b--); // warn - while(x==0){ // warn - int a=0,b=1; // warn - } - do{ // warn - System.out.println("Testing"); - }while(x==0||y==2); // warn - } - public void check2(final int a,final int b){ // warn - if((float)a==0.0){ // warn - System.out.println("true"); - } - else{ //warn - System.out.println("false"); - } + /** some javadoc. */ + public void check1(int x,int y) { // violation '',' is not followed by whitespace.' + for(int a = 1,b = 2;a < 5;a++,b--) + ; + // 7 violations 2 lines above: + // ''for' construct must use '{}'s.' + // ''for' is not followed by whitespace.' + // ''for' is not followed by whitespace.' + // '',' is not followed by whitespace.' + // '';' is not followed by whitespace.' + // '';' is not followed by whitespace.' + // '',' is not followed by whitespace.' + while(x == 0) { + // 2 violations above: + // ''while' is not followed by whitespace.' + // ''while' is not followed by whitespace.' + int a = 0,b = 1; + // 2 violations above: + // 'Each variable declaration must be in its own statement.' + // '',' is not followed by whitespace.' } + do{ + // 3 violations above: + // ''do' is not followed by whitespace.' + // ''do' is not followed by whitespace.' + // ''{' is not preceded with whitespace.' + System.out.println("Testing"); + } while(x == 0 || y == 2); + // 2 violations above: + // ''while' is not followed by whitespace.' + // ''while' is not followed by whitespace.' + } - public void check3 (int...a) { // warn - Runnable r2 = () ->String.valueOf("Hello world two!"); // warn - switch(a[0]) { // warn - default: - break; - } + /** some javadoc. */ + public void check2(final int a,final int b) { // violation '',' is not followed by whitespace.' + if((float)a == 0.0) { + // 3 violations above: + // ''if' is not followed by whitespace.' + // ''if' is not followed by whitespace.' + // ''typecast' is not followed by whitespace.' + System.out.println("true"); + } else{ + // 3 violations above: + // ''else' is not followed by whitespace.' + // ''else' is not followed by whitespace.' + // ''{' is not preceded with whitespace.' + System.out.println("false"); } + } - public void check4() throws java.io.IOException { - try(java.io.InputStream ignored = System.in;) { } // warn + /** some javadoc. */ + public void check3(int...a) { // violation ''...' is not followed by whitespace.' + Runnable r2 = () ->String.valueOf("Hello world two!"); + // 2 violations above: + // ''->' is not followed by whitespace.' + // ''->' is not followed by whitespace.' + switch(a[0]) { + // 2 violations above: + // ''switch' is not followed by whitespace.' + // ''switch' is not followed by whitespace.' + default: + break; } + } + + /** some javadoc. */ + public void check4() throws java.io.IOException { + try(java.io.InputStream ignored = System.in;) {} + // 5 violations above: + // ''try' is not followed by whitespace.' + // ''try' is not followed by whitespace.' + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + } - public void check5() { - try {} finally{} // warn - try {} catch (Exception e){} finally{} // warn + /** some javadoc. */ + public void check5() { + try { + /* foo */ + } finally{ + // 3 violations above: + // ''finally' is not followed by whitespace.' + // ''finally' is not followed by whitespace.' + // ''{' is not preceded with whitespace.' } + try { + /* foo */ + } catch (Exception e) { + /* foo */ + } finally{ + // 3 violations above: + // ''finally' is not followed by whitespace.' + // ''finally' is not followed by whitespace.' + // ''{' is not preceded with whitespace.' + } + } - public void check6() { - try {} catch(Exception e){} // warn + /** some javadoc. */ + public void check6() { + try { + /* foo */ + } catch(Exception e) { + // 2 violations above: + // ''catch' is not followed by whitespace.' + // ''catch' is not followed by whitespace.' } + } - public void check7() { - synchronized(this) { } // warn - synchronized (this) { } + /** some javadoc. */ + public void check7() { + synchronized(this) { + // 2 violations above: + // ''synchronized' is not followed by whitespace.' + // ''synchronized' is not followed by whitespace.' } - public String check8() { - return("a" + "b"); // warn + synchronized (this) { } + } + + /** some javadoc. */ + public String check8() { + return("a" + "b"); + // 2 violations above: + // ''return' is not followed by whitespace.' + // ''return' is not followed by whitespace.' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterGood.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterGood.java index be004d42b2e..06e12a9d300 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterGood.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAfterGood.java @@ -1,51 +1,82 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; +/** some javadoc. */ public class InputWhitespaceAfterGood { - public void check1(int x, int y){ - for (int a=1, b=2; a<5; a++, b--); - while (x==0){ - int a=0, b=1; - } - do { - System.out.println("Testing"); - }while (x==0||y==2); - } - public void check2(final int a, final int b){ - if ((float) a==0.0){ - System.out.println("true"); - } - else { - System.out.println("false"); - } + + int xyz; // multiple space between content and double slash. + int abc; // multiple space between double slash and comment's text. + int pqr; // testing both. + + /** some javadoc. */ + public void check1(int x, int y) { + // violation below ''for' construct must use '{}'s.' + for (int a = 1, b = 2; a < 5; a++, b--) + ; + while (x == 0) { + int a = 0, b = 1; // violation 'Each variable declaration must be in its own statement.' } + do { + System.out.println("Testing"); + } while (x == 0 || y == 2); + } - public void check3(int... a) { - Runnable r2 = () -> String.valueOf("Hello world two!"); - switch (a[0]) { - default: - break; - } + /** some javadoc. */ + public void check2(final int a, final int b) { + if ((float) a == 0.0) { + System.out.println("true"); + } else { + System.out.println("false"); } + } - public void check4() throws java.io.IOException { - try (java.io.InputStream ignored = System.in) {} - try {} catch (Exception e){} + /** some javadoc. */ + public void check3(int... a) { + Runnable r2 = () -> String.valueOf("Hello world two!"); + switch (a[0]) { + default: + break; } + } - public void check5() { - try {} finally {} - try {} catch (Exception e){} finally {} + /** some javadoc. */ + public void check4() throws java.io.IOException { + try (java.io.InputStream ignored = System.in) {} + // 3 violations above: + // 'Empty try block.' + // ''{' is not followed by whitespace.' + // ''}' is not preceded with whitespace.' + try { + /* foo. */ + } catch (Exception e) { + /* foo. */ } + } - public void check6() { - try {} catch (Exception e){} + /** some javadoc. */ + public void check5() { + + try { + /* foo. */ + } catch (Exception e) { + /* foo. */ } + } - public void check7() { - synchronized (this) { } + /** some javadoc. */ + public void check6() { + try { + /* foo. */ + } catch (Exception e) { + /* foo. */ } + } - public String check8() { - return ("a" + "b"); + public void check7() { + synchronized (this) { } + } + + public String check8() { + return ("a" + "b"); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundBasic.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundBasic.java index b89ffaef503..2fd19b18b14 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundBasic.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundBasic.java @@ -1,268 +1,250 @@ package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace; -/** - * Class for testing whitespace issues. - * violation missing author tag - **/ -class InputWhitespaceAroundBasic -{ - /** warn **/ - private int mVar1= 1; // warn - /** warn **/ - private int mVar2 =1; // warn - /** Should be ok **/ - private int mVar3 = 1; - - /** method **/ - void method1() - { - final int a = 1; - int b= 1; // warn - b= 1; // warn - b +=1; // warn - b -=- 1 + (+ b); // warn - b = b ++ + b --; // ok - b = ++ b - -- b; // ok - } - - /** method **/ - void method2() - { - synchronized(this) { //warn - } - try {//warn - } - catch (RuntimeException e) {//warn - } - } - - /** - skip blank lines between comment and code, - should be ok - **/ - - - private int mVar4 = 1; - - - /** test WS after void return */ - private void fastExit() - { - boolean complicatedStuffNeeded = true; - if( !complicatedStuffNeeded) //warn - { - return; // should not complain about missing WS after return - } - else - { - // do complicated stuff - } - } - - - /** test WS after non void return - @return 2 - */ - private int nonVoid() - { - if ( true ) - { - return(2); // //warn - } - else - { - return 2; // this is ok - } - } +/* + * Bug 806242 (NoWhitespaceBeforeCheck violation with an interface). + * + * @author o_sukhodolsky + * @version 1.0 + */ - /** test casts **/ - private void testCasts() - { - Object o = (Object) new Object(); // ok - o = (Object)o; // ok - o = ( Object ) o; // ok - o = (Object) +/** Class for testing whitespace issues. violation missing author tag. */ +class InputWhitespaceAroundBasic { + private final int var1= 1; // violation ''=' is not preceded with whitespace.' + private final int var2 =1; // violation ''=' is not followed by whitespace.' + + /** Should be ok. */ + private final int var3 = 1; + + /** skip blank lines between comment and code, should be ok. */ + private final int var4 = 1; + + int xyz; // multiple space between content and double slash. + int abc; // multiple space between double slash and comment's text. + int pqr; // testing both. + + /** bug 806243 (NoWhitespaceBeforeCheck violation for anonymous inner class). */ + private int test; + + private int i4, i5, i6; + // violation above 'Each variable declaration must be in its own statement.' + + /** method. */ + void method1() { + final int a = 1; + int b= 1; // violation ''=' is not preceded with whitespace.' + b= 1; // violation ''=' is not preceded with whitespace.' + b +=1; // violation ''\+=' is not followed by whitespace.' + b -=- 1 + (+ b); // violation ''-=' is not followed by whitespace.' + b = b++ + b--; // ok + b = ++ b - -- b; // ok + } + + /** method. */ + void method2() { + synchronized(this) { + // 2 violations above: + // ''synchronized' is not followed by whitespace.' + // ''synchronized' is not followed by whitespace.' + } + try{ + // 3 violations above: + // ''try' is not followed by whitespace.' + // ''try' is not followed by whitespace.' + // ''{' is not preceded with whitespace.' + } catch (RuntimeException e) {// violation ''{' is not followed by whitespace.' + } + } + + /** test WS after void return. */ + private void fastExit() { + boolean complicatedStuffNeeded = true; + // 2 violations 3 lines below: + // ''if' is not followed by whitespace.' + // ''if' is not followed by whitespace.' + if(!complicatedStuffNeeded) { + // should not complain about missing WS after return + } else { + // do complicated stuff + } + } + + /** + * test WS after non void return. + * + * @return 2 + */ + private int nonVoid() { + if (true) { + return(2); + // 2 violations above: + // ''return' is not followed by whitespace.' + // ''return' is not followed by whitespace.' + } else { + return 2; // this is ok + } + } + + /** test casts. */ + private void testCasts() { + Object o = (Object) new Object(); // ok + o = (Object) o; // ok + o = ( Object ) o; // ok + o = (Object) o; // ok - } - - /** test questions **/ - private void testQuestions() - { - - boolean b = (1 ==2) ? false : true; //warn - } - - /** star test **/ - private void starTest() - { - int x = 2 * 3* 4; //warn - } - - /** boolean test **/ - private void boolTest() - { - boolean a = true; - boolean x = ! a; - int z = ~1 + ~ 2; - } - - /** division test **/ - private void divTest() - { - int a = 4 % 2; - int b = 4% 2;//warn - int c = 4 %2;//warn - int d = 4% 2;//warn - int e = 4 / 2; - int f = 4/ 2;//warn - int g = 4 /2;//warn - - } - - /** @return dot test **/ - private java .lang. String dotTest() - { - Object o = new java.lang.Object(); - o. - toString(); - o - .toString(); - o . toString(); - return o.toString(); - } - - /** assert statement test */ - public void assertTest() - { - // OK - assert true; - - // OK - assert true : "Whups"; - - // evil colons, should be OK - assert "OK".equals(null) ? false : true : "Whups"; - - // missing WS around assert - assert(true);//warn - - // missing WS around colon - assert true: "Whups";//warn - } - - /** another check */ - void donBradman(Runnable aRun) - { - donBradman(new Runnable() { - public void run() { - } + } + + /** test questions. */ + private void testQuestions() { + + boolean b = (1 ==2) ? false : true; // violation ''==' is not followed by whitespace.' + } + + /** star test. */ + private void starTest() { + int x = 2 * 3* 4; // violation ''*' is not preceded with whitespace.' + } + + /** boolean test. */ + private void boolTest() { + boolean a = true; + boolean x = !a; + int z = ~1 + ~2; + } + + /** division test. */ + private void divTest() { + int a = 4 % 2; + int b = 4% 2; // violation ''%' is not preceded with whitespace.' + int c = 4 %2; // violation ''%' is not followed by whitespace.' + int d = 4% 2; // violation ''%' is not preceded with whitespace.' + int e = 4 / 2; + int f = 4/ 2; // violation ''/' is not preceded with whitespace.' + int g = 4 /2; // violation ''/' is not followed by whitespace.' + } + + /** + * summary. + * + * @return dot test * + */ + private java.lang.String dotTest() { + Object o = new java.lang.Object(); + o.toString(); + o.toString(); + o.toString(); + return o.toString(); + } + + /** assert statement test. */ + public void assertTest() { + // OK + assert true; + + // OK + assert true : "Whups"; + + // evil colons, should be OK + assert "OK".equals(null) ? false : true : "Whups"; + + // missing WS around assert + assert(true); // violation ''assert' is not followed by whitespace.' + + // missing WS around colon + assert true: "Whups"; // violation '':' is not preceded with whitespace.' + } + + /** another check. */ + void donBradman(Runnable run) { + donBradman( + new Runnable() { + public void run() {} }); - final Runnable r = new Runnable() { - public void run() { - } + final Runnable r = + new Runnable() { + public void run() {} }; - } - - /** rfe 521323, detect whitespace before ';' */ - void rfe521323() - { - doStuff() ; - // ^ whitespace - for (int i = 0 ; i < 5; i++) { - // ^ whitespace - } - } - - - /** bug 806243 (NoWhitespaceBeforeCheck violation for anonymous inner class) */ - private int i ; - // ^ whitespace - private int i1, i2, i3 ; - // ^ whitespace - private int i4, i5, i6; - - /** bug 806243 (NoWhitespaceBeforeCheck violation for anonymous inner class) */ - void bug806243() - { - Object o = new InputWhitespaceAroundBasic() { - private int j ; - // ^ whitespace + } + + /** rfe 521323, detect whitespace before ';'. */ + void rfe521323() { + doStuff(); + for (int i = 0; i < 5; i++) {} + } + + /** bug 806243 (NoWhitespaceBeforeCheck violation for anonymous inner class). */ + void bug806243() { + Object o = + new InputWhitespaceAroundBasic() { + private int test; }; - } - - void doStuff() { - } -} - -/** - * Bug 806242 (NoWhitespaceBeforeCheck violation with an interface). - * @author o_sukhodolsky - * @version 1.0 - */ -interface IFoo -{ - void foo() ; - // ^ whitespace -} - -/** - * Avoid Whitespace violations in for loop. - * @author lkuehne - * @version 1.0 - */ -class SpecialCasesInForLoop -{ - void forIterator() - { - // avoid conflict between WhiteSpaceAfter ';' and ParenPad(nospace) - for (int i = 0; i++ < 5;) { + } + + void doStuff() {} + + interface Foo { + void foo(); + } + + /** + * Avoid Whitespace violations in for loop. + * + * @author lkuehne + * @version 1.0 + */ + class SpecialCasesInForLoop { + void forIterator() { + // avoid conflict between WhiteSpaceAfter ';' and ParenPad(nospace) + for (int i = 0; i++ < 5; ) { // ^ no whitespace - } + } - // bug 895072 - // avoid conflict between ParenPad(space) and NoWhiteSpace before ';' - int i = 0; - for ( ; i < 5; i++ ) { - // ^ whitespace - } - for (int anInt : getSomeInts()) { - //Should be ignored - } + // bug 895072 + // avoid conflict between ParenPad(space) and NoWhiteSpace before ';' + int i = 0; + for (; i < 5; i++) { + // ^ whitespace + } + for (int anInt : getSomeInts()) { + // Should be ignored + } } int[] getSomeInts() { - int i = (int) ( 2 / 3 ); - return null; + int i = 2 / 3; + return null; } void forColon() { - int ll[] = new int[10]; - for (int x:ll) {} // warn - for (int x :ll) {} // warn - for (int x: ll) {} // warn - for (int x : ll) {} // ok - } -} - -/** - * Operators mentioned in Google Coding Standards 2016-07-12 - */ -class NewGoogleOperators -{ - NewGoogleOperators() - { - Runnable l; - - l = ()-> { }; //warn - l = () ->{ }; //warn - l = () -> { }; //ok - l = () -> {}; //ok - - java.util.Arrays.sort(null, String :: compareToIgnoreCase); - java.util.Arrays.sort(null, String::compareToIgnoreCase); - - new Object().toString(); - new Object() . toString(); - } + int[] ll = new int[10]; + for (int x:ll) {} + // 2 violations above: + // '':' is not followed by whitespace.' + // '':' is not preceded with whitespace.' + for (int x :ll) {} // violation '':' is not followed by whitespace.' + for (int x: ll) {} // violation '':' is not preceded with whitespace.' + for (int x : ll) {} // ok + } + } + + /** Operators mentioned in Google Coding Standards 2016-07-12. */ + class NewGoogleOperators { + NewGoogleOperators() { + Runnable l; + + l = ()-> {}; // violation ''->' is not preceded with whitespace.' + l = () ->{}; + // 2 violations above: + // ''->' is not followed by whitespace.' + // ''->' is not followed by whitespace.' + l = () -> {}; // ok + l = () -> {}; // ok + + java.util.Arrays.sort(null, String::compareToIgnoreCase); + java.util.Arrays.sort(null, String::compareToIgnoreCase); + + new Object().toString(); + new Object().toString(); + } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundEmptyTypesAndCycles.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundEmptyTypesAndCycles.java index f07d3e920e0..f47e24dccc3 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundEmptyTypesAndCycles.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundEmptyTypesAndCycles.java @@ -3,21 +3,20 @@ import java.util.function.Function; import java.util.function.Supplier; -class InputWhitespaceAroundEmptyTypesAndCycles -{ - private void foo() - { - int i = 0; - String[][] x = { {"foo"} }; - for (int first = 0; first < 5; first++) {} //ok - int j = 0; - while (j == 1) {} //ok - do {} while (i == 1); //ok - } -} +class InputWhitespaceAroundEmptyTypesAndCycles { + + private void foo() { + int i = 0; + String[][] x = {{"foo"}}; + for (int first = 0; first < 5; first++) {} // ok + int j = 0; + while (j == 1) {} // ok + do {} while (i == 1); // ok + } -interface SupplierFunction extends Function, T> {} //ok + enum EmptyFooEnum {} // ok -class EmptyFoo {} //ok + interface SupplierFunction extends Function, T> {} // ok -enum EmptyFooEnum {} //ok + class EmptyFoo {} // ok +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundGenerics.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundGenerics.java index f7c7a8a0fa6..0df2dfb5ca5 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundGenerics.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputWhitespaceAroundGenerics.java @@ -3,35 +3,54 @@ import java.util.Collection; import java.util.Map; -public class InputWhitespaceAroundGenerics -{ - -} +// we need these interfaces for generics +// violation below 'Top-level class Foo has to reside in its own source file.' +interface Foo {} -//No whitespace after commas -class BadCommas < A,B,C extends Map < A,String > > //warn -{ - private java.util.Hashtable < Integer, D > p = //warn - new java.util.Hashtable < Integer, D > (); //warn -} +// violation below 'Top-level class Foo2 has to reside in its own source file.' +interface Foo2 {} -class Wildcard -{ - public static void foo(Collection < ? extends Wildcard[] > collection) { //warn - // A statement is important in this method to flush out any - // issues with parsing the wildcard in the signature - collection.size(); - } +/** some javadoc. */ +public class InputWhitespaceAroundGenerics {} - public static void foo2(Collection collection) { - // A statement is important in this method to flush out any - // issues with parsing the wildcard in the signature - collection.size(); - } +// No whitespace after commas +// violation below 'Top-level class BadCommas has to reside in its own source file.' +class BadCommas < A, B, C extends Map < A, String > > { + // 7 violations above: + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is followed by whitespace.' + // ''\>' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + private final java.util.Hashtable < Integer, Foo > test = + // 3 violations above: + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + new java.util.Hashtable < Integer, Foo >(); + // 3 violations above: + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' } -// we need these interfaces for generics -interface D { -} -interface E { +// violation below 'Top-level class Wildcard has to reside in its own source file.' +class Wildcard { + public static void foo(Collection < ? extends Wildcard[] > collection) { + // 3 violations above: + // ''\<' is followed by whitespace.' + // ''\<' is preceded with whitespace.' + // ''\>' is preceded with whitespace.' + // A statement is important in this method to flush out any + // issues with parsing the wildcard in the signature + collection.size(); + } + + public static void foo2(Collection collection) { + // A statement is important in this method to flush out any + // issues with parsing the wildcard in the signature + collection.size(); + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/InputMultipleVariableDeclarations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/InputMultipleVariableDeclarations.java deleted file mode 100644 index 2d12c827721..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/InputMultipleVariableDeclarations.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule4821onevariableperline; - -public class InputMultipleVariableDeclarations -{ - int i, j; //warn - int i1; int j1; //warn - - void method1() { - String str, str1; //warn - java.lang.Object obj; Object obj1; //warn - } - // second definition is wrapped - // line of VARIABLE_DEF is not the same as first line of the definition - java.lang.String string; java.lang.String //warn - strings[]; - //both definitions are wrapped - java.lang. //warn - String string1; java.lang.String - strings1[]; - - void method2() { - for (int i=0, j=0; i < 10; i++, j--) { //ok - } - - for(int i=0; i<4;i++) { - - } - } - - class Inner { - int i, j; //warn - int i1; int j1; //warn - - void method1() { - String str, str1; //warn - java.lang.Object obj; Object obj1; //warn - } - // second definition is wrapped - // line of VARIABLE_DEF is not the same as first line of the definition - java.lang.String string; java.lang.String //warn - strings[]; - //both definitions are wrapped - java.lang. //warn - String string1; java.lang.String - strings1[]; - - void method2() { - for (int i=0, j=0; i < 10; i++, j--) { //ok - } - - for(int i=0; i<4;i++) { - - } - } - Inner anon = new Inner() - { - int i, j; //warn - int i1; int j1; //warn - - void method1() { - String str, str1; //warn - java.lang.Object obj; Object obj1; //warn - } - // second definition is wrapped - // line of VARIABLE_DEF is not the same as first line of the definition - java.lang.String string; java.lang.String //warn - strings[]; - //both definitions are wrapped - java.lang. //warn - String string1; java.lang.String - strings1[]; - - void method2() { - for (int i=0, j=0; i < 10; i++, j--) { //ok - } - - for(int i=0; i<4;i++) { - - } - } - }; - } -} - -class Suppress { - @SuppressWarnings("unused") //warn - long q1, q2, q3; - - @SuppressWarnings("unused") long q4, q5, q6; //warn -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/InputOneVariablePerDeclaration.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/InputOneVariablePerDeclaration.java new file mode 100644 index 00000000000..ee44e962f25 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4821onevariableperline/InputOneVariablePerDeclaration.java @@ -0,0 +1,117 @@ +package com.google.checkstyle.test.chapter4formatting.rule4821onevariableperline; + +/** Some javadoc. */ +public class InputOneVariablePerDeclaration { + int mnp, efg; // violation 'Each variable declaration must be in its own statement.' + int i1; int j1; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' + + void method1() { + String str, str1; // violation 'Each variable declaration must be in its own statement.' + java.lang.Object obj; Object obj1; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' + } + + // second definition is wrapped + // line of VARIABLE_DEF is not the same as first line of the definition + // violation below 'Only one variable definition per line allowed.' + java.lang.String string; java.lang.String[] + strings; + // both definitions are wrapped + // violation below 'Only one variable definition per line allowed.' + java.lang + .String string1; java.lang.String[] + strings1; + + void method2() { + for (int i = 0, j = 0; i < 10; i++, j--) { // ok + } + + for (int i = 0; i < 4; i++) {} + } + + class Inner { + int xyz, qwe; // violation 'Each variable declaration must be in its own statement.' + int i1; int j1; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' + + void method1() { + String str, str1; + // violation above 'Each variable declaration must be in its own statement.' + java.lang.Object obj; Object obj1; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' + } + + // second definition is wrapped + // line of VARIABLE_DEF is not the same as first line of the definition + // violation below 'Only one variable definition per line allowed.' + java.lang.String string; java.lang.String[] + strings; + // both definitions are wrapped + // violation below 'Only one variable definition per line allowed.' + java.lang + .String string1; java.lang.String[] + strings1; + + void method2() { + for (int i = 0, j = 0; i < 10; i++, j--) { // ok + } + + for (int i = 0; i < 4; i++) {} + } + + Inner anon = + new Inner() { + int abc, pqr; // violation 'Each variable declaration must be in its own statement.' + int i1; int j1; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' + + void method1() { + String str, str1; + // violation above 'Each variable declaration must be in its own statement.' + java.lang.Object obj; Object obj1; + // 2 violations above: + // 'Only one variable definition per line allowed.' + // 'Only one statement per line allowed.' + } + + // second definition is wrapped + // line of VARIABLE_DEF is not the same as first line of the definition + // violation below 'Only one variable definition per line allowed.' + java.lang.String string; java.lang.String[] + strings; + // both definitions are wrapped + // violation below 'Only one variable definition per line allowed.' + java.lang + .String string1; java.lang.String[] + strings1; + // violation 2 lines above '.* incorrect indentation .*, expected .*: 10, 12, 14.' + + void method2() { + for (int i = 0, j = 0; i < 10; i++, j--) { // ok + } + + for (int i = 0; i < 4; i++) {} + } + }; + } + + class Suppress { + @SuppressWarnings("unused") + // violation above 'Each variable declaration must be in its own statement.' + long q1, q2, q3; + + @SuppressWarnings("unused") long q4, q5, q6; + // violation above 'Each variable declaration must be in its own statement.' + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/InputDeclaredWhenNeeded.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/InputDeclaredWhenNeeded.java new file mode 100644 index 00000000000..3392dd30913 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822declaredwhenneeded/InputDeclaredWhenNeeded.java @@ -0,0 +1,752 @@ +package com.google.checkstyle.test.chapter4formatting.rule4822declaredwhenneeded; + +import java.util.Calendar; +import java.util.Locale; +import java.util.TimeZone; + +/** Some javadoc. */ +public class InputDeclaredWhenNeeded { + + private static int test1 = 0; + + static { + int b = 0; + int d = 0; + { + d = ++b; + } + } + + static { + int c = 0; + int a = 3; + int b = 2; + { + a = a + b; + c = b; + } + { + c--; + } + a = 7; + } + + static { + int a = -1; + int b = 2; + b++; + int c = --b; + a = b; // DECLARATION OF VARIABLE 'a' SHOULD BE HERE (distance = 2) + } + + /** Some javadoc. */ + public InputDeclaredWhenNeeded(int test1) { + int temp = -1; + this.test1 = test1; + temp = test1; // DECLARATION OF VARIABLE 'temp' SHOULD BE HERE (distance = 2) + } + + /** Some javadoc. */ + public boolean testMethod() { + int temp = 7; + new InputDeclaredWhenNeeded(2); + String.valueOf(temp); // DECLARATION OF VARIABLE 'temp' SHOULD BE HERE (distance = 2) + boolean result = false; + String str = ""; + if (test1 > 1) { + str = "123"; + result = true; + } + return result; + } + + /** Some javadoc. */ + public void testMethod2() { + int count; + int a = 3; + int b = 2; + { + a = a + b - 5 + 2 * a; + count = b; // DECLARATION OF VARIABLE 'count' SHOULD BE HERE (distance = 2) + } + } + + /** Some javadoc. */ + public void testMethod3() { + int count; + // violation above 'Distance between variable 'count' .* first usage is 4, but allowed 3.*' + int a = 3; + int b = 3; + a = a + b; + b = a + a; + testMethod2(); + count = b; // DECLARATION OF VARIABLE 'count' SHOULD BE HERE (distance = 4) + } + + /** Some javadoc. */ + public void testMethod4(int arg) { + int d = 0; + for (int i = 0; i < 10; i++) { + d++; + if (i > 5) { + d += arg; + } + } + + String[] ar = {"1", "2"}; + for (String st : ar) { + System.identityHashCode(st); + } + } + + /** Some javadoc. */ + public void testMethod5() { + int arg = 7; + boolean b = true; + boolean bb = false; + if (b) { + if (!bb) { + b = false; + } + } + testMethod4(arg); // DECLARATION OF VARIABLE 'arg' SHOULD BE HERE (distance = 2) + } + + /** Some javadoc. */ + public void testMethod6() { + int blockNumWithSimilarVar = 3; + int dist = 0; + int index = 0; + int block = 0; + + if (blockNumWithSimilarVar <= 1) { + do { + dist++; + if (block > 4) { + break; + } + index++; + block++; + } while (index < 7); + } else { + while (index < 8) { + dist += block; + index++; + block++; + } + } + } + + /** Some javadoc. */ + public boolean testMethod7(int a) { + boolean res; + switch (a) { + case 1: + res = true; + break; + default: + res = false; + } + return res; + } + + /** Some javadoc. */ + public void testMethod8() { + int b = 0; + int c = 0; + int m = 0; + int n = 0; + { + c++; + b++; + } + { + n++; // DECLARATION OF VARIABLE 'n' SHOULD BE HERE (distance = 2) + m++; // DECLARATION OF VARIABLE 'm' SHOULD BE HERE (distance = 3) + b++; + } + } + + /** Some javadoc. */ + public void testMethod9() { + boolean result = false; + boolean b1 = true; + boolean b2 = false; + if (b1) { + if (!b2) { + result = true; + } + result = true; + } + } + + /** Some javadoc. */ + public boolean testMethod10() { + boolean result; + try { + result = true; + } catch (Exception e) { + result = false; + } finally { + result = false; + } + return result; + } + + /** Some javadoc. */ + public void testMethod11() { + int a = 0; + int b = 10; + boolean result; + try { + b--; + } catch (Exception e) { + b++; + result = false; // DECLARATION OF VARIABLE 'result' SHOULD BE HERE (distance = 2) + } finally { + a++; + } + } + + /** Some javadoc. */ + public void testMethod12() { + boolean result = false; + boolean b3 = true; + boolean b1 = true; + boolean b2 = false; + if (b1) { + if (b3) { + if (!b2) { + result = true; + } + result = true; + } + } + } + + /** Some javadoc. */ + public void testMethod13() { + int i = 9; + int j = 6; + int g = i + 8; + int k = j + 10; + } + + /** Some javadoc. */ + public void testMethod14() { + Session s = openSession(); + Transaction t = s.beginTransaction(); + // violation above 'Distance between variable 't' .* first usage is 5, but allowed 3.' + A a = new A(); + E d1 = new E(); + C1 c = new C1(); + E d2 = new E(); + a.setForward(d1); + d1.setReverse(a); + c.setForward(d2); // DECLARATION OF VARIABLE 'c' SHOULD BE HERE (distance = 3) + // DECLARATION OF VARIABLE 'd2' SHOULD BE HERE (distance = 3) + d2.setReverse(c); + Serializable aid = s.save(a); + Serializable d2id = s.save(d2); + t.commit(); // DECLARATION OF VARIABLE 't' SHOULD BE HERE (distance = 5) + s.close(); + } + + /** Some javadoc. */ + public boolean isCheckBoxEnabled(int path) { + String model = ""; + if (true) { + for (int index = 0; index < path; ++index) { + int nodeIndex = model.codePointAt(path); + if (model.contains("")) { + return false; + } + } + } else { + int nodeIndex = model.codePointAt(path); + if (model.contains("")) { + return false; + } + } + return true; + } + + /** Some javadoc. */ + public Object readObject(String in) throws Exception { + String startDay = new String(""); + String endDay = new String(""); + return new String(startDay + endDay); + } + + /** Some javadoc. */ + public int[] getSelectedIndices() { + int[] sel = new int[5]; + String model = ""; + int a = 0; + a++; + for (int index = 0; index < 5; ++index) { + sel[index] = Integer.parseInt(model.valueOf(a)); // DECLARATION OF VARIABLE 'sel' + // SHOULD BE HERE (distance = 2) + // DECLARATION OF VARIABLE 'model' + // SHOULD BE HERE (distance = 2) + } + return sel; + } + + /** Some javadoc. */ + public void testMethod15() { + String confDebug = ""; + if (!confDebug.equals("") && !confDebug.equals("null")) { + LogLog.warn("The \"" + "\" attribute is deprecated."); + LogLog.warn("Use the \"" + "\" attribute instead."); + LogLog.setInternalDebugging(confDebug, true); + } + + int i = 0; + int k = 7; + boolean b = false; + for (; i < k; i++) { + b = true; + k++; + } + + int sw; + switch (i) { + case 0: + k++; + sw = 0; // DECLARATION OF VARIABLE 'sw' SHOULD BE HERE (distance = 2) + break; + case 1: + b = false; + break; + default: + b = true; + } + + int wh = 0; + b = true; + do { + k--; + i++; + } while (wh > 0); // DECLARATION OF VARIABLE 'wh' SHOULD BE HERE (distance = 2) + + if (wh > 0) { + k++; + } else if (!b) { + i++; + } else { + i--; + } + } + + /** Some javadoc. */ + public void testMethod16() { + int wh = 1; + int i = 0; + int k = 7; + if (i > 0) { + k++; + } else if (wh > 0) { + i++; + } else { + i--; + } + } + + protected JmenuItem createSubMenuItem(LogLevel level) { + final JmenuItem result = new JmenuItem(level.toString()); + final LogLevel logLevel = level; + result.setMnemonic(level.toString().charAt(0)); + result.addActionListener( + new ActionListener() { + public void actionPerformed(ActionEvent e) { + showLogLevelColorChangeDialog(result, logLevel); + // DECLARATION OF VARIABLE 'logLevel', SHOULD BE HERE (distance = 2) + } + }); + + return result; + } + + /** Some javadoc. */ + public static Color darker(Color color, double fraction) { + int red = (int) Math.round(color.getRed() * (1.0 - fraction)); + int green = (int) Math.round(color.getGreen() * (1.0 - fraction)); + int blue = (int) Math.round(color.getBlue() * (1.0 - fraction)); + + if (red < 0) { + red = 0; + } else if (red > 255) { + red = 255; + } + if (green < 0) { // DECLARATION OF VARIABLE 'green' SHOULD BE HERE (distance = 2) + green = 0; + } else if (green > 255) { + green = 255; + } + if (blue < 0) { // DECLARATION OF VARIABLE 'blue' SHOULD BE HERE (distance = 3) + // blue = 0; + } + + int alpha = color.getAlpha(); + + return new Color(red, green, blue, alpha); + } + + /** Some javadoc. */ + public void testFinal() { + AuthUpdateTask task = null; + final long intervalMs = 30 * 60000L; + Object authCheckUrl = null; + Object authInfo = null; + task = + new AuthUpdateTask( + authCheckUrl, + authInfo, + new IauthListener() { + @Override + public void authTokenChanged(String cookie, String token) { + fireAuthTokenChanged(cookie, token); + } + }); + + Timer timer = new Timer("Auth Guard", true); + timer.schedule(task, intervalMs / 2, intervalMs); // DECLARATION OF VARIABLE 'intervalMs' + // SHOULD BE HERE (distance = 2) + } + + /** Some javadoc. */ + public void testForCycle() { + int filterCount = 0; + for (int i = 0; i < 10; i++, filterCount++) { + int abc = 0; + System.identityHashCode(abc); + + for (int j = 0; j < 10; j++) { + abc = filterCount; + System.identityHashCode(abc); + } + } + } + + /** Some javadoc. */ + public void testIssue321() { + Option srcDdlFile = OptionBuilder.create("f"); + Option logDdlFile = OptionBuilder.create("o"); + Option help = OptionBuilder.create("h"); + + Options options = new Options(); + options.something(); + options.something(); + options.something(); + options.something(); + options.addOption(srcDdlFile, logDdlFile, help); // distance=1 + } + + /** Some javadoc. */ + public void testIssue322() { + int mm = Integer.parseInt("2"); + long timeNow = 0; + Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); + cal.setTimeInMillis(timeNow); + cal.set(Calendar.SECOND, 0); + cal.set(Calendar.MILLISECOND, 0); + cal.set(Calendar.HOUR_OF_DAY, mm); + cal.set(Calendar.MINUTE, mm); // distance=1 + } + + /** Some javadoc. */ + public void testIssue323(MyObject[] objects) { + Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); + for (int i = 0; i < objects.length; i++) { + objects[i].setEnabled(true); + objects[i].setColor(0x121212); + objects[i].setUrl("http://google.com"); + objects[i].setSize(789); + objects[i].setCalendar(cal); // distance=1 + } + } + + /** Some javadoc. */ + public String testIssue324(boolean flag) { + StringBuilder builder = new StringBuilder(); + builder.append("flag is "); + builder.append(flag); + final String line = ""; + if (flag) { + builder.append("line of AST is:"); + builder.append("\n"); + builder.append(String.valueOf(line)); // distance=1 + builder.append("\n"); + } + return builder.toString(); + } + + /** Some javadoc. */ + public void testIssue325() { + Option a = null; + Option b = null; + Option c = null; + boolean isCnull = isNull(c); // distance=1 + boolean isBnull = isNull(b); // distance=1 + boolean isAnull = isNull(a); // distance=1 + } + + /** Some javadoc. */ + public void testIssue326() { + Option aopt = null; + Option bopt = null; + Option copt = null; + isNull(copt); // distance = 1 + isNull(bopt); // distance = 2 + isNull(aopt); // distance = 3 + } + + /** Some javadoc. */ + public void testIssue327() { + String line = "abc"; + OtherWriter.write(line); + line.charAt(1); + Builder.append(line); + test(line, line, line); + } + + /** Some javadoc. */ + public void testIssue328(Writer w1, Writer w2, Writer w3) { + String l1 = "1"; + + w3.write(l1); // distance=3 + } + + /** Some javadoc. */ + public void testIssue329() { + Options options = new Options(); + Option myOption = null; + // violation above 'Distance between variable 'myOption' .* usage is 7, but allowed 3.' + options.addBindFile(null); + options.addBindFile(null); + options.addBindFile(null); + options.addBindFile(null); + options.addBindFile(null); + System.identityHashCode("message"); + myOption.setArgName("abc"); // distance=7 + } + + /** Some javadoc. */ + public void testIssue3210() { + Options options = new Options(); + Option myOption = null; + // violation above 'Distance between variable 'myOption' .* usage is 6, but allowed 3.' + options.addBindFile(null); + options.addBindFile(null); + options.addBindFile(null); + options.addBindFile(null); + options.addBindFile(null); + myOption.setArgName("q"); // distance=6 + } + + /** Some javadoc. */ + public int testIssue3211(String toDir) throws Exception { + int count = 0; + // violation above 'Distance between variable 'count' .* first usage is 4, but allowed 3.' + String[] files = {}; + + System.identityHashCode("Data archival started"); + files.notify(); + System.identityHashCode("sss"); + + if (files == null || files.length == 0) { + System.identityHashCode("No files on a remote site"); + } else { + System.identityHashCode("Files on remote site: " + files.length); + + for (String ftpFile : files) { + if (files.length == 0) { + "".concat(""); + ftpFile.concat(files[2]); + count++; + } + } + } + + System.lineSeparator(); + + return count; + } + + private Session openSession() { + return null; + } + + class Session { + + public Transaction beginTransaction() { + return null; + } + + public void close() {} + + public Serializable save(E d2) { + return null; + } + + public Serializable save(A a) { + return null; + } + } + + class Transaction { + + public void commit() {} + } + + class A { + + public void setForward(E d1) {} + } + + class E { + + public void setReverse(C1 c) {} + + public void setReverse(A a) {} + } + + class C1 { + + public void setForward(E d2) {} + } + + class Serializable {} + + class JmenuItem { + + public JmenuItem(String string) {} + + public void addActionListener(ActionListener actionListener) {} + + public void setMnemonic(char charAt) {} + } + + class LogLevel {} + + class ActionListener {} + + class ActionEvent {} + + private void showLogLevelColorChangeDialog(JmenuItem j, LogLevel l) {} + + static class Color { + + public Color(int red, int green, int blue, int alpha) {} + + public double getRed() { + return 0; + } + + public int getAlpha() { + return 0; + } + + public double getBlue() { + return 0; + } + + public double getGreen() { + return 0; + } + } + + class AuthUpdateTask { + + public AuthUpdateTask(Object authCheckUrl, Object authInfo, IauthListener authListener) {} + } + + interface IauthListener { + + void authTokenChanged(String cookie, String token); + } + + void fireAuthTokenChanged(String s, String s1) {} + + class Timer { + + public Timer(String string, boolean b) {} + + public void schedule(AuthUpdateTask authUpdateTask, long l, long intervalMs) {} + } + + class Option { + + public void setArgName(String string) {} + } + + boolean isNull(Option o) { + return false; + } + + class Writer { + + public void write(String l3) {} + } + + class Options { + + public void addBindFile(Object object) {} + + public void addOption(Option srcDdlFile, Option logDdlFile, Option help) {} + + public void something() {} + } + + class TreeMapNode { + + public TreeMapNode(String label, double d, DefaultValue defaultValue) {} + + public TreeMapNode(String label) {} + } + + class DefaultValue { + + public DefaultValue(double d) {} + } + + static class LogLog { + + public static void warn(String string) {} + + public static void setInternalDebugging(String confDebug, boolean b) {} + } + + static class OptionBuilder { + + public static Option create(String string) { + return null; + } + } + + class MyObject { + + public void setEnabled(boolean b) {} + + public void setCalendar(Calendar cal) {} + + public void setSize(int i) {} + + public void setUrl(String string) {} + + public void setColor(int i) {} + } + + static class OtherWriter { + + public static void write(String line) {} + } + + void test(String s, String s1, String s2) {} + + static class Builder { + + public static void append(String line) {} + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java deleted file mode 100644 index a40cebc136e..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4822variabledistance/InputVariableDeclarationUsageDistanceCheck.java +++ /dev/null @@ -1,806 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule4822variabledistance; -import java.util.*; -public class InputVariableDeclarationUsageDistanceCheck { - - private static int test1 = 0; - - static { - int b = 0; - int d = 0; - { - d = ++b; - } - } - - static { - int c = 0; - int a = 3; - int b = 2; - { - a = a + b; - c = b; - } - { - c--; - } - a = 7; - } - - static { - int a = -1; - int b = 2; - b++; - int c = --b; - a = b; // DECLARATION OF VARIABLE 'a' SHOULD BE HERE (distance = 2) - } - - public InputVariableDeclarationUsageDistanceCheck(int test1) { - int temp = -1; - this.test1 = test1; - temp = test1; // DECLARATION OF VARIABLE 'temp' SHOULD BE HERE (distance = 2) - } - - public boolean testMethod() { - int temp = 7; - new InputVariableDeclarationUsageDistanceCheck(2); - String.valueOf(temp); // DECLARATION OF VARIABLE 'temp' SHOULD BE HERE (distance = 2) - boolean result = false; - String str = ""; - if (test1 > 1) { - str = "123"; - result = true; - } - return result; - } - - public void testMethod2() { - int count; - int a = 3; - int b = 2; - { - a = a - + b - - 5 - + 2 - * a; - count = b; // DECLARATION OF VARIABLE 'count' SHOULD BE HERE (distance = 2) - } - } - - public void testMethod3() { - int count; //warn - int a = 3; - int b = 3; - a = a + b; - b = a + a; - testMethod2(); - count = b; // DECLARATION OF VARIABLE 'count' SHOULD BE HERE (distance = 4) - } - - public void testMethod4(int arg) { - int d = 0; - for (int i = 0; i < 10; i++) { - d++; - if (i > 5) { - d += arg; - } - } - - String ar[] = { "1", "2" }; - for (String st : ar) { - System.identityHashCode(st); - } - } - - public void testMethod5() { - int arg = 7; - boolean b = true; - boolean bb = false; - if (b) - if (!bb) - b = false; - testMethod4(arg); // DECLARATION OF VARIABLE 'arg' SHOULD BE HERE (distance = 2) - } - - public void testMethod6() { - int blockNumWithSimilarVar = 3; - int dist = 0; - int index = 0; - int block = 0; - - if (blockNumWithSimilarVar <= 1) { - do { - dist++; - if (block > 4) { - break; - } - index++; - block++; - } while (index < 7); - } else { - while (index < 8) { - dist += block; - index++; - block++; - } - } - } - - public boolean testMethod7(int a) { - boolean res; - switch (a) { - case 1: - res = true; - break; - default: - res = false; - } - return res; - } - - public void testMethod8() { - int b = 0; - int c = 0; - int m = 0; - int n = 0; - { - c++; - b++; - } - { - n++; // DECLARATION OF VARIABLE 'n' SHOULD BE HERE (distance = 2) - m++; // DECLARATION OF VARIABLE 'm' SHOULD BE HERE (distance = 3) - b++; - } - } - - public void testMethod9() { - boolean result = false; - boolean b1 = true; - boolean b2 = false; - if (b1) { - if (!b2) { - result = true; - } - result = true; - } - } - - public boolean testMethod10() { - boolean result; - try { - result = true; - } catch (Exception e) { - result = false; - } finally { - result = false; - } - return result; - } - - public void testMethod11() { - int a = 0; - int b = 10; - boolean result; - try { - b--; - } catch (Exception e) { - b++; - result = false; // DECLARATION OF VARIABLE 'result' SHOULD BE HERE (distance = 2) - } finally { - a++; - } - } - - public void testMethod12() { - boolean result = false; - boolean b3 = true; - boolean b1 = true; - boolean b2 = false; - if (b1) { - if (b3) { - if (!b2) { - result = true; - } - result = true; - } - } - } - - public void testMethod13() { - int i = 9; - int j = 6; - int g = i + 8; - int k = j + 10; - } - - public void testMethod14() { - Session s = openSession(); - Transaction t = s.beginTransaction(); //warn - A a = new A(); - E d1 = new E(); - C1 c = new C1(); - E d2 = new E(); - a.setForward(d1); - d1.setReverse(a); - c.setForward(d2); // DECLARATION OF VARIABLE 'c' SHOULD BE HERE (distance = 3) - // DECLARATION OF VARIABLE 'd2' SHOULD BE HERE (distance = 3) - d2.setReverse(c); - Serializable aid = s.save(a); - Serializable d2id = s.save(d2); - t.commit(); // DECLARATION OF VARIABLE 't' SHOULD BE HERE (distance = 5) - s.close(); - } - - public boolean isCheckBoxEnabled(int path) { - String model = ""; - if (true) { - for (int index = 0; index < path; ++index) { - int nodeIndex = model.codePointAt(path); - if (model.contains("")) { - return false; - } - } - } else { - int nodeIndex = model.codePointAt(path); - if (model.contains("")) { - return false; - } - } - return true; - } - - public Object readObject(String in) throws Exception { - String startDay = new String(""); - String endDay = new String(""); - return new String(startDay + endDay); - } - - public int[] getSelectedIndices() { - int[] sel = new int[5]; - String model = ""; - int a = 0; - a++; - for (int index = 0; index < 5; ++index) { - sel[index] = Integer.parseInt(model.valueOf(a)); // DECLARATION OF VARIABLE 'sel' - // SHOULD BE HERE (distance = 2) - // DECLARATION OF VARIABLE 'model' - // SHOULD BE HERE (distance = 2) - } - return sel; - } - - public void testMethod15() { - String confDebug = ""; - if (!confDebug.equals("") && !confDebug.equals("null")) { - LogLog.warn("The \"" + "\" attribute is deprecated."); - LogLog.warn("Use the \"" + "\" attribute instead."); - LogLog.setInternalDebugging(confDebug, true); - } - - int i = 0; - int k = 7; - boolean b = false; - for (; i < k; i++) { - b = true; - k++; - } - - int sw; - switch (i) { - case 0: - k++; - sw = 0; // DECLARATION OF VARIABLE 'sw' SHOULD BE HERE (distance = 2) - break; - case 1: - b = false; - break; - default: - b = true; - } - - int wh = 0; - b = true; - do { - k--; - i++; - } while (wh > 0); // DECLARATION OF VARIABLE 'wh' SHOULD BE HERE (distance = 2) - - if (wh > 0) { - k++; - } else if (!b) { - i++; - } else { - i--; - } - } - - public void testMethod16() { - int wh = 1, i = 4, k = 0; - if (i > 0) { - k++; - } else if (wh > 0) { - i++; - } else { - i--; - } - } - - protected JMenuItem createSubMenuItem(LogLevel level) { - final JMenuItem result = new JMenuItem(level.toString()); - final LogLevel logLevel = level; - result.setMnemonic(level.toString().charAt(0)); - result.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - showLogLevelColorChangeDialog(result, logLevel); // DECLARATION OF VARIABLE 'logLevel' - // SHOULD BE HERE (distance = 2) - } - }); - - return result; - - } - - public static Color darker(Color color, double fraction) { - int red = (int) Math.round(color.getRed() * (1.0 - fraction)); - int green = (int) Math.round(color.getGreen() * (1.0 - fraction)); - int blue = (int) Math.round(color.getBlue() * (1.0 - fraction)); - - if (red < 0) { - red = 0; - } else if (red > 255) { - red = 255; - } - if (green < 0) { // DECLARATION OF VARIABLE 'green' SHOULD BE HERE (distance = 2) - green = 0; - } else if (green > 255) { - green = 255; - } - if (blue < 0) { // DECLARATION OF VARIABLE 'blue' SHOULD BE HERE (distance = 3) - // blue = 0; - } - - int alpha = color.getAlpha(); - - return new Color(red, green, blue, alpha); - } - - public void testFinal() { - AuthUpdateTask task = null; - final long intervalMs = 30 * 60000L; - Object authCheckUrl = null, authInfo = null; - task = new AuthUpdateTask(authCheckUrl, authInfo, new IAuthListener() { - @Override - public void authTokenChanged(String cookie, String token) { - fireAuthTokenChanged(cookie, token); - } - }); - - Timer timer = new Timer("Auth Guard", true); - timer.schedule(task, intervalMs / 2, intervalMs); // DECLARATION OF VARIABLE 'intervalMs' - // SHOULD BE HERE (distance = 2) - } - - public void testForCycle() { - int filterCount = 0; - for (int i = 0; i < 10; i++, filterCount++) { - int abc = 0; - System.identityHashCode(abc); - - for (int j = 0; j < 10; j++) { - abc = filterCount; - System.identityHashCode(abc); - } - } - } - - public void testIssue32_1() - { - Option srcDdlFile = OptionBuilder.create("f"); - Option logDdlFile = OptionBuilder.create("o"); - Option help = OptionBuilder.create("h"); - - Options options = new Options(); - options.something(); - options.something(); - options.something(); - options.something(); - options.addOption(srcDdlFile, logDdlFile, help); // distance=1 - } - - public void testIssue32_2() - { - int mm = Integer.parseInt("2"); - long timeNow = 0; - Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); - cal.setTimeInMillis(timeNow); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - cal.set(Calendar.HOUR_OF_DAY, mm); - cal.set(Calendar.MINUTE, mm); // distance=1 - } - - public void testIssue32_3(MyObject[] objects) { - Calendar cal = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); - for(int i=0; i=8 + int length2 = + new ClassWithChainedMethods("param1", "param2").getInstance().doNothing("nothing").length(); + // violation above ''new' has incorrect indentation level 4, expected .* 8.' + } - int length = new ClassWithChainedMethods("param1", //indent:4 exp:4 - "param2").getInstance() //indent:32 exp:>=8 - .doNothing("nothing") //indent:4 exp:>=8 warn - .length(); //indent:4 exp:>=8 warn + public String doNothing(String something, String... uselessParams) { + return something; + } - int length2 = //indent:4 exp:4 - new ClassWithChainedMethods("param1","param2") //indent:4 exp:>=8 warn - .getInstance() //indent:8 exp:8 - .doNothing("nothing") //indent:8 exp:8 - .length(); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 + public ClassWithChainedMethods getInstance(String... uselessParams) { + return this; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/ClassWithChainedMethodsCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/ClassWithChainedMethodsCorrect.java index 7f80141778c..330e7494b19 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/ClassWithChainedMethodsCorrect.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/ClassWithChainedMethodsCorrect.java @@ -1,36 +1,23 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -public class ClassWithChainedMethodsCorrect { //indent:0 exp:0 - public ClassWithChainedMethodsCorrect() { //indent:2 exp:2 +/** some javadoc. */ +public class ClassWithChainedMethodsCorrect { + /** some javadoc. */ + public ClassWithChainedMethodsCorrect() { - String someString = ""; //indent:4 exp:4 + String someString = ""; - String chained1 = //indent:4 exp:4 - doNothing( //indent:8 exp:8 - someString //indent:12 exp:12 - .concat("zyx" //indent:16 exp:16 - ) //indent:16 exp:16 - .concat("255, 254, 253" //indent:16 exp:16 - ) //indent:16 exp:16 - ); //indent:8 exp:8 + String chained1 = doNothing(someString.concat("zyx").concat("255, 254, 253")); - doNothing( //indent:4 exp:4 - someString //indent:8 exp:8 - .concat("zyx" //indent:12 exp:12 - ) //indent:12 exp:12 - .concat("255, 254, 253" //indent:12 exp:12 - ) //indent:12 exp:12 - ); //indent:4 exp:4 + doNothing(someString.concat("zyx").concat("255, 254, 253")); + } - } //indent:2 exp:2 + public static void main(String[] args) { + ClassWithChainedMethodsCorrect classWithChainedMethodsCorrect = + new ClassWithChainedMethodsCorrect(); + } - public String doNothing(String something) { //indent:2 exp:2 - return something; //indent:4 exp:4 - } //indent:2 exp:2 - - public static void main(String[] args) { //indent:2 exp:2 - ClassWithChainedMethodsCorrect classWithChainedMethodsCorrect = //indent:4 exp:4 - new ClassWithChainedMethodsCorrect(); //indent:8 exp:8 - } //indent:2 exp:2 - -} //indent:0 exp:0 + public String doNothing(String something) { + return something; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputFastMatcher.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputFastMatcher.java index 6d3e561ca62..778960f53ee 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputFastMatcher.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputFastMatcher.java @@ -1,42 +1,35 @@ package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -public class InputFastMatcher -{ - - public boolean matches(char c) - { - // OOOO Auto-generated method stub - return false; - } - - public String replaceFrom(CharSequence sequence, CharSequence replacement) - { - // OOOO Auto-generated method stub - return null; - } - - public String collapseFrom(CharSequence sequence, char replacement) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimFrom(CharSequence s) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimLeadingFrom(CharSequence sequence) - { - // OOOO Auto-generated method stub - return null; - } - - public String trimTrailingFrom(CharSequence sequence) - { - // OOOO Auto-generated method stub - return null; - } - +/** some javadoc. */ +public class InputFastMatcher { + + public boolean matches(char c) { + // OOOO Auto-generated method stub + return false; + } + + public String replaceFrom(CharSequence sequence, CharSequence replacement) { + // OOOO Auto-generated method stub + return null; + } + + public String collapseFrom(CharSequence sequence, char replacement) { + // OOOO Auto-generated method stub + return null; + } + + public String trimFrom(CharSequence s) { + // OOOO Auto-generated method stub + return null; + } + + public String trimLeadingFrom(CharSequence sequence) { + // OOOO Auto-generated method stub + return null; + } + + public String trimTrailingFrom(CharSequence sequence) { + // OOOO Auto-generated method stub + return null; + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrect.java index 7678724f416..38b46981e89 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrect.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrect.java @@ -1,114 +1,106 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 - -import java.util.Map; //indent:0 exp:0 -import java.util.ArrayList;//indent:0 exp:0 - -public abstract class InputIndentationCorrect { //indent:0 exp:0 - - static int i; //indent:2 exp:2 - - int[] c = {1, 2, 3, //indent:2 exp:2 - 4, 5, 6}; //indent:6 exp:6 - - int b; //indent:2 exp:2 - - static { //indent:2 exp:2 - i = 0; //indent:4 exp:4 - } //indent:2 exp:2 - - { //indent:2 exp:2 - b = 2; //indent:4 exp:4 - } //indent:2 exp:2 - - private static abstract class RangesMatcher { //indent:2 exp:2 - - private static final String ZEROES = "0\u0660\u06f0" //indent:4 exp:4 - + "\u0c66\u0ce6" //indent:8 exp:8 - + "\u1c40\u1c50"; //indent:8 exp:8 - - public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = //indent:4 exp:4 - new InputIndentationCorrect() { //indent:8 exp:8 - @Override public boolean matches(char c) { //indent:10 exp:10 - return Character.isLetterOrDigit(c); //indent:12 exp:12 - } //indent:10 exp:10 - }; //indent:8 exp:8 - - /** Matches no characters. */ //indent:4 exp:4 - public static final InputFastMatcher NONE = //indent:4 exp:4 - new InputFastMatcher() { //indent:12 exp:>=8 - @Override public boolean matches(char c) { //indent:14 exp:14 - return false; //indent:16 exp:16 - } //indent:14 exp:14 - - @Override public String replaceFrom(CharSequence seq, //indent:14 exp:14 - CharSequence repl) { //indent:50 exp:50 - checkNotNull(repl); //indent:16 exp:16 - return seq.toString(); //indent:16 exp:16 - } //indent:14 exp:14 - - private void checkNotNull(CharSequence replacement) {} //indent:14 exp:14 - - @Override public String collapseFrom(CharSequence sequence, //indent:14 exp:14 - char replacement) { //indent:18 exp:18 - return sequence.toString(); //indent:16 exp:16 - } //indent:14 exp:14 - - @Override //indent:14 exp:14 - public String trimTrailingFrom(CharSequence sequence) { //indent:14 exp:14 - return sequence.toString(); //indent:16 exp:16 - } //indent:14 exp:14 - }; //indent:12 exp:12 - } //indent:2 exp:2 - - public boolean matches(char c) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public void foo() { //indent:2 exp:2 - int i = 0; //indent:4 exp:4 - for (; i < 9; i++) { //indent:4 exp:4 - if (veryLongLongLongCondition() //indent:6 exp:6 - || veryLongLongLongCondition2()) { //indent:14 exp:>=10 - someFooMethod("longString", "veryLongString", //indent:8 exp:8 - "superVeryExtraLongString"); //indent:12 exp:12 - if (veryLongLongLongCondition()) { //indent:8 exp:8 - while (veryLongLongLongCondition2() //indent:10 exp:10 - && veryLongLongLongCondition2()) { //indent:16 exp:>=14 - try { //indent:12 exp:12 - doSmth(); //indent:14 exp:14 - } catch (Exception e) { //indent:12 exp:12 - throw new AssertionError(e); //indent:14 exp:14 - } //indent:12 exp:12 - } //indent:10 exp:10 - } //indent:8 exp:8 - } //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean veryLongLongLongCondition() { //indent:2 exp:2 - if (veryLongLongLongCondition2()) { //indent:4 exp:4 - return true; //indent:6 exp:6 - } //indent:4 exp:4 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public boolean veryLongLongLongCondition2() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - public void someFooMethod(String longString, //indent:2 exp:2 - String superLongString, String exraSuperLongString) {} //indent:6 exp:6 - - public void fooThrowMethod() //indent:2 exp:2 - throws Exception { //indent:10 exp:>=6 - /* Some code*/ //indent:6 exp:6 - } //indent:2 exp:2 - - public void doSmth() { //indent:2 exp:2 - for (int h //indent:4 exp:4 - : c) { //indent:10 exp:>=8 - someFooMethod("longString", "veryLongString", //indent:6 exp:6 - "superVeryExtraLongString"); //indent:10 exp:10 - } //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; + +/** some javadoc. */ +public abstract class InputIndentationCorrect { + + static int i; + + static { + i = 0; + } + + int[] pqr = { + 1, 2, 3, + 4, 5, 6 + }; + int abc; + + { + abc = 2; + } + + public boolean matches(char c) { + return false; + } + + /** some javadoc. */ + public void foo() { + int i = 0; + for (; i < 9; i++) { + if (veryLongLongLongCondition() || veryLongLongLongCondition2()) { + someFooMethod("longString", "veryLongString", "superVeryExtraLongString"); + if (veryLongLongLongCondition()) { + while (veryLongLongLongCondition2() && veryLongLongLongCondition2()) { + try { + doSmth(); + } catch (Exception e) { + throw new AssertionError(e); + } + } + } + } + } + } + + public boolean veryLongLongLongCondition() { + return veryLongLongLongCondition2(); + } + + public boolean veryLongLongLongCondition2() { + return false; + } + + public void someFooMethod( + String longString, String superLongString, String exraSuperLongString) {} + + public void fooThrowMethod() throws Exception { + /* Some code*/ + } + + /** some javadoc. */ + public void doSmth() { + for (int h : pqr) { + someFooMethod("longString", "veryLongString", "superVeryExtraLongString"); + } + } + + private abstract static class RangesMatcher { + + public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = + new InputIndentationCorrect() { + @Override + public boolean matches(char c) { + return Character.isLetterOrDigit(c); + } + }; + + /** Matches no characters. */ + public static final InputFastMatcher NONE = + new InputFastMatcher() { + @Override + public boolean matches(char c) { + return false; + } + + @Override + public String replaceFrom(CharSequence seq, CharSequence repl) { + checkNotNull(repl); + return seq.toString(); + } + + private void checkNotNull(CharSequence replacement) {} + + @Override + public String collapseFrom(CharSequence sequence, char replacement) { + return sequence.toString(); + } + + @Override + public String trimTrailingFrom(CharSequence sequence) { + return sequence.toString(); + } + }; + + private static final String ZEROES = "" + ""; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectAnnotationArrayInit.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectAnnotationArrayInit.java index a98fb5735e0..77d5d96cea1 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectAnnotationArrayInit.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectAnnotationArrayInit.java @@ -1,11 +1,13 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -public class InputIndentationCorrectAnnotationArrayInit { //indent:0 exp:0 - interface MyInterface { //indent:2 exp:2 - @interface AnAnnotation { String[] values(); } //indent:4 exp:4 - @AnAnnotation(values = { //indent:4 exp:4 - "Hello"//indent:6 exp:6 - }) //indent:4 exp:4 - void works(); //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 +/** some javadoc. */ +public class InputIndentationCorrectAnnotationArrayInit { + interface MyInterface { + @AnAnnotation(values = {"Hello"}) + void works(); + + @interface AnAnnotation { + String[] values(); + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectClass.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectClass.java index 29feca0409a..2b857d5000f 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectClass.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectClass.java @@ -1,50 +1,33 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -import java.util.Iterator; //indent:0 exp:0 +import java.util.Iterator; -public class InputIndentationCorrectClass //indent:0 exp:0 - implements Runnable, Cloneable { //indent:4 exp:4 +/** some javadoc. */ +public class InputIndentationCorrectClass implements Runnable, Cloneable { - class InnerClass implements //indent:2 exp:2 - Iterable, //indent:10 exp:>=6 - Cloneable { //indent:13 exp:>=6 - @Override //indent:4 exp:4 - public Iterator iterator() { //indent:4 exp:4 - return null; //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 + /** some javadoc. */ + @Override + public void run() { + SecondClassWithLongLongLongLongName anon = new SecondClassWithLongLongLongLongName() {}; - class InnerClass2 //indent:2 exp:2 - extends //indent:7 exp:>=6 - SecondClassReturnWithVeryVeryVeryLongName { //indent:10 exp:>=6 - public InnerClass2(String string) { //indent:4 exp:4 - super(); //indent:6 exp:6 - // OOOO Auto-generated constructor stub //indent:6 exp:6 - } //indent:4 exp:4 - } //indent:2 exp:2 + SecondClassWithLongLongLongLongName anon2 = new SecondClassWithLongLongLongLongName() {}; + } - @Override //indent:2 exp:2 - public void run() { //indent:2 exp:2 - SecondClassWithLongLongLongLongName anon = //indent:4 exp:4 - new SecondClassWithLongLongLongLongName() { //indent:10 exp:>=8 + class InnerClass implements Iterable, Cloneable { + @Override + public Iterator iterator() { + return null; + } + } - }; //indent:10 exp:10 + class InnerClass2 extends SecondClassReturnWithVeryVeryVeryLongName { + public InnerClass2(String string) { + super(); + // OOOO Auto-generated constructor stub + } + } - SecondClassWithLongLongLongLongName anon2 = new //indent:4 exp:4 - SecondClassWithLongLongLongLongName() { //indent:10 exp:>=8 + class SecondClassWithLongLongLongLongName extends InputIndentationCorrectClass {} - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassWithLongLongLongLongName //indent:0 exp:0 - extends //indent:4 exp:4 - InputIndentationCorrectClass{ //indent:9 exp:>=4 - -} //indent:0 exp:0 - -class SecondClassReturnWithVeryVeryVeryLongName //indent:0 exp:0 - extends //indent:4 exp:4 - InputIndentationCorrectClass{ //indent:9 exp:>=4 - -} //indent:0 exp:0 + class SecondClassReturnWithVeryVeryVeryLongName {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectFieldAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectFieldAndParameter.java index 77e8b4baa5c..7f8277f6bf4 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectFieldAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectFieldAndParameter.java @@ -1,127 +1,156 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 - -class InputIndentationCorrectFieldAndParameter { //indent:0 exp:0 - - boolean flag = conditionFirst("Loooooooooooooooooong", new //indent:2 exp:2 - SecondFieldLongName("Loooooooooooooooooog"). //indent:6 exp:6 - getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:6 exp:6 - new InnerClassFoo()); //indent:6 exp:6 - - boolean secondFlag = conditionSecond(10000000000.0, new //indent:2 exp:2 - SecondFieldLongName("Looooooooooooo" //indent:6 exp:6 - + "oooooooooooong").getString(new FooFieldClass(), //indent:6 exp:6 - new SecondFieldLongName("loooooooooong"). //indent:10 exp:10 - getInteger(new FooFieldClass(), "loooooooooooooong")), "loooooooooooong") //indent:6 exp:6 - || conditionThird(2048) || conditionFourth(new //indent:6 exp:6 - SecondFieldLongName("Looooooooooooooo" //indent:6 exp:6 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:6 exp:6 - conditionFifth(true, new SecondFieldLongName(getString(2048, "Looo" //indent:6 exp:6 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:6 exp:6 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:10 exp:10 - SecondFieldLongName(getString(100000, "Loooooong" //indent:10 exp:10 - + "Fooooooo><"))) || conditionNoArg() //indent:6 exp:6 - || conditionNoArg() || //indent:6 exp:6 - conditionNoArg() || conditionNoArg(); //indent:6 exp:6 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondFieldLongName instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - boolean flag = conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondFieldLongName("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooFieldClass(), "Loooooooooooooooooog"), //indent:12 exp:>=8 - new InnerClassFoo()); //indent:13 exp:>=8 - - boolean secondFlag = conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondFieldLongName("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooFieldClass(), //indent:11 exp:>=8 - new SecondFieldLongName("loooooooooong"). //indent:13 exp:13 - getInteger(new FooFieldClass(), "looooooooong")), "loooooooooooong") //indent:12 exp:>=8 - || conditionThird(2048) || conditionFourth(new //indent:13 exp:>=8 - SecondFieldLongName("Looooooooooooooo" //indent:16 exp:>=8 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:12 exp:>=8 - conditionFifth(true, new SecondFieldLongName(getString(2048, "Looo" //indent:11 exp:>=8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:15 exp:>=8 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:17 exp:>=17 - SecondFieldLongName(getString(100000, "Loooooong" //indent:17 exp:17 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=8 - || conditionNoArg() || //indent:10 exp:>=8 - conditionNoArg() || conditionNoArg(); //indent:10 exp:>=8 - - FooFieldClass anonymousClass = new FooFieldClass() { //indent:4 exp:4 - boolean secondFlag = conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondFieldLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooFieldClass(), //indent:12 exp:>=10 - new SecondFieldLongName("loooooooooong"). //indent:15 exp:>=10 - getInteger(new FooFieldClass(), "looooooong")), "loooooooooooong") //indent:13 exp:>=10 - || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=10 - SecondFieldLongName("Looooooooooooooo" //indent:17 exp:>=10 - + "ooooooooooooong").getBoolean(new FooFieldClass(), false)) || //indent:13 exp:>=10 - conditionFifth(true, new SecondFieldLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:16 exp:>=10 - new FooFieldClass(), true)) || conditionSixth(false, new //indent:18 exp:>=18 - SecondFieldLongName(getString(100000, "Loooooong" //indent:18 exp:>=18 - + "Fooooooo><"))) || conditionNoArg() //indent:17 exp:>=10 - || conditionNoArg() || //indent:11 exp:>=10 - conditionNoArg() || conditionNoArg(); //indent:11 exp:>=10 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondFieldLongName { //indent:0 exp:0 - - public SecondFieldLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooFieldClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooFieldClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooFieldClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondFieldLongName getInstance() { //indent:2 exp:2 - return new SecondFieldLongName("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooFieldClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; + +class InputIndentationCorrectFieldAndParameter { + + boolean flag = + conditionFirst( + "Loooooooooooooooooong", + new SecondFieldLongNam2("Loooooooooooooooooog") + .getInteger(new FooFieldClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + + boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + + String getString(int someInt, String someString) { + return "String"; + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondFieldLongNam2 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + boolean flag = + conditionFirst( + "Loooooooooooooooooong", + new SecondFieldLongNam2("Loooooooooooooooooog") + .getInteger(new FooFieldClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + + boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "looooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + + FooFieldClass anonymousClass = + new FooFieldClass() { + final boolean secondFlag = + conditionSecond( + 10000000000.0, + new SecondFieldLongNam2("Looooooooooooo" + "oooooooooooong") + .getString( + new FooFieldClass(), + new SecondFieldLongNam2("loooooooooong") + .getInteger(new FooFieldClass(), "looooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondFieldLongNam2("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooFieldClass(), false)) + || conditionFifth( + true, + new SecondFieldLongNam2( + getString( + 2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooFieldClass(), true)) + || conditionSixth( + false, new SecondFieldLongNam2(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + }; + } + + class SecondFieldLongNam2 { + + public SecondFieldLongNam2(String string) {} + + String getString(FooFieldClass instance, int integer) { + return "String"; + } + + int getInteger(FooFieldClass instance, String string) { + return -1; + } + + boolean getBoolean(FooFieldClass instance, boolean flag) { + return false; + } + + SecondFieldLongNam2 getInstance() { + return new SecondFieldLongNam2("VeryLoooooooooo" + "oongString"); + } + } + + class FooFieldClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectForAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectForAndParameter.java index 3862985816a..0ee89e58a0e 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectForAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectForAndParameter.java @@ -1,113 +1,126 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 - -import java.util.ArrayList; //indent:0 exp:0 -import java.util.HashMap; //indent:0 exp:0 -import java.util.Iterator; //indent:0 exp:0 -import java.util.List; //indent:0 exp:0 -import java.util.Map; //indent:0 exp:0 - -class InputIndentationCorrectForAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - for (int i = 1; i < 10; i ++) {} //indent:4 exp:4 - - for (int i = new SecondForLongName("Loooooooooooooooooooo" //indent:4 exp:4 - + "oong").getInteger(new FooForClass(), //indent:8 exp:8 - getString(1000000000, "Loooooooooooooooong")); i < 10; i++) {} //indent:10 exp:>=8 - - for (Map.Entry entry : new SecondForLongName("Loo" //indent:4 exp:4 - + "ooooooooooooooooooooong").getMap(new //indent:8 exp:8 - FooForClass(), 10000000, //indent:8 exp:8 - getString(10000, "Loooooooooo" //indent:8 exp:8 - + "ooooong")).entrySet()) {} //indent:8 exp:8 - - for (Map.Entry entry : new SecondForLongName("Loo" //indent:4 exp:4 - + "ooooooooooooooooooooong").getMap(new //indent:8 exp:8 - FooForClass(), 10000000, //indent:12 exp:>=8 - getString(10000, "Loooooooooo" //indent:10 exp:>=8 - + "ooooong")).entrySet()) {} //indent:15 exp:>=8 - - for (String string : new SecondForLongName(getString(1024 //indent:4 exp:4 - , "Looooooooooooooooooong")). //indent:8 exp:8 - getList(new FooForClass(), 1000, getString(1024, //indent:8 exp:8 - "Loooooooooooooooooooooooooooooooo" //indent:8 exp:8 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:8 exp:8 - + "oooooooooong"))) {} //indent:8 exp:8 - - for (String string : new SecondForLongName(getString(1024 //indent:4 exp:4 - , "Looooooooooooooooooong")). //indent:8 exp:8 - getList(new FooForClass(), 1000, getString(1024, //indent:12 exp:>=8 - "Loooooooooooooooooooooooooooooooo" //indent:14 exp:>=8 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:10 exp:>=8 - + "oooooooooong"))) {} //indent:13 exp:>=8 - - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - - for (int i = 1; i < 10; i ++) {} //indent:6 exp:6 - - for (int i = new SecondForLongName("Loooooooooooooooooooo" //indent:6 exp:6 - + "oong").getInteger(new FooForClass(), //indent:10 exp:10 - getString(1000000000, "Loooooooooooooooong")); i < 10; i++) {} //indent:12 exp:>=10 - - for (Map.Entry entry : new SecondForLongName("Loo" //indent:6 exp:6 - + "ooooooooooooooooooooong").getMap(new //indent:10 exp:10 - FooForClass(), 10000000, //indent:10 exp:10 - getString(10000, "Loooooooooo" //indent:10 exp:10 - + "ooooong")).entrySet()) {} //indent:10 exp:10 - - for (Map.Entry entry : new SecondForLongName("Loo" //indent:6 exp:6 - + "ooooooooooooooooooooong").getMap(new //indent:12 exp:>=10 - FooForClass(), 10000000, //indent:13 exp:>=10 - getString(10000, "Loooooooooo" //indent:18 exp:>=10 - + "ooooong")).entrySet()) {} //indent:15 exp:>=10 - - for (String string : new SecondForLongName(getString(1024 //indent:6 exp:6 - , "Looooooooooooooooooong")). //indent:10 exp:10 - getList(new FooForClass(), 1000, getString(1024, //indent:10 exp:10 - "Loooooooooooooooooooooooooooooooo" //indent:10 exp:10 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:10 exp:10 - + "oooooooooong"))) {} //indent:10 exp:10 - - for (String string : new SecondForLongName(getString(1024 //indent:6 exp:6 - , "Looooooooooooooooooong")). //indent:15 exp:>=10 - getList(new FooForClass(), 1000, getString(1024, //indent:13 exp:>=10 - "Loooooooooooooooooooooooooooooooo" //indent:19 exp:>=10 - + "oooooooooooooooooooooooooooooooooooooooo" //indent:21 exp:>=10 - + "oooooooooong"))) {} //indent:10 exp:10 - } //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondForLongName //indent:0 exp:0 - implements Iterable{ //indent:8 exp:>=4 - - public SecondForLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - int getInteger(FooForClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - Map getMap(FooForClass instance, int integer, String string) { //indent:2 exp:2 - return new HashMap(); //indent:4 exp:4 - } //indent:2 exp:2 - - List getList(FooForClass instance, long longLong, String string) { //indent:2 exp:2 - return new ArrayList(); //indent:4 exp:4 - } //indent:2 exp:2 - - public Iterator iterator() { //indent:2 exp:2 - return null; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooForClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +class InputIndentationCorrectForAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + for (int i = 1; i < 10; i++) {} + + for (int i = + new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong") + .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong")); + i < 10; + i++) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + } + + class InnerClassFoo { + + void fooMethodWithIf() { + + for (int i = 1; i < 10; i++) {} + + for (int i = + new SecondForClassWithLongName1("Loooooooooooooooooooo" + "oong") + .getInteger(new FooForClass(), getString(1000000000, "Loooooooooooooooong")); + i < 10; + i++) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (Map.Entry entry : + new SecondForClassWithLongName1("Loo" + "ooooooooooooooooooooong") + .getMap(new FooForClass(), 10000000, getString(10000, "Loooooooooo" + "ooooong")) + .entrySet()) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + + for (String string : + new SecondForClassWithLongName1(getString(1024, "Looooooooooooooooooong")) + .getList( + new FooForClass(), + 1000, + getString( + 1024, + "Loooooooooooooooooooooooooooooooo" + + "oooooooooooooooooooooooooooooooooooooooo" + + "oooooooooong"))) {} + } + } + + class SecondForClassWithLongName1 implements Iterable { + + public SecondForClassWithLongName1(String string) {} + + int getInteger(FooForClass instance, String string) { + return -1; + } + + Map getMap(FooForClass instance, int integer, String string) { + return new HashMap(); + } + + List getList(FooForClass instance, long longLong, String string) { + return new ArrayList(); + } + + public Iterator iterator() { + return null; + } + } + + class FooForClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectIfAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectIfAndParameter.java index 55612552a22..58f38a4a51e 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectIfAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectIfAndParameter.java @@ -1,144 +1,180 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 - -class InputIndentationCorrectIfAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - if (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondClassLongNam6("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:8 exp:8 - new InnerClassFoo())) {} //indent:8 exp:8 - - if (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongNam6("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooIfClass(), //indent:8 exp:8 - new SecondClassLongNam6("loooooooooong"). //indent:10 exp:10 - getInteger(new FooIfClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongNam6("Looooooooooooooo" //indent:8 exp:8 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongNam6(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooIfClass(), true)) || conditionSixth(false, new //indent:10 exp:10 - SecondClassLongNam6(getString(100000, "Loooooong" //indent:10 exp:10 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:8 exp:8 - conditionNoArg() || conditionNoArg()) {} //indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondClassLongNam6 instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - if (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondClassLongNam6("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())) {} //indent:14 exp:>=10 - - if (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondClassLongNam6("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooIfClass(), //indent:10 exp:10 - new SecondClassLongNam6("loooooooooong"). //indent:12 exp:12 - getInteger(new FooIfClass(), "loooooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondClassLongNam6("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondClassLongNam6(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooIfClass(), true)) || conditionSixth(false, new //indent:14 exp:14,16 - SecondClassLongNam6(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooIfClass anonymousClass = new FooIfClass() { //indent:4 exp:4 - - void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - if (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondClassLongNam6("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooIfClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())) {} //indent:19 exp:>=12 - - if (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondClassLongNam6("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooIfClass(), //indent:12 exp:12 - new SecondClassLongNam6("loooooooooong"). //indent:14 exp:14 - getInteger(new FooIfClass(), "looooooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondClassLongNam6("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooIfClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondClassLongNam6(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooIfClass(), true)) || conditionSixth(false, new //indent:16 exp:>=16 - SecondClassLongNam6(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassLongNam6 { //indent:0 exp:0 - - public SecondClassLongNam6(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooIfClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooIfClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooIfClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongNam6 getInstance() { //indent:2 exp:2 - return new SecondClassLongNam6("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooIfClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; + +class InputIndentationCorrectIfAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) { + /* foo */ + } + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondClassLongNam3 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooIfClass anonymousClass = + new FooIfClass() { + + void fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "looooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName) { + /* foo */ + } + } + }; + + void fooMethodWithIf() { + if (conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam3("Loooooooooooooooooog") + .getInteger(new FooIfClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) { + /* foo */ + } + + if (conditionSecond( + 10000000000.0, + new SecondClassLongNam3("Looooooooooooo" + "oooooooooooong") + .getString( + new FooIfClass(), + new SecondClassLongNam3("loooooooooong") + .getInteger(new FooIfClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam3("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooIfClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam3( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooIfClass(), true)) + || conditionSixth( + false, new SecondClassLongNam3(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) { + /* foo */ + } + } + } + + class SecondClassLongNam3 { + + public SecondClassLongNam3(String string) {} + + String getString(FooIfClass instance, int integer) { + return "String"; + } + + int getInteger(FooIfClass instance, String string) { + return -1; + } + + boolean getBoolean(FooIfClass instance, boolean flag) { + return false; + } + + SecondClassLongNam3 getInstance() { + return new SecondClassLongNam3("VeryLoooooooooo" + "oongString"); + } + } + + class FooIfClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectNewChildren.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectNewChildren.java index 3e4e34b5ced..b83ac1353ec 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectNewChildren.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectNewChildren.java @@ -1,25 +1,26 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; -public class InputIndentationCorrectNewChildren { //indent:0 exp:0 +/** some javadoc. */ +public class InputIndentationCorrectNewChildren { - private final StringBuffer mFilter = //indent:2 exp:2 - new StringBuffer( //indent:6 exp:6 - new CharSequence() { //indent:10 exp:10 - @Override //indent:12 exp:12 - public char charAt(int index) { //indent:12 exp:12 - return 'A'; //indent:14 exp:14 - } //indent:12 exp:12 + private final StringBuffer filter = + new StringBuffer( + new CharSequence() { + @Override + public char charAt(int index) { + return 'A'; + } - public int length() { //indent:12 exp:12 - return 1; //indent:14 exp:14 - } //indent:12 exp:12 + public int length() { + return 1; + } - public CharSequence subSequence(int start, int end) { //indent:12 exp:12 - return this; //indent:14 exp:14 - } //indent:12 exp:12 + public CharSequence subSequence(int start, int end) { + return this; + } - public String toString() { //indent:12 exp:12 - return "Foo"; //indent:14 exp:14 - } //indent:12 exp:12 - }); //indent:10 exp:10 -} //indent:0 exp:0 + public String toString() { + return "Foo"; + } + }); +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectReturnAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectReturnAndParameter.java index 8fdeb6ca72e..6fa0484efee 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectReturnAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectReturnAndParameter.java @@ -1,143 +1,166 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 - -class InputIndentationCorrectReturnAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean fooMethodWithIf() { //indent:2 exp:2 - - return conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondClassLongName("Looooooooooooo" //indent:8 exp:8 - + "oooooooooooong").getString(new FooReturnClass(), //indent:8 exp:8 - new SecondClassLongName("loooooooooong"). //indent:10 exp:10 - getInteger(new FooReturnClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondClassLongName("Looooooooooooooo" //indent:8 exp:8 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondClassLongName(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:10 exp:10 - SecondClassLongName(getString(100000, "Loooooong" //indent:10 exp:10 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:8 exp:8 - conditionNoArg() || conditionNoArg();//indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondClassLongName instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - boolean fooMethodWithIf() { //indent:4 exp:4 - return conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondClassLongName("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooReturnClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo()); //indent:14 exp:>=10 - } //indent:4 exp:4 - - boolean fooReturn() { //indent:4 exp:4 - return conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondClassLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooReturnClass(), //indent:10 exp:10 - new SecondClassLongName("loooooooooong"). //indent:12 exp:12 - getInteger(new FooReturnClass(), "looooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondClassLongName("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondClassLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:14 exp:>=14 - SecondClassLongName(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg(); //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooReturnClass anonymousClass = new FooReturnClass() { //indent:4 exp:4 - - boolean fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - return conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondClassLongName("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooReturnClass(), //indent:12 exp:12 - new SecondClassLongName("loooooooooong"). //indent:14 exp:14 - getInteger(new FooReturnClass(), "looooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondClassLongName("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooReturnClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondClassLongName(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooReturnClass(), true)) || conditionSixth(false, new //indent:16 exp:>=16 - SecondClassLongName(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName; //indent:21 exp:>=12 - } //indent:6 exp:6 - - boolean fooReturn() { //indent:6 exp:6 - return conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondClassLongName("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooReturnClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo()); //indent:19 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondClassLongName { //indent:0 exp:0 - - public SecondClassLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooReturnClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooReturnClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooReturnClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondClassLongName getInstance() { //indent:2 exp:2 - return new SecondClassLongName("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooReturnClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; + +class InputIndentationCorrectReturnAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + boolean fooMethodWithIf() { + + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondClassLongNam4 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooReturnClass anonymousClass = + new FooReturnClass() { + + boolean fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "looooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName; + } + + boolean fooReturn() { + return conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam4("Loooooooooooooooooog") + .getInteger(new FooReturnClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + } + }; + + boolean fooMethodWithIf() { + return conditionFirst( + "Loooooooooooooooooong", + new SecondClassLongNam4("Loooooooooooooooooog") + .getInteger(new FooReturnClass(), "Loooooooooooooooooog"), + new InnerClassFoo()); + } + + boolean fooReturn() { + return conditionSecond( + 10000000000.0, + new SecondClassLongNam4("Looooooooooooo" + "oooooooooooong") + .getString( + new FooReturnClass(), + new SecondClassLongNam4("loooooooooong") + .getInteger(new FooReturnClass(), "looooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondClassLongNam4("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooReturnClass(), false)) + || conditionFifth( + true, + new SecondClassLongNam4( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooReturnClass(), true)) + || conditionSixth( + false, new SecondClassLongNam4(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg(); + } + } + + class SecondClassLongNam4 { + + public SecondClassLongNam4(String string) {} + + String getString(FooReturnClass instance, int integer) { + return "String"; + } + + int getInteger(FooReturnClass instance, String string) { + return -1; + } + + boolean getBoolean(FooReturnClass instance, boolean flag) { + return false; + } + + SecondClassLongNam4 getInstance() { + return new SecondClassLongNam4("VeryLoooooooooo" + "oongString"); + } + } + + class FooReturnClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectWhileDoWhileAndParameter.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectWhileDoWhileAndParameter.java index cf99c6c32cc..85efa0f215e 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectWhileDoWhileAndParameter.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4841indentation/InputIndentationCorrectWhileDoWhileAndParameter.java @@ -1,221 +1,270 @@ -package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //indent:0 exp:0 - -class InputIndentationCorrectWhileDoWhileAndParameter { //indent:0 exp:0 - - String getString(int someInt, String someString) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - void fooMethodWithIf() { //indent:2 exp:2 - - while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondWhileLongName("Loooooooooooooooooog"). //indent:8 exp:8 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:11 exp:>=8 - new InnerClassFoo())) {} //indent:10 exp:>=8 - - do { //indent:4 exp:4 - - } while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4 - SecondWhileLongName("Loooooooooooooooooog"). //indent:9 exp:>=8 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:15 exp:>=8 - new InnerClassFoo())); //indent:9 exp:>=8 - - while (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondWhileLongName("Looooooooooooo" //indent:9 exp:>=8 - + "oooooooooooong").getString(new FooWhileClass(), //indent:8 exp:8 - new SecondWhileLongName("loooooooooong"). //indent:11 exp:>=8 - getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8 - || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=8 - SecondWhileLongName("Looooooooooooooo" //indent:14 exp:>=8 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondWhileLongName( //indent:12 exp:>=8 - getString(2048, "Looo" //indent:12 exp:>=8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:10 exp:10 - SecondWhileLongName(getString(100000, "Loooooong" //indent:11 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:10 exp:>=8 - conditionNoArg() || conditionNoArg()) {} //indent:10 exp:10 - - do { //indent:4 exp:4 - - } while (conditionSecond(10000000000.0, new //indent:4 exp:4 - SecondWhileLongName("Looooooooooooo" //indent:10 exp:>=8 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:>=8 - new SecondWhileLongName("loooooooooong"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "loooooooong")), "loooooooooooong") //indent:13 exp:>=8 - || conditionThird(2048) || conditionFourth(new //indent:8 exp:8 - SecondWhileLongName("Looooooooooooooo" //indent:11 exp:>=8 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Looo" //indent:8 exp:8 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:12 - SecondWhileLongName(getString(100000, "Loooooong" //indent:12 exp:12 - + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8 - || conditionNoArg() || //indent:13 exp:>=8 - conditionNoArg() || conditionNoArg()); //indent:8 exp:8 - } //indent:2 exp:2 - - private boolean conditionFirst(String longString, int //indent:2 exp:2 - integer, InnerClassFoo someInstance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2 - String longLongLongString, String secondLongLongString) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionThird(long veryLongValue) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFourth(boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionSixth(boolean flag, //indent:2 exp:2 - SecondWhileLongName instance) { //indent:6 exp:6 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - private boolean conditionNoArg() { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - class InnerClassFoo { //indent:2 exp:2 - - void fooMethodWithIf() { //indent:4 exp:4 - while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondWhileLongName("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())) {} //indent:14 exp:>=10 - - do { //indent:6 exp:6 - /* Do something*/ //indent:8 exp:8 - } while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6 - SecondWhileLongName("Loooooooooooooooooog"). //indent:10 exp:10 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10 - new InnerClassFoo())); //indent:14 exp:>=10 - - while (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondWhileLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10 - new SecondWhileLongName("loooooooooong"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "loooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondWhileLongName("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=14 - SecondWhileLongName(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10 - - do { //indent:6 exp:6 - /* Do smth*/ //indent:8 exp:8 - } while (conditionSecond(10000000000.0, new //indent:6 exp:6 - SecondWhileLongName("Looooooooooooo" //indent:10 exp:10 - + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10 - new SecondWhileLongName("loooooooooong"). //indent:12 exp:12,14 - getInteger(new FooWhileClass(), "loooooooooooong")), "loooooooooooong") //indent:10 exp:10 - || conditionThird(2048) || conditionFourth(new //indent:10 exp:10 - SecondWhileLongName("Looooooooooooooo" //indent:10 exp:10 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Looo" //indent:12 exp:>=10 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=14 - SecondWhileLongName(getString(100000, "Loooooong" //indent:14 exp:>=10 - + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10 - || conditionNoArg() || //indent:14 exp:>=10 - conditionNoArg() || conditionNoArg()); //indent:14 exp:>=10 - } //indent:4 exp:4 - - FooWhileClass anonymousClass = new FooWhileClass() { //indent:4 exp:4 - - void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6 - int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10 - fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10 - - while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondWhileLongName("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())) {} //indent:19 exp:>=12 - - do { //indent:8 exp:8 - /* Do smth*/ //indent:10 exp:10 - } while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8 - SecondWhileLongName("Loooooooooooooooooog"). //indent:12 exp:12 - getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12 - new InnerClassFoo())); //indent:19 exp:>=12 - - while (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondWhileLongName("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12 - new SecondWhileLongName("loooooooooong"). //indent:14 exp:14 - getInteger(new FooWhileClass(), "loooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondWhileLongName("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:16 exp:16,18 - SecondWhileLongName(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12 - - do { //indent:8 exp:8 - /* Do smth*/ //indent:10 exp:10 - } while (conditionSecond(10000000000.0, new //indent:8 exp:8 - SecondWhileLongName("Looooooooooooo" //indent:12 exp:12 - + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12 - new SecondWhileLongName("loooooooooong"). //indent:14 exp:14 - getInteger(new FooWhileClass(), "loooooooooong")), "loooooooooooong") //indent:12 exp:12 - || conditionThird(2048) || conditionFourth(new //indent:12 exp:12 - SecondWhileLongName("Looooooooooooooo" //indent:12 exp:12 - + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12 - conditionFifth(true, new SecondWhileLongName(getString(2048, "Lo" //indent:14 exp:>=12 - + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12 - new FooWhileClass(), true)) || conditionSixth(false, new //indent:16 exp:>=16 - SecondWhileLongName(getString(100000, "Loooooong" //indent:16 exp:>=12 - + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12 - || conditionNoArg() || //indent:16 exp:>=12 - conditionNoArg() || conditionNoArg() //indent:18 exp:>=12 - && fooooooooobooleanBooleanVeryLongName);//indent:21 exp:>=12 - } //indent:6 exp:6 - }; //indent:4 exp:4 - } //indent:2 exp:2 -} //indent:0 exp:0 - -class SecondWhileLongName { //indent:0 exp:0 - - public SecondWhileLongName(String string) { //indent:2 exp:2 - - } //indent:2 exp:2 - - String getString(FooWhileClass instance, int integer) { //indent:2 exp:2 - return "String"; //indent:4 exp:4 - } //indent:2 exp:2 - - int getInteger(FooWhileClass instance, String string) { //indent:2 exp:2 - return -1; //indent:4 exp:4 - } //indent:2 exp:2 - - boolean getBoolean(FooWhileClass instance, boolean flag) { //indent:2 exp:2 - return false; //indent:4 exp:4 - } //indent:2 exp:2 - - SecondWhileLongName getInstance() { //indent:2 exp:2 - return new SecondWhileLongName("VeryLoooooooooo" //indent:4 exp:4 - + "oongString"); //indent:8 exp:8 - } //indent:2 exp:2 -} //indent:0 exp:0 -class FooWhileClass {} //indent:0 exp:0 +package com.google.checkstyle.test.chapter4formatting.rule4841indentation; + +class InputIndentationCorrectWhileDoWhileAndParameter { + + String getString(int someInt, String someString) { + return "String"; + } + + void fooMethodWithIf() { + + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do {} while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) {} + + do {} while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()); + } + + private boolean conditionFirst(String longString, int integer, InnerClassFoo someInstance) { + return false; + } + + private boolean conditionSecond( + double longLongLongDoubleValue, String longLongLongString, String secondLongLongString) { + return false; + } + + private boolean conditionThird(long veryLongValue) { + return false; + } + + private boolean conditionFourth(boolean flag) { + return false; + } + + private boolean conditionFifth(boolean flag1, boolean flag2) { + return false; + } + + private boolean conditionSixth(boolean flag, SecondWhileLongNam1 instance) { + return false; + } + + private boolean conditionNoArg() { + return false; + } + + class InnerClassFoo { + + FooWhileClass anonymousClass = + new FooWhileClass() { + + void fooMethodWithIf( + String stringStringStringStringLooooongString, + int intIntIntVeryLongNameForIntVariable, + boolean fooooooooobooleanBooleanVeryLongName) { + + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do { + /* Do smth*/ + + } while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName) {} + + do { + /* Do smth*/ + + } while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Lo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() && fooooooooobooleanBooleanVeryLongName); + } + }; + + void fooMethodWithIf() { + while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())) {} + + do { + /* Do something*/ + + } while (conditionFirst( + "Loooooooooooooooooong", + new SecondWhileLongNam1("Loooooooooooooooooog") + .getInteger(new FooWhileClass(), "Loooooooooooooooooog"), + new InnerClassFoo())); + + while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()) {} + + do { + /* Do smth*/ + + } while (conditionSecond( + 10000000000.0, + new SecondWhileLongNam1("Looooooooooooo" + "oooooooooooong") + .getString( + new FooWhileClass(), + new SecondWhileLongNam1("loooooooooong") + .getInteger(new FooWhileClass(), "loooooooooooong")), + "loooooooooooong") + || conditionThird(2048) + || conditionFourth( + new SecondWhileLongNam1("Looooooooooooooo" + "ooooooooooooong") + .getBoolean(new FooWhileClass(), false)) + || conditionFifth( + true, + new SecondWhileLongNam1( + getString(2048, "Looo" + "ooooooooooooooooooooooooooooooooooooooooooong")) + .getBoolean(new FooWhileClass(), true)) + || conditionSixth( + false, new SecondWhileLongNam1(getString(100000, "Loooooong" + "Fooooooo><"))) + || conditionNoArg() + || conditionNoArg() + || conditionNoArg() + || conditionNoArg()); + } + } + + class SecondWhileLongNam1 { + + public SecondWhileLongNam1(String string) {} + + String getString(FooWhileClass instance, int integer) { + return "String"; + } + + int getInteger(FooWhileClass instance, String string) { + return -1; + } + + boolean getBoolean(FooWhileClass instance, boolean flag) { + return false; + } + + SecondWhileLongNam1 getInstance() { + return new SecondWhileLongNam1("VeryLoooooooooo" + "oongString"); + } + } + + class FooWhileClass {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java index a09fab430d7..085a79ce71a 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4842fallthrough/InputFallThrough.java @@ -1,453 +1,474 @@ package com.google.checkstyle.test.chapter4formatting.rule4842fallthrough; -public class InputFallThrough -{ - void method(int i, int j, boolean cond) { - while (true) { - switch (i) { - case 0: // no problem +/** Some javadoc. */ +public class InputFallThrough { + void method(int i, int j, boolean cond) { + while (true) { + switch (i) { + case 0: // no problem + case 1: + i++; + break; + case 2: + i++; + case 3: // violation 'Fall through from previous branch of the switch statement.' + i++; + break; + case 4: + return; + case 5: + throw new RuntimeException(""); + case 6: + continue; + case 7: + { // violation 'should be on the previous line' + break; + } + case 8: + { // violation 'should be on the previous line' + return; + } + case 9: + { // violation 'should be on the previous line' + throw new RuntimeException(""); + } + case 10: + { // violation 'should be on the previous line' + continue; + } + case 11: + { // violation 'should be on the previous line' + i++; + } + case 12: // violation 'Fall through from previous branch of the switch statement.' + if (false) { + break; + } else { + break; + } + case 13: + if (true) { + return; + } + case 14: // violation 'Fall through from previous branch of the switch statement.' + if (true) { + return; + } else { + // do nothing + } + case 15: // violation 'Fall through from previous branch of the switch statement.' + do { + System.identityHashCode("something"); + return; + } while (true); + case 16: + for (int j1 = 0; j1 < 10; j1++) { + System.identityHashCode("something"); + return; + } + case 17: + while (true) { + throw new RuntimeException(""); + } + case 18: + while (cond) { + break; + } + case 19: // violation 'Fall through from previous branch of the switch statement.' + try { + i++; + break; + } catch (RuntimeException e) { + break; + } catch (Error e) { + return; + } + case 20: + try { + i++; + break; + } catch (RuntimeException e) { + // do nothing + } catch (Error e) { + return; + } + case 21: // violation 'Fall through from previous branch of the switch statement.' + try { + i++; + } catch (RuntimeException e) { + i--; + } finally { + break; + } + case 22: + try { + i++; + break; + } catch (RuntimeException e) { + i--; + break; + } finally { + i++; + } + case 23: + switch (j) { case 1: - i++; - break; + continue; case 2: - i++; - case 3: //warn - i++; - break; - case 4: - return; - case 5: - throw new RuntimeException(""); - case 6: - continue; - case 7: { - break; - } - case 8: { - return; - } - case 9: { - throw new RuntimeException(""); - } - case 10: { - continue; - } - case 11: { - i++; - } - case 12: //warn - if (false) - break; - else - break; - case 13: - if (true) { - return; - } - case 14: //warn - if (true) { - return; - } else { - //do nothing - } - case 15: //warn - do { - System.identityHashCode("something"); - return; - } while(true); - case 16: - for (int j1 = 0; j1 < 10; j1++) { - System.identityHashCode("something"); - return; - } - case 17: - while (true) - throw new RuntimeException(""); - case 18: - while(cond) { - break; - } - case 19: //warn - try { - i++; - break; - } catch (RuntimeException e) { - break; - } catch (Error e) { - return; - } - case 20: - try { - i++; - break; - } catch (RuntimeException e) { - } catch (Error e) { - return; - } - case 21: //warn - try { - i++; - } catch (RuntimeException e) { - i--; - } finally { - break; - } - case 22: - try { - i++; - break; - } catch (RuntimeException e) { - i--; - break; - } finally { - i++; - } - case 23: - switch (j) { - case 1: - continue; - case 2: - return; - default: - return; - } - case 24: - switch (j) { - case 1: - continue; - case 2: - break; - default: - return; - } - default: //warn - // this is the last label - i++; - } - } - } - - - - /* Like above, but all fall throughs with relief comment */ - void methodFallThru(int i, int j, boolean cond) { - while (true) { - switch (i) { - case -1: // FALLTHRU - - case 0: // no problem - case 1: - i++; - break; - case 2: - i++; - // fallthru - case 3: - i++; - break; - case 4: return; - case 5: - throw new RuntimeException(""); - case 6: + default: + return; + } + case 24: + switch (j) { + case 1: continue; - case 7: { + case 2: break; - } - case 8: { + default: return; } - case 9: { - throw new RuntimeException(""); + default: // violation 'Fall through from previous branch of the switch statement.' + // this is the last label + i++; + } + } + } + + /* Like above, but all fall throughs with relief comment */ + void methodFallThru(int i, int j, boolean cond) { + while (true) { + switch (i) { + case -1: // FALLTHRU + + case 0: // no problem + case 1: + i++; + break; + case 2: + i++; + // fallthru + case 3: + i++; + break; + case 4: + return; + case 5: + throw new RuntimeException(""); + case 6: + continue; + case 7: + { // violation 'should be on the previous line' + break; } - case 10: { - continue; + case 8: + { // violation 'should be on the previous line' + return; } - case 11: { - i++; + case 9: + { // violation 'should be on the previous line' + throw new RuntimeException(""); + } + case 10: + { // violation 'should be on the previous line' + continue; + } + case 11: + { // violation 'should be on the previous line' + i++; } // fallthru - case 12: - if (false) - break; - else - break; - case 13: - if (true) { - return; - } - case 14: //warn - if (true) { - return; - } else { - //do nothing - } - // fallthru - case 15: - do { - System.identityHashCode("something"); - return; - } while(true); - case 16: - for (int j1 = 0; j1 < 10; j1++) { - System.identityHashCode("something"); - return; - } - case 17: - while (cond) - throw new RuntimeException(""); - case 18: - while(cond) { - break; - } - // fallthru - case 19: - try { - i++; - break; - } catch (RuntimeException e) { - break; - } catch (Error e) { - return; - } - case 20: - try { - i++; - break; - } catch (RuntimeException e) { - } catch (Error e) { - return; - } - // fallthru - case 21: - try { - i++; - } catch (RuntimeException e) { - i--; - } finally { - break; - } - case 22: - try { - i++; - break; - } catch (RuntimeException e) { - i--; - break; - } finally { - i++; - } - /* fallthru */ - case 23: - switch (j) { - case 1: - continue; - case 2: - return; - default: - return; - } - case 24: - i++; - /* fallthru */ case 25: - i++; - break; + case 12: + if (false) { + break; + } else { + break; + } + case 13: + if (true) { + return; + } + case 14: // violation 'Fall through from previous branch of the switch statement.' + if (true) { + return; + } else { + // do nothing + } + // fallthru + case 15: + do { + System.identityHashCode("something"); + return; + } while (true); + case 16: + for (int j1 = 0; j1 < 10; j1++) { + System.identityHashCode("something"); + return; + } + case 17: + while (cond) { + throw new RuntimeException(""); + } + case 18: + while (cond) { + break; + } + // fallthru + case 19: + try { + i++; + break; + } catch (RuntimeException e) { + break; + } catch (Error e) { + return; + } + case 20: + try { + i++; + break; + } catch (RuntimeException e) { + return; + } catch (Error e) { + return; + } + // fallthru + case 21: + try { + i++; + } catch (RuntimeException e) { + i--; + } finally { + break; + } + case 22: + try { + i++; + break; + } catch (RuntimeException e) { + i--; + break; + } finally { + i++; + } + /* fallthru */ + case 23: + switch (j) { + case 1: + continue; + case 2: + return; + default: + return; + } + case 24: + i++; + /* fallthru */ case 25: + i++; + break; - case 26: - switch (j) { - case 1: - continue; - case 2: - break; - default: - return; - } - // fallthru - default: - // this is the last label - i++; + case 26: + switch (j) { + case 1: + continue; + case 2: + break; + default: + return; + } + // fallthru + default: + // this is the last label + i++; // fallthru - } } - } + } + } - /* Test relief comment. */ - void methodFallThruCC(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; // fallthru + /* Test relief comment. */ + void methodFallThruCc(int i, int j, boolean cond) { + while (true) { + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; // fallthru - case 1: - i++; + case 1: + i++; // fallthru - case 2: { - i++; + case 2: + { // violation 'should be on the previous line' + i++; } // fallthru - case 3: - i++; - /* fallthru */case 4: - break; - case 5: - i++; + case 3: + i++; + /* fallthru */ case 4: + break; + case 5: + i++; // fallthru - } } - } + } + } - /* Like above, but C-style comments. */ - void methodFallThruC(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; /* fallthru */ + /* Like above, but C-style comments. */ + void methodFallThruC(int i, int j, boolean cond) { + while (true) { + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; /* fallthru */ - case 1: - i++; + case 1: + i++; /* fallthru */ - case 2: - i++; - /* fallthru */case 3: - break; - case 4: - i++; + case 2: + i++; + /* fallthru */ case 3: + break; + case 4: + i++; /* fallthru */ - } } - } + } + } - /* Like above, but C-style comments with no spaces. */ - void methodFallThruC2(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; /*fallthru*/ + /* Like above, but C-style comments with no spaces. */ + void methodFallThruC2(int i, int j, boolean cond) { + while (true) { + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; /*fallthru*/ - case 1: - i++; + case 1: + i++; /*fallthru*/ - case 2: - i++; - /*fallthru*/case 3: - break; - case 4: - i++; + case 2: + i++; + // violation below 'incorrect indentation level' + /*fallthru*/ case 3: + break; + case 4: + i++; /*fallthru*/ - } } - } + } + } - /* C-style comments with other default fallthru-comment. */ - void methodFallThruCOtherWords(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; /* falls through */ + /* C-style comments with other default fallthru-comment. */ + void methodFallThruOtherWords(int i, int j, boolean cond) { + while (true) { + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; /* falls through */ - case 1: - i++; + case 1: + i++; /* falls through */ - case 2: - i++; - /* falls through */case 3: - break; - case 4: - i++; + case 2: + i++; + // violation below 'incorrect indentation level' + /* falls through */ case 3: + break; + case 4: + i++; /* falls through */ - } } - } + } + } - /* C-style comments with custom fallthru-comment. */ - void methodFallThruCustomWords(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; /* Continue with next case */ + /* C-style comments with custom fallthru-comment. */ + void methodFallThruCustomWords(int i, int j, boolean cond) { + while (true) { + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; /* Continue with next case */ - case 1: //warn - i++; + case 1: // violation 'Fall through from previous branch of the switch statement.' + i++; /* Continue with next case. */ - case 2: //warn - i++; - /* Continue with next case. */case 3: //warn - break; - case 4: - i++; + case 2: // violation 'Fall through from previous branch of the switch statement.' + i++; + /* Continue with next case. */ case 3: + // 2 violations above: + // 'Fall through from previous branch of the switch statement.' + // 'incorrect indentation level' + break; + case 4: + i++; /* Continue with next case */ - } } - } + } + } - void methodFallThruLastCaseGroup(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; // fallthru - } - switch (i){ - case 0: - i++; - // fallthru - } - switch (i){ - case 0: - i++; - /* fallthru */ } - } + void methodFallThruLastCaseGroup(int i, int j, boolean cond) { + while (true) { + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; // fallthru + } + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; + // fallthru + } + switch (i) { // violation 'switch without "default" clause.' + case 0: + i++; + /* fallthru */ + } } + } - void method1472228(int i) { - switch(i) { - case 2: - // do nothing - break; - default: - } + void method1472228(int i) { + switch (i) { + case 2: + // do nothing + break; + default: } + } - /* Test relief comment. */ - void methodFallThruWithDash(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; // fallthru - case 1: - i++; // fall thru - case 2: - i++; // fall-thru - case 3: - i++; // fallthrough - case 4: - i++; // fall through - case 5: - i++; // fall-through - case 6: - i++; // fallsthru - case 7: - i++; // falls thru - case 8: - i++; // falls-thru - case 9: - i++; // fallsthrough - case 10: - i++; // falls through - case 11: - i++; // falls-through - case 12: - i++; // fall--through - case 13: //warn - i++; // fall+through - case 14: //warn - i++; // falls_thru - case 15: //warn - i++; // falls=through - case 16: //warn - i++; // falls-throug - default: //warn - throw new RuntimeException(); - } + /* Test relief comment. */ + void methodFallThruWithDash(int i, int j, boolean cond) { + while (true) { + switch (i) { + case 0: + i++; // fallthru + case 1: + i++; // fall thru + case 2: + i++; // fall-thru + case 3: + i++; // fallthrough + case 4: + i++; // fall through + case 5: + i++; // fall-through + case 6: + i++; // fallsthru + case 7: + i++; // falls thru + case 8: + i++; // falls-thru + case 9: + i++; // fallsthrough + case 10: + i++; // falls through + case 11: + i++; // falls-through + case 12: + i++; // fall--through + case 13: // violation 'Fall through from previous branch of the switch statement.' + i++; // fall+through + case 14: // violation 'Fall through from previous branch of the switch statement.' + i++; // falls_thru + case 15: // violation 'Fall through from previous branch of the switch statement.' + i++; // falls=through + case 16: // violation 'Fall through from previous branch of the switch statement.' + i++; // falls-throug + default: // violation 'Fall through from previous branch of the switch statement.' + throw new RuntimeException(); } - } + } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/InputMissingSwitchDefault.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/InputMissingSwitchDefault.java deleted file mode 100644 index c459bdc8210..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4843defaultcasepresent/InputMissingSwitchDefault.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule4843defaultcasepresent; - -public class InputMissingSwitchDefault { - public void foo() { - int i = 1; - switch (i) { - case 1: i++; break; - case 2: i--; break; - default: return; - } - switch (i) { // warn - } - } -} - -class bad_test { - public void foo() { - int i = 1; - switch (i) { // warn - case 1: i++; break; - case 2: i--; break; - } - switch (i) { // warn - } - } - - class inner - { - public void foo1() { - int i = 1; - switch (i) { // warn - case 1: i++; break; - case 2: i--; break; - } - Foo foo = new Foo() { - public void foo() { - int i = 1; - switch (i) { // warn - case 1: i++; break; - case 2: i--; break; - } - switch (i) { // warn - } - } - }; - } - } -} - -interface Foo { - public void foo(); -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence/InputPresenceOfDefaultLabel.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence/InputPresenceOfDefaultLabel.java new file mode 100644 index 00000000000..c21bbbeb4a3 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4843defaultlabelpresence/InputPresenceOfDefaultLabel.java @@ -0,0 +1,74 @@ +package com.google.checkstyle.test.chapter4formatting.rule4843defaultlabelpresence; + +/** Some javadoc. */ +public class InputPresenceOfDefaultLabel { + /** Some javadoc. */ + public void foo() { + int i = 1; + switch (i) { + case 1: + i++; + break; + case 2: + i--; + break; + default: + return; + } + switch (i) { // violation 'switch without "default" clause.' + } + } + + class BadTest { + /** Some javadoc. */ + public void foo() { + int i = 1; + switch (i) { // violation 'switch without "default" clause.' + case 1: + i++; + break; + case 2: + i--; + break; + } + switch (i) { // violation 'switch without "default" clause.' + } + } + + class Inner { + /** Some javadoc. */ + public void foo1() { + int i = 1; + switch (i) { // violation 'switch without "default" clause.' + case 1: + i++; + break; + case 2: + i--; + break; + } + Foo foo = + new Foo() { + /** Some javadoc. */ + public void foo() { + int i = 1; + switch (i) { // violation 'switch without "default" clause.' + case 1: + i++; + break; + case 2: + i--; + break; + } + switch (i) { // violation 'switch without "default" clause.' + } + } + }; + } + } + } + + interface Foo { + public void foo(); + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/InputClassAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/InputClassAnnotations.java new file mode 100644 index 00000000000..2d0c46978d9 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/InputClassAnnotations.java @@ -0,0 +1,44 @@ +package com.google.checkstyle.test.chapter4formatting.rule4852classannotations; + +/** + * Test class for checking the rule 4852. + */ +public class InputClassAnnotations { + /** + * Custom annotation 1. + */ + public @interface SomeAnnotation1 { } + + /** + * Custom annotation 2. + */ + public @interface SomeAnnotation2 { } + + /** + * Inner class 2. + */ + @SomeAnnotation1 + @SomeAnnotation2 + class Inner1 {} + + @SomeAnnotation1 + @SomeAnnotation2 + /** // violation 'Javadoc comment is placed in the wrong location.' + * Inner class 2. + */ + class Inner2 {} + + /** + * Inner class 3. + */ + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + class Inner3 {} + + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + /** // violation 'Javadoc comment is placed in the wrong location.' + * Inner class 4. + */ + class Inner4 {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/InputFormattedClassAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/InputFormattedClassAnnotations.java new file mode 100644 index 00000000000..392b1a51e6f --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4852classannotations/InputFormattedClassAnnotations.java @@ -0,0 +1,20 @@ +package com.google.checkstyle.test.chapter4formatting.rule4852classannotations; + +/** Test class for checking the rule 4852. */ +public class InputFormattedClassAnnotations { + /** Custom annotation 1. */ + public @interface SomeAnnotation1 {} + + /** Custom annotation 2. */ + public @interface SomeAnnotation2 {} + + /** Inner class 2. */ + @SomeAnnotation1 + @SomeAnnotation2 + class Inner1 {} + + /** Inner class 3. */ + @SomeAnnotation1 + @SomeAnnotation2 + class Inner3 {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/InputFormattedMethodsAndConstructorsAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/InputFormattedMethodsAndConstructorsAnnotations.java new file mode 100644 index 00000000000..eb1b8e483e9 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/InputFormattedMethodsAndConstructorsAnnotations.java @@ -0,0 +1,56 @@ +package com.google.checkstyle.test.chapter4formatting.rule4853methodsandconstructorsannotations; + +/** Some javadoc. */ +public class InputFormattedMethodsAndConstructorsAnnotations { + /** Some javadoc. */ + public @interface SomeAnnotation1 {} + + /** Some javadoc. */ + public @interface SomeAnnotation2 {} + + // ********testing methods.*********** + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + void test1() {} + + /** testing. */ + @SomeAnnotation1 + void test2() {} + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + void test3() {} + + @SomeAnnotation1 + @SomeAnnotation2 + void test6() {} + + @SuppressWarnings("blah") + void test7() {} + + // ********testing constructors.********* + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + InputFormattedMethodsAndConstructorsAnnotations() {} + + /** testing. */ + @SomeAnnotation1 + InputFormattedMethodsAndConstructorsAnnotations(float f) {} + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + InputFormattedMethodsAndConstructorsAnnotations(int x) {} + + @SomeAnnotation1 + @SomeAnnotation2 + InputFormattedMethodsAndConstructorsAnnotations(String a, String b) {} + + @SuppressWarnings("blah") + InputFormattedMethodsAndConstructorsAnnotations(int x, int y) {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/InputMethodsAndConstructorsAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/InputMethodsAndConstructorsAnnotations.java new file mode 100644 index 00000000000..1c05870985f --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4853methodsandconstructorsannotations/InputMethodsAndConstructorsAnnotations.java @@ -0,0 +1,73 @@ +package com.google.checkstyle.test.chapter4formatting.rule4853methodsandconstructorsannotations; + +/** Some javadoc. */ +public class InputMethodsAndConstructorsAnnotations { + /** Some javadoc. */ + public @interface SomeAnnotation1 {} + + /** Some javadoc. */ + public @interface SomeAnnotation2 {} + + // ********testing methods.*********** + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + void test1() {} + + /** testing. */ + @SomeAnnotation1 void test2() {} + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + void test3() {} + + @SomeAnnotation1 + @SomeAnnotation2 + /** testing. */ // violation 'Javadoc comment is placed in the wrong location.' + void test4() {} + + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + /** testing. */ // violation 'Javadoc comment is placed in the wrong location.' + void test5() {} + + @SomeAnnotation1 @SomeAnnotation2 void test6() {} + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + + @SuppressWarnings("blah") void test7() {} + // violation above 'Annotation 'SuppressWarnings' should be alone on line.' + + // ********testing constructors.********* + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + InputMethodsAndConstructorsAnnotations() {} + + /** testing. */ + @SomeAnnotation1 InputMethodsAndConstructorsAnnotations(float f) {} + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + InputMethodsAndConstructorsAnnotations(int x) {} + + @SomeAnnotation1 + @SomeAnnotation2 + /** testing. */ // violation 'Javadoc comment is placed in the wrong location.' + InputMethodsAndConstructorsAnnotations(String str) {} + + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + /** testing. */ // violation 'Javadoc comment is placed in the wrong location.' + InputMethodsAndConstructorsAnnotations(double d) {} + + // violation below 'Annotation 'SomeAnnotation2' should be alone on line.' + @SomeAnnotation1 @SomeAnnotation2 InputMethodsAndConstructorsAnnotations(String a, + String b) {} + + // violation below 'Annotation 'SuppressWarnings' should be alone on line.' + @SuppressWarnings("blah") InputMethodsAndConstructorsAnnotations(int x, int y) {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/InputFieldAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/InputFieldAnnotations.java new file mode 100644 index 00000000000..bc7776a22e0 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/InputFieldAnnotations.java @@ -0,0 +1,60 @@ +package com.google.checkstyle.test.chapter4formatting.rule4854fieldannotations; + +import java.util.ArrayList; +import java.util.List; + +/** Some javadoc. */ +public class InputFieldAnnotations { + /** Some javadoc. */ + public @interface SomeAnnotation1 {} + + /** Some javadoc. */ + public @interface SomeAnnotation2 {} + + /** Some javadoc. */ + public @interface SomeAnnotation3 { + /** Some javadoc. */ + int x(); + } + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + String name = "Zops"; + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 + int age = 19; + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 String favLanguage = "Java"; + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation3(x = 90) String favPet = "Dog"; + + @SomeAnnotation1 @SomeAnnotation2 boolean test = false; + + @SuppressWarnings("bla") @SomeAnnotation3(x = 0) float pi = 3.14f; + + @SomeAnnotation1 @SomeAnnotation3(x = 14) + /** testing. */ // violation 'Javadoc comment is placed in the wrong location.' + List list = new ArrayList<>(); + + @SuppressWarnings("bla") + @SomeAnnotation1 + /** testing. */ // violation 'Javadoc comment is placed in the wrong location.' + InputFieldAnnotations obj = new InputFieldAnnotations(); + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + void test1() {} + + @SomeAnnotation1 @SomeAnnotation2 void test2() {} + // violation above 'Annotation 'SomeAnnotation2' should be alone on line.' + + @SomeAnnotation3(x = 78) void test3() {} + // violation above 'Annotation 'SomeAnnotation3' should be alone on line.' +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/InputFormattedFieldAnnotations.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/InputFormattedFieldAnnotations.java new file mode 100644 index 00000000000..f85784c2536 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4854fieldannotations/InputFormattedFieldAnnotations.java @@ -0,0 +1,48 @@ +package com.google.checkstyle.test.chapter4formatting.rule4854fieldannotations; + +/** Some javadoc. */ +public class InputFormattedFieldAnnotations { + /** Some javadoc. */ + public @interface SomeAnnotation1 {} + + /** Some javadoc. */ + public @interface SomeAnnotation2 {} + + /** Some javadoc. */ + public @interface SomeAnnotation3 { + /** Some javadoc. */ + int x(); + } + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 String name = "Zops"; + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 int age = 19; + + /** testing. */ + @SomeAnnotation1 @SomeAnnotation2 String favLanguage = "Java"; + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation3(x = 90) + String favPet = "Dog"; + + @SomeAnnotation1 @SomeAnnotation2 boolean test = false; + + @SuppressWarnings("bla") + @SomeAnnotation3(x = 0) + float pi = 3.14f; + + /** testing. */ + @SomeAnnotation1 + @SomeAnnotation2 + void test1() {} + + @SomeAnnotation1 + @SomeAnnotation2 + void test2() {} + + @SomeAnnotation3(x = 78) + void test3() {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java index d109aeae229..724750cc0b8 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationCommentIsAtTheEndOfBlock.java @@ -1,367 +1,416 @@ package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; - - - -/** - * Contains examples of using comments at the end of the block. - */ +/** Contains examples of using comments at the end of the block. */ public class InputCommentsIndentationCommentIsAtTheEndOfBlock { - public void foo1() { - foo2(); - // OOOO: missing functionality - } - - public void foo2() { - foo3(); - // warn - } - - public void foo3() { - foo2(); - // refreshDisplay(); - } - - public void foo4() { - foooooooooooooooooooooooooooooooooooooooooo(); - // ^-- some hint - } - - public void foooooooooooooooooooooooooooooooooooooooooo() { } - - /////////////////////////////// warn (a single-line border to separate a group of methods) - - public void foo7() { - int a = 0; -// warn - } - - /////////////////////////////// (a single-line border to separate a group of methods) - - public void foo8() {} - - public class TestClass { - public void test() { - int a = 0; - // warn - } - // warn - } - - public void foo9() { - this.foo1(); - // warn - } - - // public void foo10() { - // - // } - - public void foo11() { - String - .valueOf(new Integer(0)) - .trim() - .length(); - // comment - } - - public void foo12() { - String - .valueOf(new Integer(0)) - .trim() - .length(); - // warn - } - - public void foo13() { - String.valueOf(new Integer(0)) - .trim() - .length(); - // comment - } - - public void foo14() { - String.valueOf(new Integer(0)) - .trim() - .length(); - // warn - } - - public void foo15() { - String - .valueOf(new Integer(0)); - // comment - } - - public void foo16() { - String - .valueOf(new Integer(0)); - // warn - } - - public void foo17() { - String - .valueOf(new Integer(0)) + public void foo1() { + foo2(); + // OOOO: missing functionality + } + + /** some javadoc. */ + public void foo2() { + // violation 2 lines below '.* indentation should be the same level as line 14.' + foo3(); + // odd indentation comment + } + + public void foo3() { + foo2(); + // refreshDisplay(); + } + + public void foo4() { + foooooooooooooooooooooooooooooooooooooooooo(); + // ^-- some hint + } + + public void foooooooooooooooooooooooooooooooooooooooooo() {} + + /////////////////////////////// odd indentation comment + // violation above '.* indentation should be the same level as line 34.' + + /** some javadoc. */ + public void foo7() { + // violation 2 lines below'.* indentation should be the same level as line 36.' + int a = 0; +// odd indentation comment + } + + /////////////////////////////// (a single-line border to separate a group of methods) + + public void foo8() {} + + /** some javadoc. */ + public class TestClass { + /** some javadoc. */ + public void test() { + // violation 3 lines below '.* indentation should be the same level as line 50.' + // violation 4 lines below'.* indentation should be the same level as line 47.' + int a = 0; + // odd indentation comment + } + // odd indentation comment + } + + /** some javadoc. */ + public void foo9() { + // violation 2 lines below '.* indentation should be the same level as line 59.' + this.foo1(); + // odd indentation comment + } + + // public void foo10() { + // + // } + + public void foo11() { + String.valueOf(new Integer(0)).trim().length(); + // comment + } + + /** some javadoc. */ + public void foo12() { + // violation 5 lines below '.* indentation should be the same level as line 75.' + String + .valueOf(new Integer(0)) + .trim() + .length(); + // odd indentation comment + } + + public void foo13() { + String.valueOf(new Integer(0)).trim().length(); + // comment + } + + /** some javadoc. */ + public void foo14() { + // violation 4 lines below '.* indentation should be the same level as line 90.' + String.valueOf(new Integer(0)) + .trim() + .length(); + // odd indentation comment + } + + public void foo15() { + String.valueOf(new Integer(0)); + // comment + } + + /** some javadoc. */ + public void foo16() { + // violation 3 lines below '.* indentation should be the same level as line 104.' + String + .valueOf(new Integer(0)); + // odd indentation comment + } + + /** some javadoc. */ + public void foo17() { + String.valueOf(new Integer(0)) .trim() // comment .length(); - } - - public void foo18() { - String - .valueOf(new Integer(0)) - .trim() - // warn - .length(); - } - - public void foo19() { - (new Thread(new Runnable() { - @Override - public void run() { - - } - })). - run(); - // comment - } - - public void foo20() { - (new Thread(new Runnable() { - @Override - public void run() { - - } - })). - run(); - // warn - } - - public void foo21() { - int[] array = new int[5]; - - java.util.List expected = new java.util.ArrayList<>(); - for (int i = 0; i < 5; i++) { - org.junit.Assert.assertEquals(expected.get(i), array[i]); - } - String s = String.format(java.util.Locale.ENGLISH, "The array element " - + "immediately following the end of the collection should be nulled", - array[1]); - // the above example was taken from hibernate-orm and was modified a bit - } - - public void foo22() { - int[] array = new int[5]; - - java.util.List expected = new java.util.ArrayList<>(); - for (int i = 0; i < 5; i++) { - org.junit.Assert.assertEquals(expected.get(i), array[i]); - } - String s = String.format(java.util.Locale.ENGLISH, "The array element " - + "immediately following the end of the collection should be nulled", - array[1]); - // warn - } - - public void foo23() { - new Object(); - // comment - } - - public void foo24() { - new Object(); - // warn - } - - public String foo25() { - return String.format(java.util.Locale.ENGLISH, "%d", - 1); - // comment - } - - public String foo26() { - return String.format(java.util.Locale.ENGLISH, "%d", - 1); - // warn - } - - public void foo27() { - // comment - // block - foo17(); - - // OOOO - } - - public String foo28() { - int a = 5; - return String.format(java.util.Locale.ENGLISH, "%d", - 1); - // comment - } - - public String foo29() { - int a = 5; - return String.format(java.util.Locale.ENGLISH, "%d", - 1); - // warn - } - - public void foo30() { - // comment - int a = 5; -// warn - } - - public void foo31() { - String s = new String ("A" - + "B" - + "C"); - // comment - } - - public void foo32() { - String s = new String ("A" - + "B" - + "C"); - // warn - } - - public void foo33() { - // comment - this.foo22(); -// warn - } - - public void foo34() throws Exception { - throw new Exception("", - new Exception() - ); - // comment - } - - public void foo35() throws Exception { - throw new Exception("", - new Exception() - ); - // warn - } - - public void foo36() throws Exception { - throw new Exception("", - new Exception() - ); -// warn - } - - public void foo37() throws Exception { - throw new Exception("", new Exception()); - // comment - } - - public void foo38() throws Exception { - throw new Exception("", new Exception()); - // warn - } - - public void foo39() throws Exception { - throw new Exception("", - new Exception()); - // warn - } - - public void foo40() throws Exception { - int a = 88; - throw new Exception("", new Exception()); - // warn - } - - public void foo41() throws Exception { - int a = 88; - throw new Exception("", new Exception()); - // comment - } - - public void foo42() { - int a = 5; - if (a == 5) { - int b; - // comment - } else if (a ==6) { - - } - } - - public void foo43() { - try { - int a; - // comment - } catch (Exception e) { + } + + /** some javadoc. */ + public void foo18() { + // violation 4 lines below '.* indentation should be the same level as line 124.' + String + .valueOf(new Integer(0)) + .trim() + // odd indentation comment + .length(); + } + + /** some javadoc. */ + public void foo19() { + (new Thread( + new Runnable() { + @Override + public void run() {} + })) + .run(); + // comment + } + + /** some javadoc. */ + public void foo20() { + // violation 8 lines below '.* indentation should be the same level as line 141.' + (new Thread(new Runnable() { + @Override + public void run() { } - } - - public void foo44() { - int ar = 5; - // comment - ar = 6; - // comment - } - - public void foo45() { - int ar = 5; - // comment - ar = 6; - // warn - } - - public void foo46() { + })) + .run(); + // odd indentation comment + } + + /** some javadoc. */ + public void foo21() { + int[] array = new int[5]; + + java.util.List expected = new java.util.ArrayList<>(); + for (int i = 0; i < 5; i++) { + org.junit.Assert.assertEquals(expected.get(i), array[i]); + } + String s = + String.format( + java.util.Locale.ENGLISH, + "The array element " + + "immediately following the end of the collection should be nulled", + array[1]); + // the above example was taken from hibernate-orm and was modified a bit + } + + /** some javadoc. */ + public void foo22() { + int[] array = new int[5]; + + java.util.List expected = new java.util.ArrayList<>(); + for (int i = 0; i < 5; i++) { + org.junit.Assert.assertEquals(expected.get(i), array[i]); + } + // violation 4 lines below '.* indentation should be the same level as line 177.' + String s = String.format(java.util.Locale.ENGLISH, "The array element " + + "immediately following the end of the collection should be nulled", + array[1]); + // odd indentation comment + } + + public void foo23() { + new Object(); + // comment + } + + /** some javadoc. */ + public void foo24() { + // violation 2 lines below '.* indentation should be the same level as line 191.' + new Object(); + // odd indentation comment + } + + public String foo25() { + return String.format(java.util.Locale.ENGLISH, "%d", 1); + // comment + } + + /** some javadoc. */ + public String foo26() { + // violation 3 lines below '.* indentation should be the same level as line 203.' + return String.format(java.util.Locale.ENGLISH, "%d", + 1); + // odd indentation comment + } + + /** some javadoc. */ + public void foo27() { + // comment + // block + foo17(); + + // OOOO + } + + /** some javadoc. */ + public String foo28() { + int a = 5; + return String.format(java.util.Locale.ENGLISH, "%d", 1); + // comment + } + + /** some javadoc. */ + public String foo29() { + int a = 5; + // violation 3 lines below '.* indentation should be the same level as line 228.' + return String.format(java.util.Locale.ENGLISH, "%d", + 1); + // odd indentation comment + } + + /** some javadoc. */ + public void foo30() { + // comment + // violation 2 lines below '.* indentation should be the same level as line 237.' + int a = 5; +// odd indentation comment + } + + /** some javadoc. */ + public void foo31() { + String s = new String("A" + "B" + "C"); + // comment + } + + /** some javadoc. */ + public void foo32() { + // violation 4 lines below '.* indentation should be the same level as line 250.' + String s = new String("A" + + "B" + + "C"); + // odd indentation comment + } + + /** some javadoc. */ + public void foo33() { + // comment + // violation 2 lines below '.* indentation should be the same level as line 260.' + this.foo22(); +// odd indentation comment + } + + /** some javadoc. */ + public void foo34() throws Exception { + throw new Exception("", new Exception()); + // comment + } + + /** some javadoc. */ + public void foo35() throws Exception { + // violation 4 lines below '.* indentation should be the same level as line 273.' + throw new Exception("", + new Exception() + ); + // odd indentation comment + } + + /** some javadoc. */ + public void foo36() throws Exception { + // violation 4 lines below '.* indentation should be the same level as line 282.' + throw new Exception("", + new Exception() + ); +// odd indentation comment + } + + public void foo37() throws Exception { + throw new Exception("", new Exception()); + // comment + } + + /** some javadoc. */ + public void foo38() throws Exception { + // violation 2 lines below '.* indentation should be the same level as line 296.' + throw new Exception("", new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo39() throws Exception { + // violation 3 lines below'.* indentation should be the same level as line 303.' + throw new Exception("", + new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo40() throws Exception { + int a = 88; + // violation 2 lines below '.* indentation should be the same level as line 312.' + throw new Exception("", new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo41() throws Exception { + int a = 88; + throw new Exception("", new Exception()); + // comment + } + + /** some javadoc. */ + public void foo42() { + int a = 5; + if (a == 5) { + int b; + // comment + } else if (a == 6) { + /* foo */ + } + } + + /** some javadoc. */ + public void foo43() { + try { + int a; + // comment + } catch (Exception e) { + /* foo */ + } + } + + /** some javadoc. */ + public void foo44() { + int ar = 5; + // comment + ar = 6; + // comment + } + + /** some javadoc. */ + public void foo45() { + int ar = 5; + // comment + // violation 2 lines below '.* indentation should be the same level as line 357.' + ar = 6; + // odd indentation comment + } + + /** some javadoc. */ + public void foo46() { + // violation 3 lines below '.* indentation should be the same level as line 367.' // comment // block -// warn - } - - public void foo47() { - int a = 5; - // comment - // block - // comment - } - - public void foo48() { - int a = 5; +// odd indentation comment + } + + /** some javadoc. */ + public void foo47() { + int a = 5; + // comment + // block + // comment + } + + /** some javadoc. */ + public void foo48() { + // violation 4 lines below '.* indentation should be the same level as line 380.' + int a = 5; // comment // block -// warn - } - - public void foo49() { - // comment - // block - // ok - } - - public void foo50() { - return; - - // No NPE here! - } - - public String foo51() { - return String - .valueOf("11" - ); - // warn - } +// odd indentation comment + } + + /** some javadoc. */ + public void foo49() { + // comment + // block + // ok + } + + /** some javadoc. */ + public void foo50() { + return; + + // No NPE here! + } + + /** some javadoc. */ + public String foo51() { + // violation 4 lines below '.* indentation should be the same level as line 403.' + return String + .valueOf("11" + ); + // odd indentation comment + } - public String foo52() { - return String - .valueOf("11" - ); - // comment - } + public String foo52() { + return String.valueOf("11"); + // comment + } - // We almost reached the end of the class here. + // We almost reached the end of the class here. } // The END of the class. diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInEmptyBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInEmptyBlock.java index 20d3e9a93d8..80e7c0d362a 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInEmptyBlock.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInEmptyBlock.java @@ -1,86 +1,86 @@ package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; +/** some javadoc. */ public class InputCommentsIndentationInEmptyBlock { - private void foo1() { - int a = 5, b = 3, v = 6; - if (a == b - && v == b || ( a ==1 - /// // warn - /* // warn - * one fine day ... */ - && b == 1) ) { - // Cannot clearly detect user intention of explanation target. - } + private void foo1() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b + || (a == 1 + // violation 2 lines below '.* should be the same level as line 18.' + // violation 3 lines below '.* should be the same level as line 18.' + /// // odd indentation comment + // + /* // odd indentation comment + * one fine day ... */ + && b == 1)) { + // Cannot clearly detect user intention of explanation target. } + } - private void foo2() { - int a = 5, b = 3, v = 6; - if (a == b - && v == b || ( a ==1 - && b == 1) ) { - + private void foo2() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b || (a == 1 && b == 1)) { - // comment - } + // comment } + } - private void foo3() { - int a = 5, b = 3, v = 6; - if (a == b - && v == b || (a == 1 - && b == 1)) { -// warn - } + private void foo3() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b || (a == 1 && b == 1)) { +// odd indentation comment } + // violation 2 lines above '.* indentation should be the same level as line 39.' + } - // Comments here should be ok by Check - @SuppressWarnings("unused") // trailing - private static void foo4() { // trailing - if (true) // trailing comment - { - // some comment - } - if (true) { // trailing comment - - } - /** - * - */ + // Comments here should be ok by Check + @SuppressWarnings("unused") // trailing + private static void foo4() { // trailing + if (true) { // trailing comment + // some comment } - - // Comments here should be ok by Check - @SuppressWarnings("unused") // trailing - private static void foo5() { // trailing - if (true) // trailing comment - { -// warn - } - if (true) { // trailing comment - - } - /** - * - */ + if (true) { // trailing comment } + } - public void foo6() { - try { - - } catch (Exception e) { -// warn - } + // Comments here should be ok by Check + @SuppressWarnings("unused") // trailing + private static void foo5() { // trailing + if (true) { // trailing comment + // violation below '.* indentation should be the same level as line 59.' +// odd indentation comment } + if (true) { // trailing comment + } + } - public void foo7() { - try { - - } catch (Exception e) { - // OOOO: handle exception here - } + /** some javadoc. */ + public void foo6() { + try { + /* foo */ + } catch (Exception e) { +// odd indentation comment } + // violation 2 lines above '.* indentation should be the same level as line 70.' + } - private static class MyClass extends Object { - // no members + /** some javadoc. */ + public void foo7() { + try { + /* foo */ + } catch (Exception e) { + // OOOO: handle exception here } + } + + private static class MyClass extends Object { + // no members + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java index fca025b7253..3f8d3fd14a6 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationInSwitchBlock.java @@ -1,268 +1,320 @@ package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; +/** some javadoc. */ public class InputCommentsIndentationInSwitchBlock { - private static void fooSwitch() { - switch("") { - case "0": //some comment - case "1": - // my comment - foo1(); - break; - case "2": - // my comment - //comment - foo1(); - // comment - break; - case "3": - /* // warn */ - foo1(); - /* com */ - break; - case "5": - foo1(); - // warn - case "6": - int k = 7; - // fall through - case "7": - if (true) {} - // warn - case "8": - break; - case "9": - foo1(); - // fall through - case "10": { - if (true) {} - // fall through - } - case "11": { - // fall through - } - case "28": { - // fall through - } - case "12": { - // warn - int i; - } - case "13": { - // some comment in empty case block - } - case "14": { - // warn - } - case "15": { - foo1(); - // warn - } - case "16": { - int a; - } - // fall through - case "17": { - int a; - } - // warn - case "18": { System.lineSeparator(); - } // trailing comment - case "19": - // comment - case "20": - // comment - case "21": - default: - // comment - break; - } + private static void fooSwitch() { + switch ("") { + case "0": // some comment + case "1": + // my comment + foo1(); + break; + case "2": + // my comment + // comment + foo1(); + // comment + break; + case "3": + /* // odd indentation comment + * */ + // violation 2 lines above '.* indentation should be the same level as line 23.' + foo1(); + /* com */ + break; + case "5": + // violation 2 lines below '.* indentation should be the same level as line 30.' + foo1(); + // odd indentation comment + break; + case "6": + int k = 7; + // fall through + case "7": + // violation 2 lines below '.* indentation should be the same level as line 38.' + if (true) { /* foo */ } + // odd indentation comment + break; + case "8": + break; + case "9": + foo1(); + // fall through + case "10": { + if (true) { /* foo */ } + } + // fall through + case "11": { + } + // fall through + case "28": { + } + // fall through + case "12": { + // odd indentation comment + // violation above '.* indentation should be the same level as line 57.' + int i; + } + break; + case "13": { + // some comment in empty case block + } + break; + case "14": { + // odd indentation comment + // violation above '.* indentation should be the same level as line 67.' + } + break; + case "15": { + // violation 2 lines below '.* indentation should be the same level as line 71.' + foo1(); + // odd indentation comment + } + break; + case "16": { + int a; + } + // fall through + case "17": { + int a; + } + // violation below '.* indentation should be the same level as line 84.' + // odd indentation comment + break; + case "18": { + System.lineSeparator(); + } // trailing comment + break; + case "19": + // comment + case "20": + // comment + case "21": + default: + // comment + break; } + } - private static void foo1() { - if (true) { - switch(1) { - case 0: + private static void foo1() { + if (true) { + switch (1) { + case 0: - case 1: - // warn - int b = 10; - default: - // comment - } - - } + case 1: + // violation below '.* indentation should be the same level as line 108.' + // odd indentation comment + int b = 10; + break; + default: + // comment + } } + } - public void fooDotInCaseBlock() { - int i = 0; - String s = ""; - - switch (i) { - case -2: - // what - i++; - // no break here - case 0: - // what - s.indexOf("ignore"); - // no break here - case -1: - // what - s.indexOf("no way"); - // warn - case 1: - case 2: - i--; - // no break here - case 3: { } - // fall through - + /** some javadoc. */ + public void fooDotInCaseBlock() { + int i = 0; + String s = ""; - } - - String breaks = "" - // warn - + "" - // middle - + "" - // end - ; + switch (i) { + case -2: + // what + i++; + break; + case 0: + // what + s.indexOf("ignore"); + break; + case -1: + // what + // violation 2 lines below '.* indentation should be the same .* as line 135.' + s.indexOf("no way"); + // odd indentation comment + break; + case 1: + case 2: + i--; + break; + case 3: { + } + // fall through + default: } - public void foo2() { - int a = 1; - switch (a) { - case 1: - default: - // warn - } + String breaks = + "" + // violation below '.* indentation should be the same level as line 150.' + // odd indentation comment + + "" + // middle + + "" + // end + ; + } + + /** some javadoc. */ + public void foo2() { + int a = 1; + switch (a) { + case 1: + default: + // odd indentation comment } + // violation 2 lines above'.* indentation should be the same level as line 164.' + } - public void foo3() { - int a = 1; - switch (a) { - case 1: - default: + /** some javadoc. */ + public void foo3() { + int a = 1; + switch (a) { + case 1: + default: - // comment - } + // comment } + } - public void foo4() { - int a = 1; - switch (a) { - case 1: - int b; - // warn - default: - } + /** some javadoc. */ + public void foo4() { + int a = 1; + switch (a) { + case 1: + // violation 2 lines below '.* indentation should be the same .* as line 187.' + int b; + // odd indentation comment + break; + default: } + } - public void foo5() { - int a = 1; - switch (a) { - case 1: - int b; - // comment - default: - } + /** some javadoc. */ + public void foo5() { + int a = 1; + switch (a) { + case 1: + int b; + // comment + break; + default: } + } - public void foo6() { - int a = 1; - switch (a) { - case 1: - int b; - // comment - default: - } + /** some javadoc. */ + public void foo6() { + int a = 1; + switch (a) { + case 1: + int b; + // comment + break; + default: } + } - public void foo7() { - int a = 2; - String s = ""; - switch (a) { - // comment - // comment - // comment - case 1: - case 2: - // comment - // comment - foo1(); - // comment - case 3: - // comment - // comment - // comment - case 4: - // warn - case 5: - s.toString().toString().toString(); - // warn - // warn - // warn - default: - } + /** some javadoc. */ + public void foo7() { + int a = 2; + String s = ""; + switch (a) { + // comment + // comment + // comment + case 1: + case 2: + // comment + // comment + foo1(); + // comment + break; + case 3: + // comment + // comment + // comment + // violation 2 lines below'.* indentation should be the same .* as line 236, 238.' + case 4: + // odd indentation comment + case 5: + // violation 4 lines below 'indentation should be the same level as line 246.' + // violation 4 lines below 'indentation should be the same level as line 246.' + // violation 4 lines below 'indentation should be the same level as line 246.' + s.toString().toString().toString(); + // odd indentation comment + // odd indentation comment + // odd indentation comment + break; + default: } + } - public void foo8() { - int a = 2; - String s = ""; - switch (a) { - // comment - // comment - // comment - case 1: - case 2: - // comment - // comment - foo1(); - // comment - case 3: - // comment - // comment - s.toString().toString().toString(); - // comment - case 4: - // warn - default: - } + /** some javadoc. */ + public void foo8() { + int a = 2; + String s = ""; + switch (a) { + // comment + // comment + // comment + case 1: + case 2: + // comment + // comment + foo1(); + // comment + break; + case 3: + // comment + // comment + s.toString().toString().toString(); + // comment + // violation 3 lines below '.* indentation should be the same level as line 273, 275.' + break; + case 4: + // odd indentation comment + default: } + } - public void foo9() { - int a = 5; - switch (a) { - case 1: - case 2: - // comment - } + /** some javadoc. */ + public void foo9() { + int a = 5; + switch (a) { + case 1: + case 2: + // comment + default: } + } - public void foo10() { - int a = 5; - switch (a) { - case 1: - default: - // comment - } + /** some javadoc. */ + public void foo10() { + int a = 5; + switch (a) { + case 1: + default: + // comment } + } - public void foo11() { - int a = 5; - switch (a) { - case 1: - case 2: - // comment - } + /** some javadoc. */ + public void foo11() { + int a = 5; + switch (a) { + case 1: + case 2: + // comment + default: } + } - public void foo12() { - int a = 5; - switch (a) { - // comment - case 1: - } + /** some javadoc. */ + public void foo12() { + int a = 5; + switch (a) { + // comment + case 1: + default: } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationSurroundingCode.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationSurroundingCode.java index 04503871e55..ee9a5269465 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationSurroundingCode.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputCommentsIndentationSurroundingCode.java @@ -1,127 +1,145 @@ // comment + package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; import java.util.Arrays; // some -public class InputCommentsIndentationSurroundingCode -{ - private void foo1() { - if (true) { - // here initialize some variables - int k = 0; // trailing comment - // warn - int b = 10; - // sss - } +/** some javadoc. */ +public class InputCommentsIndentationSurroundingCode { + private void foo1() { + if (true) { + // here initialize some variables + int k = 0; // trailing comment + // odd indentation comment + // violation above '.* indentation should be the same level as line 16.' + int b = 10; + // sss } + } - private void foo2() { - if (true) { - /* some */ - int k = 0; - /* // warn */ - int b = 10; - /* // warn - * */ - double d; /* trailing comment */ - /* // warn - * - */ - boolean bb; - /***/ - /* my comment*/ - /* - * - * - * some - */ - /* - * comment - */ - boolean x; - } + private void foo2() { + if (true) { + /* some */ + int k = 0; + /* // odd indentation comment + */ + // violation 2 lines above '.* indentation should be the same level as line 28.' + int b = 10; + /* // odd indentation comment + * */ + // violation 2 lines above '.* indentation should be the same level as line 32.' + double d; /* trailing comment */ + /* // odd indentation comment + * + */ + // violation 3 lines above '.* indentation should be the same level as line 37.' + boolean bb; + /* my comment*/ + /* + * + * + * some + */ + /* + * comment + */ + boolean x; } + } - private void foo3() { - int a = 5, b = 3, v = 6; - if (a == b - && v == b || ( a ==1 - /// // warn - /* // warn - * one fine day ... */ - && b == 1) ) { - } - } + private void foo3() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b + || (a == 1 + /// // odd indentation comment + /* // odd indentation comment + * one fine day ... */ + // violation 3 lines above '.* indentation should.* as line 62.' + // violation 3 lines above '.* indentation should.* as line 62.' + && b == 1)) { /* foo */ } + } - private static void com() { - /* here's my weird trailing comment */ boolean b = true; - } + private static void com() { + /* here's my weird trailing comment */ boolean b = true; + } - private static final String[][] mergeMatrix = { - // This example of trailing block comments was found in PMD sources. - /* TOP */{ "", }, - /* ALWAYS */{ "", "", }, - /* NEVER */{ "NEVER", "UNKNOWN", "NEVER", }, - /* UNKNOWN */{ "UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN" }, }; - - private void foo4() { - if (!Arrays.equals(new String[]{""}, new String[]{""}) - /* wierd trailing comment */) { - } - } - /** - * some javadoc - */ - private static void l() { - } + private static final String[][] mergeMatrix = { + // This example of trailing block comments was found in PMD sources. + /* TOP */ { + "", + }, + /* ALWAYS */ { + "", "", + }, + /* NEVER */ { + "NEVER", "UNKNOWN", "NEVER", + }, + /* UNKNOWN */ {"UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN"}, + }; - public void foid5() { - String s = ""; - s.toString().toString().toString(); - // comment - } + private void foo4() { + if (!Arrays.equals(new String[] {""}, new String[] {""})/* wierd comment */) { /* foo */ } + } - public void foo6() { - // comment - // ... - // block - // ... - // warn - String someStr = new String(); - } + /** some javadoc. */ + private static void testing() {} - public void foo7() { - // comment - // ... - // block - // warn - // comment - String someStr = new String(); - } + /** some javadoc. */ + public void foid5() { + String s = ""; + s.toString().toString().toString(); + // comment + } - public void foo8() { - String s = new String(); // comment - // ... - // block - // ... - // warn - String someStr = new String(); - } + /** some javadoc. */ + public void foo6() { + // comment + // ... + // block + // ... + // odd indentation comment + // violation above '.* indentation should be the same level as line 105.' + String someStr = new String(); + } - public String foo9(String s1, String s2, String s3) { - return ""; - } + /** some javadoc. */ + public void foo7() { + // comment + // ... + // block + // odd indentation comment + // comment + // violation 2 lines above'.* indentation should be the same level as line 116.' + String someStr = new String(); + } - public void foo10() - throws Exception { + /** some javadoc. */ + public void foo8() { + String s = new String(); // comment + // ... + // block + // ... + // odd indentation comment + // violation above '.* indentation should be the same level as line 127.' + String someStr = new String(); + } - final String pattern = "^foo$"; + public String foo9(String s1, String s2, String s3) { + return ""; + } - final String[] expected = { - "7:13: " + foo9("", "", ""), - // comment - }; - } + /** some javadoc. */ + public void foo10() throws Exception { + + final String pattern = "^foo$"; + + final String[] expected = { + "7:13: " + foo9("", "", ""), + // comment + }; + } } // The Check should not throw NPE here! // The Check should not throw NPE here! diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationCommentIsAtTheEndOfBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationCommentIsAtTheEndOfBlock.java new file mode 100644 index 00000000000..f8e36eb82c3 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationCommentIsAtTheEndOfBlock.java @@ -0,0 +1,398 @@ +package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; + +/** Contains examples of using comments at the end of the block. */ +public class InputFormattedCommentsIndentationCommentIsAtTheEndOfBlock { + + public void foo1() { + foo2(); + // OOOO: missing functionality + } + + /** some javadoc. */ + public void foo2() { + + foo3(); + // odd indentation comment + } + + public void foo3() { + foo2(); + // refreshDisplay(); + } + + public void foo4() { + foooooooooooooooooooooooooooooooooooooooooo(); + // ^-- some hint + } + + public void foooooooooooooooooooooooooooooooooooooooooo() {} + + /////////////////////////////// odd indentation comment + + /** some javadoc. */ + public void foo7() { + + int a = 0; + // odd indentation comment + } + + /////////////////////////////// (a single-line border to separate a group of methods) + + public void foo8() {} + + /** some javadoc. */ + public class TestClass { + /** some javadoc. */ + public void test() { + + int a = 0; + // odd indentation comment + } + // odd indentation comment + } + + /** some javadoc. */ + public void foo9() { + + this.foo1(); + // odd indentation comment + } + + // public void foo10() { + // + // } + + public void foo11() { + String.valueOf(new Integer(0)).trim().length(); + // comment + } + + /** some javadoc. */ + public void foo12() { + + String.valueOf(new Integer(0)).trim().length(); + // odd indentation comment + } + + public void foo13() { + String.valueOf(new Integer(0)).trim().length(); + // comment + } + + /** some javadoc. */ + public void foo14() { + + String.valueOf(new Integer(0)).trim().length(); + // odd indentation comment + } + + public void foo15() { + String.valueOf(new Integer(0)); + // comment + } + + /** some javadoc. */ + public void foo16() { + + String.valueOf(new Integer(0)); + // odd indentation comment + } + + /** some javadoc. */ + public void foo17() { + String.valueOf(new Integer(0)) + .trim() + // comment + .length(); + } + + /** some javadoc. */ + public void foo18() { + + String.valueOf(new Integer(0)) + .trim() + // odd indentation comment + .length(); + } + + /** some javadoc. */ + public void foo19() { + (new Thread( + new Runnable() { + @Override + public void run() {} + })) + .run(); + // comment + } + + /** some javadoc. */ + public void foo20() { + + (new Thread( + new Runnable() { + @Override + public void run() {} + })) + .run(); + // odd indentation comment + } + + /** some javadoc. */ + public void foo21() { + int[] array = new int[5]; + + java.util.List expected = new java.util.ArrayList<>(); + for (int i = 0; i < 5; i++) { + org.junit.Assert.assertEquals(expected.get(i), array[i]); + } + String s = + String.format( + java.util.Locale.ENGLISH, + "The array element " + + "immediately following the end of the collection should be nulled", + array[1]); + // the above example was taken from hibernate-orm and was modified a bit + } + + /** some javadoc. */ + public void foo22() { + int[] array = new int[5]; + + java.util.List expected = new java.util.ArrayList<>(); + for (int i = 0; i < 5; i++) { + org.junit.Assert.assertEquals(expected.get(i), array[i]); + } + + String s = + String.format( + java.util.Locale.ENGLISH, + "The array element " + + "immediately following the end of the collection should be nulled", + array[1]); + // odd indentation comment + } + + public void foo23() { + new Object(); + // comment + } + + /** some javadoc. */ + public void foo24() { + + new Object(); + // odd indentation comment + } + + public String foo25() { + return String.format(java.util.Locale.ENGLISH, "%d", 1); + // comment + } + + /** some javadoc. */ + public String foo26() { + + return String.format(java.util.Locale.ENGLISH, "%d", 1); + // odd indentation comment + } + + /** some javadoc. */ + public void foo27() { + // comment + // block + foo17(); + + // OOOO + } + + /** some javadoc. */ + public String foo28() { + int a = 5; + return String.format(java.util.Locale.ENGLISH, "%d", 1); + // comment + } + + /** some javadoc. */ + public String foo29() { + int a = 5; + + return String.format(java.util.Locale.ENGLISH, "%d", 1); + // odd indentation comment + } + + /** some javadoc. */ + public void foo30() { + // comment + + int a = 5; + // odd indentation comment + } + + /** some javadoc. */ + public void foo31() { + String s = new String("A" + "B" + "C"); + // comment + } + + /** some javadoc. */ + public void foo32() { + + String s = new String("A" + "B" + "C"); + // odd indentation comment + } + + /** some javadoc. */ + public void foo33() { + // comment + + this.foo22(); + // odd indentation comment + } + + /** some javadoc. */ + public void foo34() throws Exception { + throw new Exception("", new Exception()); + // comment + } + + /** some javadoc. */ + public void foo35() throws Exception { + + throw new Exception("", new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo36() throws Exception { + + throw new Exception("", new Exception()); + // odd indentation comment + } + + public void foo37() throws Exception { + throw new Exception("", new Exception()); + // comment + } + + /** some javadoc. */ + public void foo38() throws Exception { + + throw new Exception("", new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo39() throws Exception { + + throw new Exception("", new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo40() throws Exception { + int a = 88; + + throw new Exception("", new Exception()); + // odd indentation comment + } + + /** some javadoc. */ + public void foo41() throws Exception { + int a = 88; + throw new Exception("", new Exception()); + // comment + } + + /** some javadoc. */ + public void foo42() { + int a = 5; + if (a == 5) { + int b; + // comment + } else if (a == 6) { + /* foo */ + } + } + + /** some javadoc. */ + public void foo43() { + try { + int a; + // comment + } catch (Exception e) { + /* foo */ + } + } + + /** some javadoc. */ + public void foo44() { + int ar = 5; + // comment + ar = 6; + // comment + } + + /** some javadoc. */ + public void foo45() { + int ar = 5; + // comment + + ar = 6; + // odd indentation comment + } + + /** some javadoc. */ + public void foo46() { + + // comment + // block + // odd indentation comment + } + + /** some javadoc. */ + public void foo47() { + int a = 5; + // comment + // block + // comment + } + + /** some javadoc. */ + public void foo48() { + + int a = 5; + // comment + // block + // odd indentation comment + } + + /** some javadoc. */ + public void foo49() { + // comment + // block + // ok + } + + /** some javadoc. */ + public void foo50() { + return; + + // No NPE here! + } + + /** some javadoc. */ + public String foo51() { + + return String.valueOf("11"); + // odd indentation comment + } + + public String foo52() { + return String.valueOf("11"); + // comment + } + + // We almost reached the end of the class here. +} +// The END of the class. diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationInEmptyBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationInEmptyBlock.java new file mode 100644 index 00000000000..b1d5b90946d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationInEmptyBlock.java @@ -0,0 +1,83 @@ +package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; + +/** some javadoc. */ +public class InputFormattedCommentsIndentationInEmptyBlock { + + private void foo1() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b + || (a == 1 + + /// // odd indentation comment + // + /* // odd indentation comment + * one fine day ... */ + && b == 1)) { + // Cannot clearly detect user intention of explanation target. + } + } + + private void foo2() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b || (a == 1 && b == 1)) { + + // comment + } + } + + private void foo3() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b || (a == 1 && b == 1)) { + // odd indentation comment + } + } + + // Comments here should be ok by Check + @SuppressWarnings("unused") // trailing + private static void foo4() { // trailing + if (true) { // trailing comment + // some comment + } + if (true) { // trailing comment + } + } + + // Comments here should be ok by Check + @SuppressWarnings("unused") // trailing + private static void foo5() { // trailing + if (true) { // trailing comment + + // odd indentation comment + } + if (true) { // trailing comment + } + } + + /** some javadoc. */ + public void foo6() { + try { + /* foo */ + } catch (Exception e) { + // odd indentation comment + } + } + + /** some javadoc. */ + public void foo7() { + try { + /* foo */ + } catch (Exception e) { + // OOOO: handle exception here + } + } + + private static class MyClass extends Object { + // no members + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationInSwitchBlock.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationInSwitchBlock.java new file mode 100644 index 00000000000..ba8f967b336 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationInSwitchBlock.java @@ -0,0 +1,341 @@ +package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; + +/** some javadoc. */ +public class InputFormattedCommentsIndentationInSwitchBlock { + + private static void fooSwitch() { + switch ("") { + case "0": // some comment + case "1": + // my comment + foo1(); + break; + case "2": + // my comment + // comment + foo1(); + // comment + break; + case "3": + /* // odd indentation comment + * */ + + foo1(); + /* com */ + break; + case "5": + foo1(); + // odd indentation comment + break; + case "6": + int k = 7; + // fall through + case "7": + if (true) { + /* foo */ + } + // odd indentation comment + break; + case "8": + break; + case "9": + foo1(); + // fall through + case "10": + // violation below ''{' at column 9 should be on the previous line.' + { + if (true) { + /* foo */ + } + } + // fall through + case "11": + // violation below ''{' at column 9 should be on the previous line.' + { + } + // fall through + case "28": + // violation below ''{' at column 9 should be on the previous line.' + { + } + // fall through + case "12": + // violation below ''{' at column 9 should be on the previous line.' + { + // odd indentation comment + + int i; + } + break; + case "13": + // violation below ''{' at column 9 should be on the previous line.' + { + // some comment in empty case block + } + break; + case "14": + // violation below ''{' at column 9 should be on the previous line.' + { + // odd indentation comment + + } + break; + case "15": + // violation below ''{' at column 9 should be on the previous line.' + { + foo1(); + // odd indentation comment + } + break; + case "16": + // violation below ''{' at column 9 should be on the previous line.' + { + int a; + } + // fall through + case "17": + // violation below ''{' at column 9 should be on the previous line.' + { + int a; + } + + // odd indentation comment + break; + case "18": + // violation below ''{' at column 9 should be on the previous line.' + { + System.lineSeparator(); + } // trailing comment + break; + case "19": + // comment + case "20": + // comment + case "21": + default: + // comment + break; + } + } + + private static void foo1() { + if (true) { + switch (1) { + case 0: + + case 1: + + // odd indentation comment + int b = 10; + break; + default: + // comment + } + } + } + + /** some javadoc. */ + public void fooDotInCaseBlock() { + int i = 0; + String s = ""; + + switch (i) { + case -2: + // what + i++; + break; + case 0: + // what + s.indexOf("ignore"); + break; + case -1: + // what + + s.indexOf("no way"); + // odd indentation comment + break; + case 1: + case 2: + i--; + break; + case 3: + // violation below ''{' at column 9 should be on the previous line.' + { + } + // fall through + default: + } + + String breaks = + "" + + // odd indentation comment + + "" + // middle + + "" + // end + ; + } + + /** some javadoc. */ + public void foo2() { + int a = 1; + switch (a) { + case 1: + default: + // odd indentation comment + } + } + + /** some javadoc. */ + public void foo3() { + int a = 1; + switch (a) { + case 1: + default: + + // comment + } + } + + /** some javadoc. */ + public void foo4() { + int a = 1; + switch (a) { + case 1: + int b; + // odd indentation comment + break; + default: + } + } + + /** some javadoc. */ + public void foo5() { + int a = 1; + switch (a) { + case 1: + int b; + // comment + break; + default: + } + } + + /** some javadoc. */ + public void foo6() { + int a = 1; + switch (a) { + case 1: + int b; + // comment + break; + default: + } + } + + /** some javadoc. */ + public void foo7() { + int a = 2; + String s = ""; + // violation 4 lines below '.* indentation should be the same level as line 246.' + switch (a) { + // comment + // comment + // comment + case 1: + case 2: + // comment + // comment + foo1(); + // comment + break; + case 3: + // comment + // comment + // comment + + case 4: + // odd indentation comment + case 5: + s.toString().toString().toString(); + // odd indentation comment + // odd indentation comment + // odd indentation comment + break; + default: + } + } + + /** some javadoc. */ + public void foo8() { + int a = 2; + String s = ""; + // violation 4 lines below '.* indentation should be the same level as line 279.' + switch (a) { + // comment + // comment + // comment + case 1: + case 2: + // comment + // comment + foo1(); + // comment + break; + case 3: + // comment + // comment + s.toString().toString().toString(); + // comment + + break; + case 4: + // odd indentation comment + default: + } + } + + /** some javadoc. */ + public void foo9() { + int a = 5; + switch (a) { + case 1: + case 2: + // comment + default: + } + } + + /** some javadoc. */ + public void foo10() { + int a = 5; + switch (a) { + case 1: + default: + // comment + } + } + + /** some javadoc. */ + public void foo11() { + int a = 5; + switch (a) { + case 1: + case 2: + // comment + default: + } + } + + /** some javadoc. */ + public void foo12() { + int a = 5; + // violation 2 lines below '.* indentation should be the same level as line 337.' + switch (a) { + // comment + case 1: + default: + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationSurroundingCode.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationSurroundingCode.java new file mode 100644 index 00000000000..4401b7b20eb --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule4861blockcommentstyle/InputFormattedCommentsIndentationSurroundingCode.java @@ -0,0 +1,149 @@ +// comment + +package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle; + +import java.util.Arrays; + +// some + +/** some javadoc. */ +public class InputFormattedCommentsIndentationSurroundingCode { + private void foo1() { + if (true) { + // here initialize some variables + int k = 0; // trailing comment + // odd indentation comment + + int b = 10; + // sss + } + } + + private void foo2() { + if (true) { + /* some */ + int k = 0; + /* // odd indentation comment + */ + + int b = 10; + /* // odd indentation comment + * */ + + double d; /* trailing comment */ + /* // odd indentation comment + * + */ + + boolean bb; + /* my comment*/ + /* + * + * + * some + */ + /* + * comment + */ + boolean x; + } + } + + private void foo3() { + int a = 5; + int b = 3; + int v = 6; + if (a == b && v == b + || (a == 1 + /// // odd indentation comment + /* // odd indentation comment + * one fine day ... */ + + && b == 1)) { + /* foo */ + } + } + + private static void com() { + /* here's my weird trailing comment */ boolean b = true; + } + + private static final String[][] mergeMatrix = { + // This example of trailing block comments was found in PMD sources. + /* TOP */ { + "", + }, + /* ALWAYS */ { + "", "", + }, + /* NEVER */ { + "NEVER", "UNKNOWN", "NEVER", + }, + /* UNKNOWN */ {"UNKNOWN", "UNKNOWN", "UNKNOWN", "UNKNOWN"}, + }; + + private void foo4() { + if (!Arrays.equals(new String[] {""}, new String[] {""}) /* wierd comment */) { + /* foo */ + } + } + + /** some javadoc. */ + private static void testing() {} + + /** some javadoc. */ + public void foid5() { + String s = ""; + s.toString().toString().toString(); + // comment + } + + /** some javadoc. */ + public void foo6() { + // comment + // ... + // block + // ... + // odd indentation comment + + String someStr = new String(); + } + + /** some javadoc. */ + public void foo7() { + // comment + // ... + // block + // odd indentation comment + // comment + + String someStr = new String(); + } + + /** some javadoc. */ + public void foo8() { + String s = new String(); // comment + // ... + // block + // ... + // odd indentation comment + + String someStr = new String(); + } + + public String foo9(String s1, String s2, String s3) { + return ""; + } + + /** some javadoc. */ + public void foo10() throws Exception { + + final String pattern = "^foo$"; + + final String[] expected = { + "7:13: " + foo9("", "", ""), + // comment + }; + } +} // The Check should not throw NPE here! +// The Check should not throw NPE here! diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputFormattedModifierOrder.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputFormattedModifierOrder.java new file mode 100644 index 00000000000..a754daf220b --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputFormattedModifierOrder.java @@ -0,0 +1,302 @@ +package com.google.checkstyle.test.chapter4formatting.rule487modifiers; + +abstract strictfp class InputFormattedModifierOrder { + private transient String dontSaveMe; + + public volatile int whatImReading; + + public volatile boolean ssModifierOrderVar = false; + + /** + * Illegal order of modifiers for methods. Make sure that the first and last modifier from the JLS + * sequence is used. + */ + private strictfp void doStuff() {} + + /** Single annotation without other modifiers. */ + @MyAnnotationFormatted + void someMethod() {} + + /** Illegal order of annotation - must come first. */ + private @MyAnnotationFormatted void someMethod2() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + /** Annotation in middle of other modifiers otherwise in correct order. */ + private @MyAnnotationFormatted strictfp void someMethod3() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + /** Correct order. */ + @MyAnnotationFormatted + private strictfp void someMethod4() {} + + /** Annotation in middle of other modifiers otherwise in correct order. */ + @MyAnnotationFormatted + public static @MyAnnotationFormatted2 strictfp void someMethod5() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + public static final synchronized strictfp void fooMethod() {} + + protected final strictfp @MyAnnotationFormatted static synchronized void fooMethod1() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + synchronized @MyAnnotationFormatted private static final strictfp void fooMethod2() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + protected static final synchronized strictfp void fooMethod3() {} + + @MyAnnotationFormatted + private static final synchronized strictfp void fooMethod4() {} + + final synchronized strictfp @MyAnnotationFormatted public static void fooMethod5() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + private static final synchronized strictfp void fooMethod6() {} + + protected static final synchronized strictfp @MyAnnotationFormatted void fooMethod7() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + protected abstract void fooMet(); + + abstract @MyAnnotationFormatted public void fooMet1(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + /** holder for redundant 'public' modifier check. */ + public static interface InputRedundantPublicModifier { + public void abc1(); + + void abc2(); + + abstract void abc3(); + + public float PI_PUBLIC = (float) 3.14; + + final float PI_FINAL = (float) 3.14; + + /** all OK. */ + float PI_OK = (float) 3.14; + } + + private final void method() {} +} + +// violation below 'Top-level class RedundantFinalClass2 has to reside in its own source file.' +final class RedundantFinalClass2 { + public final void finalMethod() {} + + public void method() {} + + protected @MyAnnotationFormatted static synchronized native void fooMethod(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + protected static @MyAnnotationFormatted synchronized native void fooMethod1(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + protected synchronized native void fooMethod2(); + + protected static synchronized native @MyAnnotationFormatted void fooMethod3(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + native @MyAnnotationFormatted protected static synchronized void fooMethod4(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + public static @MyAnnotationFormatted synchronized native void fooMethod5(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + static synchronized native @MyAnnotationFormatted public void fooMethod6(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + private static synchronized native @MyAnnotationFormatted void fooMethod7(); + // violation above '.* annotation modifier does not precede non-annotation modifiers.' +} + +// violation 2 lines below 'Top-level class .* has to reside in its own source file.' +/** Holder for redundant modifiers of inner implementation. */ +interface InnerImplementation2 { + InnerImplementation2 inner = + new InnerImplementation2() { + /** compiler requires 'public' modifier. */ + public void method() {} + }; + + void method(); +} + +// violation below 'Top-level class WithInner2 has to reside in its own source file.' +class WithInner2 { + /** + * Inner class. + * + * @author max + */ + class Inner { + private transient String dontSaveMe; + + public volatile int whatImReading; + + @MyAnnotationFormatted + protected synchronized native void fooMethod(); + + protected @MyAnnotationFormatted synchronized native void fooMethod1(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + protected synchronized @MyAnnotationFormatted native void fooMethod2(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + protected synchronized native @MyAnnotationFormatted void fooMethod3(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + native @MyAnnotationFormatted protected synchronized void fooMethod4(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + public @MyAnnotationFormatted synchronized native void fooMethod5(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + synchronized native @MyAnnotationFormatted public void fooMethod6(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + private synchronized native @MyAnnotationFormatted void fooMethod7(); + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + /** Anonymous class. */ + InnerImplementation2 foo = + new InnerImplementation2() { + + public void method() { + // OOOO Auto-generated method stub + + } + + private transient String dontSaveMe; + + public volatile int whatImReading; + + protected @MyAnnotationFormatted synchronized native void fooMethod(); + + // violation 2 lines above '.* annotation .* does not precede non-annotation modifiers.' + + protected @MyAnnotationFormatted synchronized native void fooMethod1(); + + // violation 2 lines above '.* annotation .* does not precede non-annotation modifiers.' + + protected synchronized @MyAnnotationFormatted native void fooMethod2(); + + // violation 2 lines above '.* annotation .* does not precede non-annotation modifiers.' + + protected synchronized native @MyAnnotationFormatted void fooMethod3(); + + // violation 2 lines above '.* annotation .* does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + protected synchronized native void fooMethod4(); + + public @MyAnnotationFormatted synchronized native void fooMethod5(); + + // violation 2 lines above '.* annotation .* does not precede non-annotation modifiers.' + + synchronized native @MyAnnotationFormatted public void fooMethod6(); + + // violation 2 lines above '.* annotation .* does not precede non-annotation modifiers.' + + private synchronized native @MyAnnotationFormatted void fooMethod7(); + // violation above '.* annotation modifier does not precede non-annotation modifiers.' + }; + } + + /** + * Inner abstract class. + * + * @author max + */ + abstract class AbsInner { + private transient String dontSaveMe; + + public volatile int whatImReading; + + @MyAnnotationFormatted + public final synchronized strictfp void fooMethod() {} + + protected final strictfp @MyAnnotationFormatted synchronized void fooMethod1() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + synchronized @MyAnnotationFormatted private final strictfp void fooMethod2() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + protected final synchronized strictfp void fooMethod3() {} + + @MyAnnotationFormatted + private final synchronized strictfp void fooMethod4() {} + + final synchronized strictfp @MyAnnotationFormatted public void fooMethod5() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + private final synchronized strictfp void fooMethod6() {} + + protected final synchronized strictfp @MyAnnotationFormatted void fooMethod7() {} + + // violation 2 lines above '.* annotation modifier does not precede non-annotation modifiers.' + + @MyAnnotationFormatted + protected abstract void fooMet(); + + abstract @MyAnnotationFormatted public void fooMet1(); + // violation above '.* annotation modifier does not precede non-annotation modifiers.' + } +} + +// violation 2 lines below 'Top-level class Annotation2 has to reside in its own source file.' +/** Holder for redundant modifiers of annotation fields/variables. */ +@interface Annotation2 { + public String s1 = ""; + final String s2 = ""; + static String s3 = ""; + String s4 = ""; + + public String blah(); + + abstract String blah2(); +} + +// violation below 'Top-level class MyAnnotationFormatted has to reside in its own source file.' +@interface MyAnnotationFormatted {} + +// violation below 'Top-level class MyAnnotationFormatted2 has to reside in its own source file.' +@interface MyAnnotationFormatted2 {} + +// violation 2 lines below 'Top-level class .* has to reside in its own source file.' +/** Illegal order of modifiers for interface methods. */ +interface InputModifierOrderInterface2 { + default strictfp void abc1() {} + + default strictfp void abc2() {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputModifierOrder.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputModifierOrder.java index 9bfd1e037fd..b66d8231612 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputModifierOrder.java +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule487modifiers/InputModifierOrder.java @@ -1,246 +1,276 @@ package com.google.checkstyle.test.chapter4formatting.rule487modifiers; -strictfp abstract class InputModifierOrder //warn -{ - transient private String dontSaveMe; //warn +// violation below ''abstract' modifier out of order with the JLS suggestions.' +strictfp abstract class InputModifierOrder { + transient private String dontSaveMe; + // violation above ''private' modifier out of order with the JLS suggestions.' - volatile public int whatImReading; //warn + volatile public int whatImReading; + // violation above ''public' modifier out of order with the JLS suggestions.' - public volatile boolean sModifierOrderVar = false; // ok + public volatile boolean ssModifierOrderVar = false; - /** - * Illegal order of modifiers for methods. Make sure that the - * first and last modifier from the JLS sequence is used. - */ - strictfp private void doStuff() //warn - { - } + /** + * Illegal order of modifiers for methods. Make sure that the first and last modifier from the JLS + * sequence is used. + */ + strictfp private void doStuff() {} + // violation above ''private' modifier out of order with the JLS suggestions.' - /** Single annotation without other modifiers */ - @MyAnnotation2 void someMethod() - { - } + /** Single annotation without other modifiers. */ + @MyAnnotation2 void someMethod() {} - /** Illegal order of annotation - must come first */ - private @MyAnnotation2 void someMethod2() //warn - { - } + /** Illegal order of annotation - must come first. */ + private @MyAnnotation2 void someMethod2() {} + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - /** Annotation in middle of other modifiers otherwise in correct order */ - private @MyAnnotation2 strictfp void someMethod3() //warn - { - } + /** Annotation in middle of other modifiers otherwise in correct order. */ + private @MyAnnotation2 strictfp void someMethod3() {} + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - /** Correct order */ - @MyAnnotation2 private strictfp void someMethod4() - { - } + /** Correct order. */ + @MyAnnotation2 private strictfp void someMethod4() {} - /** Annotation in middle of other modifiers otherwise in correct order */ - @MyAnnotation2 public static @MyAnnotation4 strictfp void someMethod5() //warn - { - } + /** Annotation in middle of other modifiers otherwise in correct order. */ + @MyAnnotation2 public static @MyAnnotation4 strictfp void someMethod5() {} + // violation above ''@MyAnnotation4' .* does not precede non-annotation modifiers.' - @MyAnnotation2 public static final synchronized strictfp void fooMethod() {}; //ok + @MyAnnotation2 public static final synchronized strictfp void fooMethod() {} - strictfp protected final @MyAnnotation2 static synchronized void fooMethod1() {}; //warn + // violation below ''protected' modifier out of order with the JLS suggestions.' + strictfp protected final @MyAnnotation2 static synchronized void fooMethod1() {} - synchronized @MyAnnotation2 strictfp private final static void fooMethod2() {}; //warn + // violation below ''@MyAnnotation2' .* does not precede non-annotation modifiers.' + synchronized @MyAnnotation2 strictfp private final static void fooMethod2() {} - @MyAnnotation2 static synchronized final strictfp protected void fooMethod3() {}; //warn + // violation below ''final' modifier out of order with the JLS suggestions.' + @MyAnnotation2 static synchronized final strictfp protected void fooMethod3() {} - @MyAnnotation2 strictfp static final synchronized private void fooMethod4() {}; //warn + // violation below ''static' modifier out of order with the JLS suggestions.' + @MyAnnotation2 strictfp static final synchronized private void fooMethod4() {} - synchronized final strictfp @MyAnnotation2 static public void fooMethod5() {}; //warn - @MyAnnotation2 static synchronized strictfp private final void fooMethod6() {}; //warn + // violation below ''final' modifier out of order with the JLS suggestions.' + synchronized final strictfp @MyAnnotation2 static public void fooMethod5() {} - final strictfp synchronized static protected @MyAnnotation2 void fooMethod7() {}; //warn + // violation below ''private' modifier out of order with the JLS suggestions.' + @MyAnnotation2 static synchronized strictfp private final void fooMethod6() {} - @MyAnnotation2 abstract protected void fooMet(); //warn + // violation below ''synchronized' modifier out of order with the JLS suggestions.' + final strictfp synchronized static protected @MyAnnotation2 void fooMethod7() {} - abstract @MyAnnotation2 public void fooMet1(); //warn + // violation below ''protected' modifier out of order with the JLS suggestions.' + @MyAnnotation2 abstract protected void fooMet(); - /** holder for redundant 'public' modifier check. */ - public static interface InputRedundantPublicModifier - { - public void a(); + // violation below ''@MyAnnotation2' .* does not precede non-annotation modifiers.' + abstract @MyAnnotation2 public void fooMet1(); - void b(); + /** holder for redundant 'public' modifier check. */ + public static interface InputRedundantPublicModifier { + public void abc1(); - abstract void c(); + void abc2(); - public float PI_PUBLIC = (float) 3.14; + abstract void abc3(); - final float PI_FINAL = (float) 3.14; + public float PI_PUBLIC = (float) 3.14; - /** all OK */ - float PI_OK = (float) 3.14; - } - final private void method() // warn - { - } -} + final float PI_FINAL = (float) 3.14; -final class RedundantFinalClass -{ - public final void finalMethod() - { - } + /** all OK. */ + float PI_OK = (float) 3.14; + } + // violation below ''private' modifier out of order with the JLS suggestions.' + final private void method() {} +} - public void method() - { - } +// violation below 'Top-level class RedundantFinalClass has to reside in its own source file.' +final class RedundantFinalClass { + public final void finalMethod() {} - protected @MyAnnotation2 static synchronized native void fooMethod(); // warn + public void method() {} - static protected @MyAnnotation2 synchronized native void fooMethod1(); // warn + protected @MyAnnotation2 static synchronized native void fooMethod(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - @MyAnnotation2 protected synchronized native void fooMethod2(); // ok + static protected @MyAnnotation2 synchronized native void fooMethod1(); + // violation above ''protected' modifier out of order with the JLS suggestions.' - native synchronized protected static @MyAnnotation2 void fooMethod3(); // warn + @MyAnnotation2 protected synchronized native void fooMethod2(); - native @MyAnnotation2 protected static synchronized void fooMethod4(); // warn + native synchronized protected static @MyAnnotation2 void fooMethod3(); + // violation above ''synchronized' modifier out of order with the JLS suggestions.' - public static @MyAnnotation2 synchronized native void fooMethod5(); // warn + native @MyAnnotation2 protected static synchronized void fooMethod4(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - synchronized static native @MyAnnotation2 public void fooMethod6(); // warn + public static @MyAnnotation2 synchronized native void fooMethod5(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - static synchronized private native @MyAnnotation2 void fooMethod7(); // warn -} + synchronized static native @MyAnnotation2 public void fooMethod6(); + // violation above ''static' modifier out of order with the JLS suggestions.' -/** Holder for redundant modifiers of inner implementation */ -interface InnerImplementation -{ - InnerImplementation inner = - new InnerImplementation() - { - /** compiler requires 'public' modifier */ - public void method() - { - } - }; - - void method(); + static synchronized private native @MyAnnotation2 void fooMethod7(); + // violation above ''private' modifier out of order with the JLS suggestions.' } -class WithInner -{ - /** - * Inner class - * @author max - * - */ - class Inner - { - transient private String dontSaveMe; //warn +// violation 2 lines below 'Top-level class .* has to reside in its own source file.' +/** Holder for redundant modifiers of inner implementation. */ +interface InnerImplementation { + InnerImplementation inner = + new InnerImplementation() { + /** compiler requires 'public' modifier. */ + public void method() {} + }; + + void method(); +} - volatile public int whatImReading; //warn +// violation below 'Top-level class WithInner has to reside in its own source file.' +class WithInner { + /** + * Inner class. + * + * @author max + */ + class Inner { + transient private String dontSaveMe; + // violation above ''private' modifier out of order with the JLS suggestions.' - @MyAnnotation2 protected synchronized native void fooMethod(); // ok + volatile public int whatImReading; + // violation above ''public' modifier out of order with the JLS suggestions.' - protected @MyAnnotation2 synchronized native void fooMethod1(); // warn + @MyAnnotation2 protected synchronized native void fooMethod(); - synchronized protected @MyAnnotation2 native void fooMethod2(); // warn + protected @MyAnnotation2 synchronized native void fooMethod1(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - native synchronized protected @MyAnnotation2 void fooMethod3(); // warn + synchronized protected @MyAnnotation2 native void fooMethod2(); + // violation above ''protected' modifier out of order with the JLS suggestions.' - native @MyAnnotation2 protected synchronized void fooMethod4(); // warn + native synchronized protected @MyAnnotation2 void fooMethod3(); + // violation above ''synchronized' modifier out of order with the JLS suggestions.' - public @MyAnnotation2 synchronized native void fooMethod5(); // warn + native @MyAnnotation2 protected synchronized void fooMethod4(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - synchronized native @MyAnnotation2 public void fooMethod6(); // warn + public @MyAnnotation2 synchronized native void fooMethod5(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - synchronized private native @MyAnnotation2 void fooMethod7(); // warn + synchronized native @MyAnnotation2 public void fooMethod6(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - /** - * Anonymous class - */ - InnerImplementation foo = new InnerImplementation() { + synchronized private native @MyAnnotation2 void fooMethod7(); + // violation above ''private' modifier out of order with the JLS suggestions.' + /** Anonymous class. */ + InnerImplementation foo = + new InnerImplementation() { - public void method() { + public void method() { // OOOO Auto-generated method stub - } + } - transient private String dontSaveMe; //warn + transient private String dontSaveMe; + // violation above ''private' modifier out of order with the JLS suggestions.' - volatile public int whatImReading; //warn + volatile public int whatImReading; + // violation above ''public' modifier out of order with the JLS suggestions.' - protected @MyAnnotation2 synchronized native void fooMethod(); // warn + protected @MyAnnotation2 synchronized native void fooMethod(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - protected @MyAnnotation2 synchronized native void fooMethod1(); // warn + protected @MyAnnotation2 synchronized native void fooMethod1(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - synchronized protected @MyAnnotation2 native void fooMethod2(); // warn + synchronized protected @MyAnnotation2 native void fooMethod2(); + // violation above ''protected' modifier out of order with the JLS suggestions.' - native synchronized protected @MyAnnotation2 void fooMethod3(); // warn + native synchronized protected @MyAnnotation2 void fooMethod3(); + // violation above ''synchronized' modifier out of order with the JLS suggestions.' - @MyAnnotation2 protected synchronized native void fooMethod4(); // ok + @MyAnnotation2 protected synchronized native void fooMethod4(); - public @MyAnnotation2 synchronized native void fooMethod5(); // warn + public @MyAnnotation2 synchronized native void fooMethod5(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - synchronized native @MyAnnotation2 public void fooMethod6(); // warn + synchronized native @MyAnnotation2 public void fooMethod6(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' - synchronized private native @MyAnnotation2 void fooMethod7(); // warn - }; - } + synchronized private native @MyAnnotation2 void fooMethod7(); + // violation above ''private' modifier out of order with the JLS suggestions.' + }; + } - /** - * Inner abstract class - * @author max - * - */ - abstract class AbsInner - { - transient private String dontSaveMe; //warn + /** + * Inner abstract class. + * + * @author max + */ + abstract class AbsInner { + transient private String dontSaveMe; + // violation above ''private' modifier out of order with the JLS suggestions.' - volatile public int whatImReading; //warn + volatile public int whatImReading; + // violation above ''public' modifier out of order with the JLS suggestions.' - @MyAnnotation2 public final synchronized strictfp void fooMethod() {}; //ok + @MyAnnotation2 public final synchronized strictfp void fooMethod() {} - strictfp protected final @MyAnnotation2 synchronized void fooMethod1() {}; //warn + // violation below ''protected' modifier out of order with the JLS suggestions.' + strictfp protected final @MyAnnotation2 synchronized void fooMethod1() {} - synchronized @MyAnnotation2 strictfp private final void fooMethod2() {}; //warn + // violation below ''@MyAnnotation2' .* does not precede non-annotation modifiers.' + synchronized @MyAnnotation2 strictfp private final void fooMethod2() {} - @MyAnnotation2 synchronized final strictfp protected void fooMethod3() {}; //warn + // violation below ''final' modifier out of order with the JLS suggestions.' + @MyAnnotation2 synchronized final strictfp protected void fooMethod3() {} - @MyAnnotation2 strictfp final synchronized private void fooMethod4() {}; //warn + // violation below ''final' modifier out of order with the JLS suggestions.' + @MyAnnotation2 strictfp final synchronized private void fooMethod4() {} - synchronized final strictfp @MyAnnotation2 public void fooMethod5() {}; //warn + // violation below ''final' modifier out of order with the JLS suggestions.' + synchronized final strictfp @MyAnnotation2 public void fooMethod5() {} - @MyAnnotation2 synchronized strictfp private final void fooMethod6() {}; //warn + // violation below ''private' modifier out of order with the JLS suggestions.' + @MyAnnotation2 synchronized strictfp private final void fooMethod6() {} - final strictfp synchronized protected @MyAnnotation2 void fooMethod7() {}; //warn + // violation below ''synchronized' modifier out of order with the JLS suggestions.' + final strictfp synchronized protected @MyAnnotation2 void fooMethod7() {} - @MyAnnotation2 abstract protected void fooMet(); //warn + @MyAnnotation2 abstract protected void fooMet(); + // violation above ''protected' modifier out of order with the JLS suggestions.' - abstract @MyAnnotation2 public void fooMet1(); //warn - } + abstract @MyAnnotation2 public void fooMet1(); + // violation above ''@MyAnnotation2' .* does not precede non-annotation modifiers.' + } } -/** Holder for redundant modifiers of annotation fields/variables */ -@interface Annotation -{ - public String s1 = ""; - final String s2 = ""; - static String s3 = ""; - String s4 = ""; - public String blah(); - abstract String blah2(); -} +// violation 2 lines below 'Top-level class Annotation has to reside in its own source file.' +/** Holder for redundant modifiers of annotation fields/variables. */ +@interface Annotation { + public String s1 = ""; + final String s2 = ""; + static String s3 = ""; + String s4 = ""; -@interface MyAnnotation2 { -} + public String blah(); -@interface MyAnnotation4 { + abstract String blah2(); } -/** Illegal order of modifiers for interface methods */ -interface InputModifierOrderInterface -{ - default strictfp void a() { } //ok +// violation below 'Top-level class MyAnnotation2 has to reside in its own source file.' +@interface MyAnnotation2 {} + +// violation below 'Top-level class MyAnnotation4 has to reside in its own source file.' +@interface MyAnnotation4 {} + +// violation 2 lines below 'Top-level class .* has to reside in its own source file.' +/** Illegal order of modifiers for interface methods. */ +interface InputModifierOrderInterface { + default strictfp void abc1() {} - strictfp default void b() { } //warn + strictfp default void abc2() {} + // violation above ''default' modifier out of order with the JLS suggestions.' } diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/InputNumericLiterals.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/InputNumericLiterals.java new file mode 100644 index 00000000000..f58df6192e0 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/InputNumericLiterals.java @@ -0,0 +1,103 @@ +package com.google.checkstyle.test.chapter4formatting.rule488numericliterals; + +class InputNumericLiterals { + /** test. * */ + private final long ignore = 666l + 666L; // violation 'Should use uppercase 'L'.' + + private String notWarn = "666l"; // ok + + private long foo() { + processUpperEll(66l); // violation 'Should use uppercase 'L'.' + processUpperEll(66L); // ok + processUpperEll("s", 66l); // violation 'Should use uppercase 'L'.' + processUpperEll("s", 66L); // ok + + return 666l + 666L; // violation 'Should use uppercase 'L'.' + } + + private void processUpperEll(long xyz) { + long bad = + (4 + 5 * 7 ^ 66l / 7 + 890) // violation 'Should use uppercase 'L'.' + & (88l + 78 * 4); // violation 'Should use uppercase 'L'.' + long good = (4 + 5 * 7 ^ 66L / 7 + 890) & (88L + 78 * 4); // ok + long[] array = { + 66l, // violation 'Should use uppercase 'L'.' + 66L, // ok + }; + } + + private void processUpperEll(String s, long l) {} + + class Inner { + /** test. * */ + private static final long IGNORE = 666l + 666L; // violation 'Should use uppercase 'L'.' + + private static final String notWarn = "666l"; // ok + + private long foo() { + processUpperEll(66l); // violation 'Should use uppercase 'L'.' + processUpperEll(66L); // ok + processUpperEll("s", 66l); // violation 'Should use uppercase 'L'.' + processUpperEll("s", 66L); // ok + + return 666l + 666L; // violation 'Should use uppercase 'L'.' + } + + private void processUpperEll(long xyz) { + long bad = + (4 + 5 * 7 ^ 66l / 7 + 890) // violation 'Should use uppercase 'L'.' + & (88l + 78 * 4); // violation 'Should use uppercase 'L'.' + long good = (4 + 5 * 7 ^ 66L / 7 + 890) & (88L + 78 * 4); // ok + } + + private void processUpperEll(String s, long l) { + long[] array = { + 66l, // violation 'Should use uppercase 'L'.' + 66L, // ok + }; + } + + void fooMethod() { + Foo foo = + new Foo() { + /** test. * */ + private final long ignore = 666l + 666L; // violation 'Should use uppercase 'L'.' + + private String notWarn = "666l"; // ok + + private long foo() { + processUpperEll(66l); // violation 'Should use uppercase 'L'.' + processUpperEll(66L); // ok + processUpperEll("s", 66l); // violation 'Should use uppercase 'L'.' + processUpperEll("s", 66L); // ok + + return 666l + 666L; // violation 'Should use uppercase 'L'.' + } + + private void processUpperEll(long x) { + long bad = + (4 + 5 * 7 ^ 66l / 7 + 890) // violation 'Should use uppercase 'L'.' + & (88l + 78 * 4); // violation 'Should use uppercase 'L'.' + long good = (4 + 5 * 7 ^ 66L / 7 + 890) & (88L + 78 * 4); // ok + long[] array = { + 66l, // violation 'Should use uppercase 'L'.' + 66L, // ok + }; + } + + private void processUpperEll(String s, long x) {} + }; + } + } + + class Foo {} + + interface Long { + public static final long IGNORE = 666l + 666L; // violation 'Should use uppercase 'L'.' + public static final String notWarn = "666l"; // ok + long bad = + (4 + 5 * 7 ^ 66l / 7 + 890) // violation 'Should use uppercase 'L'.' + & (88l + 78 * 4); // violation 'Should use uppercase 'L'.' + long good = (4 + 5 * 7 ^ 66L / 7 + 890) & (88L + 78 * 4); // ok + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/InputUpperEll.java b/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/InputUpperEll.java deleted file mode 100644 index 3da221b85be..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule488numericliterals/InputUpperEll.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.google.checkstyle.test.chapter4formatting.rule488numericliterals; - -class InputUpperEll -{ - /** test **/ - private final long IGNORE = 666l + 666L; //warn - - private String notWarn = "666l"; //ok - - private long foo() - { - processUpperEll(66l); //warn - processUpperEll(66L); //ok - processUpperEll("s", 66l); //warn - processUpperEll("s", 66L); //ok - - return 666l + 666L; //warn - } - - private void processUpperEll(long aLong) { - long bad = (4+5*7^66l/7+890) //warn - & (88l + 78 * 4); //warn - long good = (4+5*7^66L/7+890) & (88L + 78 * 4); //ok - long[] array = { - 66l, //warn - 66L, //ok - }; - } - - private void processUpperEll(String s, long l) {} - - class Inner { - /** test **/ - private static final long IGNORE = 666l + 666L; //warn - - private static final String notWarn = "666l"; //ok - - private long foo() - { - processUpperEll(66l); //warn - processUpperEll(66L); //ok - processUpperEll("s", 66l); //warn - processUpperEll("s", 66L); //ok - - return 666l + 666L; //warn - } - - private void processUpperEll(long aLong) - { - long bad = (4+5*7^66l/7+890) //warn - & (88l + 78 * 4); //warn - long good = (4+5*7^66L/7+890) & (88L + 78 * 4); //ok - } - private void processUpperEll(String s, long l) { - long[] array = { - 66l, //warn - 66L, //ok - }; - } - - void fooMethod() - { - Foo foo = new Foo() { - /** test **/ - private final long IGNORE = 666l + 666L; //warn - - private String notWarn = "666l"; //ok - - private long foo() - { - processUpperEll(66l); //warn - processUpperEll(66L); //ok - processUpperEll("s", 66l); //warn - processUpperEll("s", 66L); //ok - - return 666l + 666L; //warn - } - - private void processUpperEll(long aLong) { - long bad = (4+5*7^66l/7+890) //warn - & (88l + 78 * 4); //warn - long good = (4+5*7^66L/7+890) & (88L + 78 * 4); //ok - long[] array = { - 66l, //warn - 66L, //ok - }; - } - - private void processUpperEll (String s, long aLong) {} - }; - } - } - - class Foo {} - - interface Long { - public static final long IGNORE = 666l + 666L; //warn - public static final String notWarn = "666l"; //ok - long bad = (4+5*7^66l/7+890) //warn - & (88l + 78 * 4); //warn - long good = (4+5*7^66L/7+890) & (88L + 78 * 4); //ok - } -} - - - diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule51identifiernames/InputCatchParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule51identifiernames/InputCatchParameterName.java index 42133bf8f99..baec888b4ae 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule51identifiernames/InputCatchParameterName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule51identifiernames/InputCatchParameterName.java @@ -1,65 +1,115 @@ package com.google.checkstyle.test.chapter5naming.rule51identifiernames; +/** some javadoc. */ public class InputCatchParameterName { - { - try { - } catch (Exception e) { // ok - } - try { - } catch (Exception ex) { // ok - } - try { - } catch (Error | Exception err) { // ok - } - try { - } catch (Exception exception) { // ok - } - try { - } catch (Exception exception1) { // ok - } - try { - } catch (Exception noWorries) { // ok - } - try { - } catch (Throwable t) { // ok - } - try { - throw new InterruptedException("interruptedException"); - } catch (InterruptedException ie) { // ok - } - try { - } catch (Exception ok) { // ok - // appropriate to take no action here - } - try { - } catch (Exception e1) { // ok - try { - } catch (Exception e2) { // ok - } - } - try { - } catch (Throwable t1) { // ok - try { - } catch (Throwable t2) { // ok - } - } - try { - } catch (Exception iException) { // warn - } - try { - } catch (Exception ex_1) { // warn - } - try { - } catch (Exception eX) { // warn - } - try { - } catch (Exception eXX) { // warn - } - try { - } catch (Exception x_y_z) { // warn - } - try { - } catch (Exception Ex) { // warn - } + { + try { + /* foo */ + } catch (Exception e) { + /* foo */ } + try { + /* foo */ + } catch (Exception ex) { + /* foo */ + } + try { + /* foo */ + } catch (Error | Exception err) { + /* foo */ + } + try { + /* foo */ + } catch (Exception exception) { + /* foo */ + } + try { + /* foo */ + } catch (Exception exception1) { + /* foo */ + } + try { + /* foo */ + } catch (Exception noWorries) { + /* foo */ + } + try { + /* foo */ + } catch (Throwable t) { + /* foo */ + } + try { + throw new InterruptedException("interruptedException"); + } catch (InterruptedException ie) { + /* foo */ + } + try { + /* foo */ + } catch (Exception ok) { + // appropriate to take no action here + } + try { + /* foo */ + } catch (Exception e1) { + try { + /* foo */ + } catch (Exception e2) { + /* foo */ + } + } + try { + /* foo */ + } catch (Throwable t1) { + try { + /* foo */ + } catch (Throwable t2) { + /* foo */ + } + } + try { + /* foo */ + } catch (Exception iException) { + // violation above 'Catch parameter name 'iException' must match pattern' + } + try { + /* foo */ + } catch (Exception ex_1) { // violation 'Catch parameter name 'ex_1' must match pattern' + } + try { + /* foo */ + } catch (Exception eX) { // violation 'Catch parameter name 'eX' must match pattern' + } + try { + /* foo */ + } catch (Exception eXX) { + // 2 violations above: + // 'Abbreviation in name 'eXX' must contain no more than '1' consecutive capital letters.' + // 'Catch parameter name 'eXX' must match pattern' + /* foo */ + } + try { + /* foo */ + } catch (Exception x_y_z) { // violation 'Catch parameter name 'x_y_z' must match pattern' + } + try { + /* foo */ + } catch (Exception Ex) { // violation 'Catch parameter name 'Ex' must match pattern' + } + try { + /* foo */ + } catch (Exception name_) { // violation 'Catch parameter name 'name_' must match pattern' + } + try { + /* foo */ + } catch (Exception mName) { // violation 'Catch parameter name 'mName' must match pattern' + } + try { + /* foo */ + } catch (Exception s_name) { // violation 'Catch parameter name 's_name' must match pattern' + } + try { + /* foo */ + } catch (Exception kName) { // violation 'Catch parameter name 'kName' must match pattern' + } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521$packagenames/InputPackageBadName3.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521$packagenames/InputPackageBadName3.java index b2c8cb39107..1d2ac52d025 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521$packagenames/InputPackageBadName3.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521$packagenames/InputPackageBadName3.java @@ -1,2 +1,5 @@ -package com.google.checkstyle.test.chapter5naming.rule521$packagenames; //warn +package com.google.checkstyle.test.chapter5naming.rule521$packagenames; + +// violation 2 lines above 'Package name .* must match pattern .*' + final class InputPackageBadName3 {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521_packagenames/InputBadPackageName2.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521_packagenames/InputBadPackageName2.java index e204f6b311f..e0f260f21ff 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521_packagenames/InputBadPackageName2.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521_packagenames/InputBadPackageName2.java @@ -1,2 +1,5 @@ -package com.google.checkstyle.test.chapter5naming.rule521_packagenames; //warn +package com.google.checkstyle.test.chapter5naming.rule521_packagenames; + +// violation 2 lines above 'Package name .* must match pattern .*' + final class InputBadPackageName2 {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packageNamesCamelCase/InputPackageNameBad.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packageNamesCamelCase/InputPackageNameBad.java index 37dcbfbaeae..ea36a96d813 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packageNamesCamelCase/InputPackageNameBad.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packageNamesCamelCase/InputPackageNameBad.java @@ -1,2 +1,5 @@ -package com.google.checkstyle.test.chapter5naming.rule521packageNamesCamelCase; //warn +package com.google.checkstyle.test.chapter5naming.rule521packageNamesCamelCase; + +// violation 2 lines above 'Package name .* must match pattern .*' + final class InputPackageNameBad {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packagenames/InputPackageNameGood.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packagenames/InputPackageNameGood.java index 96b59c24e63..d791685ec79 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packagenames/InputPackageNameGood.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule521packagenames/InputPackageNameGood.java @@ -1,2 +1,3 @@ -package com.google.checkstyle.test.chapter5naming.rule521packagenames; //ok +package com.google.checkstyle.test.chapter5naming.rule521packagenames; // ok + final class InputPackageNameGood {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule522classnames/InputClassNames.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule522classnames/InputClassNames.java new file mode 100644 index 00000000000..271cfcbf4bb --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule522classnames/InputClassNames.java @@ -0,0 +1,88 @@ +package com.google.checkstyle.test.chapter5naming.rule522classnames; + +class inputHeaderClass { + // 2 violations above: + // 'The name of the outer type and the file do not match.' + // 'Type name 'inputHeaderClass' must match pattern' + + // violation below 'Type name 'InputHeader___Interface' .* .*' + public interface InputHeader___Interface {} + + // violation below 'Type name 'inputHeaderEnum' must match pattern' + public enum inputHeaderEnum { + one, + two + } + + class NoValid$Name {} + // violation above 'Type name 'NoValid\$Name' must match pattern' + + class $NoValidName {} + // violation above 'Type name '\$NoValidName' must match pattern' + + class NoValidName$ {} + // violation above 'Type name 'NoValidName\$' must match pattern' + + + class ValidName {} + + class _ValidName {} // violation 'Type name '_ValidName' must match pattern' + + class Valid_Name {} // violation 'Type name 'Valid_Name' must match pattern' + + class ValidName_ {} // violation 'Type name 'ValidName_' must match pattern' + + interface Foo {} + + interface _Foo {} // violation 'Type name '_Foo' must match pattern' + + interface Fo_o {} // violation 'Type name 'Fo_o' must match pattern' + + interface Foo_ {} // violation 'Type name 'Foo_' must match pattern' + + interface $Foo {} // violation 'Type name '\$Foo' must match pattern' + + interface Fo$o {} // violation 'Type name 'Fo\$o' must match pattern' + + interface Foo$ {} // violation 'Type name 'Foo\$' must match pattern' + + enum FooEnum {} + + enum _FooEnum {} // violation 'Type name '_FooEnum' must match pattern' + + enum Foo_Enum {} // violation 'Type name 'Foo_Enum' must match pattern' + + enum FooEnum_ {} // violation 'Type name 'FooEnum_' must match pattern' + + enum $FooEnum {} // violation 'Type name '\$FooEnum' must match pattern' + + enum Foo$Enum {} // violation 'Type name 'Foo\$Enum' must match pattern' + + enum FooEnum$ {} // violation 'Type name 'FooEnum\$' must match pattern' + + class aaa {} // violation 'Type name 'aaa' must match pattern' + + interface bbb {} // violation 'Type name 'bbb' must match pattern' + + enum ccc {} // violation 'Type name 'ccc' must match pattern' + + @interface Annotation {} + + @interface _Annotation {} + // violation above 'Type name '_Annotation' must match pattern' + + @interface Annot_ation {} + // violation above 'Type name 'Annot_ation' must match pattern' + + @interface Annotation_ {} + // violation above 'Type name 'Annotation_' must match pattern' + + @interface $Annotation {} + // violation above 'Type name '\$Annotation' must match pattern' + + @interface Annot$ation {} + // violation above 'Type name 'Annot\$ation' must match pattern' + + @interface Annotation$ {} + // violation above 'Type name 'Annotation\$' must match pattern' +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule522typenames/InputTypeName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule522typenames/InputTypeName.java deleted file mode 100644 index e14d08268d1..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule522typenames/InputTypeName.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.google.checkstyle.test.chapter5naming.rule522typenames; - -class inputHeaderClass { //warn - - public interface InputHeader___Interface {}; //warn - - public enum inputHeaderEnum { one, two }; //warn - - class NoValid$Name {} //warn - - class $NoValidName {} //warn - - class NoValidName$ {} //warn - -} - -class ValidName {} //ok - -class _ValidName {} //warn - -class Valid_Name {} //warn - -class ValidName_ {} //warn - -interface Foo {} // ok - -interface _Foo {} // warn - -interface Fo_o {} // warn - -interface Foo_ {} // warn - -interface $Foo {} // warn - -interface Fo$o {} // warn - -interface Foo$ {} // warn - -enum FooEnum {} //ok - -enum _FooEnum {} //warn - -enum Foo_Enum {} //warn - -enum FooEnum_ {} //warn - -enum $FooEnum {} //warn - -enum Foo$Enum {} //warn - -enum FooEnum$ {} //warn - -class aaa {} //warn - -interface bbb {} //warn - -enum ccc {} //warn - -@interface Annotation {} //ok - -@interface _Annotation {} //warn - -@interface Annot_ation {} //warn - -@interface Annotation_ {} //warn - -@interface $Annotation {} //warn - -@interface Annot$ation {} //warn - -@interface Annotation$ {} //warn diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule523methodnames/InputMethodName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule523methodnames/InputMethodName.java index 818323e1c17..9bc9ed48147 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule523methodnames/InputMethodName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule523methodnames/InputMethodName.java @@ -1,51 +1,127 @@ package com.google.checkstyle.test.chapter5naming.rule523methodnames; +import org.junit.jupiter.api.Test; + /** - * Test input for MethodNameCheck specifically - * whether the method name equals the class name. + * Test input for MethodNameCheck specifically whether the method name equals the class name. * * @author Travis Schneeberger */ public class InputMethodName { + void foo() {} + + void Foo() {} // violation 'Method name 'Foo' must match pattern' + + void fOo() {} // violation 'Method name 'fOo' must match pattern' + + void f0o() {} + + void f$o() {} // violation 'Method name 'f\$o' must match pattern' + + void f_oo() {} // violation 'Method name 'f_oo' must match pattern' + + void f() {} // violation 'Method name 'f' must match pattern' + + void fO() {} // violation 'Method name 'fO' must match pattern' + + @Test + void testing_foo() {} + + @Test + void testing_Foo() {} + + @Test + void testing_fOo() {} + + @Test + void testingFoo() {} + + @Test + void testingFoo_foo() {} + + @Test + void testing_0123() {} + + @Test + void Testing_Foo() {} // violation 'Method name 'Testing_Foo' must match pattern' + + @Test + void t_esting() {} // violation 'Method name 't_esting' must match pattern' + + @Test + void _testing() {} // violation 'Method name '_testing' must match pattern' + + void Testing_Foo2() {} // violation 'Method name 'Testing_Foo2' must match pattern' + + @Test + void TestingFooBad() {} // violation 'Method name 'TestingFooBad' must match pattern' + + class InnerFoo { void foo() {} - void Foo() {} //warn - void fOo() {} //warn + + void Foo() {} // violation 'Method name 'Foo' must match pattern' + + void fOo() {} // violation 'Method name 'fOo' must match pattern' + void f0o() {} - void f$o() {} //warn - void f_oo() {} //warn - void f() {} //warn - void fO() {} //warn - class InnerFoo { - void foo() {} - void Foo() {} //warn - void fOo() {} //warn - void f0o() {} - void f$o() {} //warn - void f_oo() {} //warn - void f() {} //warn - void fO() {} //warn - } + void f$o() {} // violation 'Method name 'f\$o' must match pattern' - InnerFoo anon = new InnerFoo() { + void f_oo() {} // violation 'Method name 'f_oo' must match pattern' + + void f() {} // violation 'Method name 'f' must match pattern' + + void fO() {} // violation 'Method name 'fO' must match pattern' + + void testing_foo() {} // violation 'Method name 'testing_foo' must match pattern' + + void testing_Foo() {} // violation 'Method name 'testing_Foo' must match pattern' + + void testing_fOo() {} // violation 'Method name 'testing_fOo' must match pattern' + + void testingFoo() {} + + void testingFoo_foo() {} // violation 'Method name 'testingFoo_foo' must match pattern' + + void testing_0123() {} // violation 'Method name 'testing_0123' must match pattern' + + void TestingFooBad() {} // violation 'Method name 'TestingFooBad' must match pattern' + } + + InnerFoo anon = + new InnerFoo() { void foo() {} - void Foo() {} //warn - void fOo() {} //warn + + void Foo() {} // violation 'Method name 'Foo' must match pattern' + + void fOo() {} // violation 'Method name 'fOo' must match pattern' + void f0o() {} - void f$o() {} //warn - void f_oo() {} //warn - void f() {} //warn - void fO() {} //warn - }; -} -interface FooIn { + void f$o() {} // violation 'Method name 'f\$o' must match pattern' + + void f_oo() {} // violation 'Method name 'f_oo' must match pattern' + + void f() {} // violation 'Method name 'f' must match pattern' + + void fO() {} // violation 'Method name 'fO' must match pattern' + }; + + interface FooIn { void foo(); - void Foo(); //warn - void fOo(); //warn + + void Foo(); // violation 'Method name 'Foo' must match pattern' + + void fOo(); // violation 'Method name 'fOo' must match pattern' + void f0o(); - void f$o(); //warn - void f_oo(); //warn - void f(); //warn - void fO(); //warn + + void f$o(); // violation 'Method name 'f\$o' must match pattern' + + void f_oo(); // violation 'Method name 'f_oo' must match pattern' + + void f(); // violation 'Method name 'f' must match pattern' + + void fO(); // violation 'Method name 'fO' must match pattern' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputMemberNameBasic.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputMemberNameBasic.java deleted file mode 100644 index 1a41e9a373c..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputMemberNameBasic.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; - -public class InputMemberNameBasic -{ - public int mPublic; //warn - protected int mProtected; //warn - int mPackage; //warn - private int mPrivate; //warn - - public int _public; //warn - protected int prot_ected; //warn - int package_; //warn - private int priva$te; //warn - - public int ppublic; //ok - protected int pprotected; //ok - int ppackage; //ok - private int pprivate; //ok - - int ABC = 0; //warn - final int C_D_E = 0; //warn - - public int $mPublic; //warn - protected int mPro$tected; //warn - int mPackage$; //warn -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputMemberNameSimple.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputMemberNameSimple.java deleted file mode 100644 index e377ef0132c..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputMemberNameSimple.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; -import java.io.*; - -final class InputMemberNameSimple -{ - - public static final int badConstant = 2; - - public static final int MAX_ROWS = 2; - - - private int bad$Static = 2; //warn - - private static int sum_Created = 0; - - - private int bad_Member = 2; //warn - - private int m = 0; //warn - - protected int m_M = 0; //warn - - - private int[] m$nts = new int[] {1,2, 3, //warn - 4}; - - - public static int sTest1; - - protected static int sTest3; - - static int sTest2; - - - int mTest1; //warn - - public int mTest2; //warn - - public int $mTest2; //warn - - public int mTes$t2; //warn - - public int mTest2$; //warn - - /** test local variables. This Check doesn't verify local variables, only members.*/ - private void localVariables() - { - int a; - int aA; - int a1_a; - int A_A; - int aa2_a; - int _a; - int _aa; - int aa_; - int aaa$aaa; - int $aaaaaa; - int aaaaaa$; - - int aa; - int aaAa1a; - int aaAaaAa2a1; - } - - interface Foo { - public void greet(); - - } - - class InnerClass - { - public static final int badConstant = 2; - - public static final int MAX_ROWS = 2; - - - private int bad$Static = 2; //warn - - private int sum_Created = 0; //warn - - - private int bad_Member = 2; //warn - - private int m = 0; //warn - - protected int m_M = 0; //warn - - - private int[] m$nts = new int[] {1,2, 3, //warn - 4}; - - - int mTest1; //warn - - public int mTest2; //warn - - public int $mTest2; //warn - - public int mTes$t2; //warn - - public int mTest2$; //warn - - void fooMethod() - { - Foo foo = new Foo() { - - int bad$Static = 2; //warn - - int sum_Created = 0; //warn - - - int bad_Member = 2; //warn - - int m = 0; //warn - - int m_M = 0; //warn - - - int[] m$nts = new int[] {1,2, 3, //warn - 4}; - - - int mTest1; //warn - - int mTest2; //warn - - int $mTest2; //warn - - int mTes$t2; //warn - - int mTest2$; //warn - - public void greet() {} - }; - } - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputNonConstantNamesBasic.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputNonConstantNamesBasic.java new file mode 100644 index 00000000000..05526d295fb --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputNonConstantNamesBasic.java @@ -0,0 +1,29 @@ +package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; + +/** some javadoc. */ +public class InputNonConstantNamesBasic { + public int mPublic; // violation 'Member name 'mPublic' must match pattern' + protected int mProtected; // violation 'Member name 'mProtected' must match pattern' + int mPackage; // violation 'Member name 'mPackage' must match pattern' + private int mPrivate; // violation 'Member name 'mPrivate' must match pattern' + + public int _public; // violation 'Member name '_public' must match pattern' + protected int prot_ected; // violation 'Member name 'prot_ected' must match pattern' + int package_; // violation 'Member name 'package_' must match pattern' + private int priva$te; // violation 'Member name 'priva\$te' must match pattern' + + public int ppublic; // ok + protected int pprotected; // ok + int ppackage; // ok + private int pprivate; // ok + + int ABC = 0; + // 2 violations above: + // 'Abbreviation in name 'ABC' must contain no more than '1' consecutive capital letters.' + // 'Member name 'ABC' must match pattern' + final int C_D_E = 0; // violation 'Member name 'C_D_E' must match pattern' + + public int $mPublic; // violation 'Member name '\$mPublic' must match pattern' + protected int mPro$tected; // violation 'Member name 'mPro\$tected' must match pattern' + int mPackage$; // violation 'Member name 'mPackage\$' must match pattern' +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputNonConstantNamesSimple.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputNonConstantNamesSimple.java new file mode 100644 index 00000000000..419059700dc --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule525nonconstantfieldnames/InputNonConstantNamesSimple.java @@ -0,0 +1,109 @@ +package com.google.checkstyle.test.chapter5naming.rule525nonconstantfieldnames; + +final class InputNonConstantNamesSimple { + + public static final int badConstant = 2; + + public static final int MAX_ROWS = 2; + + private int bad$Static = 2; // violation 'Member name 'bad\$Static' must match pattern' + + private static int sum_Created = 0; + + private int bad_Member = 2; // violation 'Member name 'bad_Member' must match pattern' + + private int m = 0; // violation 'Member name 'm' must match pattern' + + protected int m_M = 0; // violation 'Member name 'm_M' must match pattern' + + private int[] m$nts = // violation 'Member name 'm\$nts' must match pattern' + new int[] {1, 2, 3, 4}; + + public static int sTest1; + + protected static int sTest3; + + static int sTest2; + + int mTest1; // violation 'Member name 'mTest1' must match pattern' + + public int mTest2; // violation 'Member name 'mTest2' must match pattern' + + public int $mTest2; // violation 'Member name '\$mTest2' must match pattern' + + public int mTes$t2; // violation 'Member name 'mTes\$t2' must match pattern' + + private void localVariables() { + int a; + int aa; + int aaAa1a; + int aaAaaAa2a1; + } + + interface Foo { + public void greet(); + } + + class InnerClass { + public static final int badConstant = 2; + + public static final int MAX_ROWS = 2; + + private int bad$Static = 2; // violation 'Member name 'bad\$Static' must match pattern' + + private int sum_Created = 0; + // violation above 'Member name 'sum_Created' must match pattern' + + private int bad_Member = 2; // violation 'Member name 'bad_Member' must match pattern' + + private int m = 0; // violation 'Member name 'm' must match pattern' + + protected int m_M = 0; // violation 'Member name 'm_M' must match pattern' + + private int[] m$nts = new int[] {1, 2, 3, 4}; + // violation above 'Member name 'm\$nts' must match pattern' + + int mTest1; // violation 'Member name 'mTest1' must match pattern' + + public int mTest2; // violation 'Member name 'mTest2' must match pattern' + + public int $mTest2; // violation 'Member name '\$mTest2' must match pattern' + + public int mTes$t2; // violation 'Member name 'mTes\$t2' must match pattern' + + public int mTest2$; // violation 'Member name 'mTest2\$' must match pattern' + + void fooMethod() { + Foo foo = + new Foo() { + + int bad$Static = 2; // violation 'Member name 'bad\$Static' must match pattern' + + int sum_Created = 0; + // violation above 'Member name 'sum_Created' must match pattern' + + int bad_Member = 2; + // violation above 'Member name 'bad_Member' must match pattern' + + int m = 0; // violation 'Member name 'm' must match pattern' + + int m_M = 0; // violation 'Member name 'm_M' must match pattern' + + int[] m$nts = new int[] {1, 2, 3, 4}; + // violation above 'Member name 'm\$nts' must match pattern' + + int mTest1; // violation 'Member name 'mTest1' must match pattern' + + int mTest2; // violation 'Member name 'mTest2' must match pattern' + + int $mTest2; // violation 'Member name '\$mTest2' must match pattern' + + int mTes$t2; // violation 'Member name 'mTes\$t2' must match pattern' + + int mTest2$; // violation 'Member name 'mTest2\$' must match pattern' + + public void greet() {} + }; + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputCatchParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputCatchParameterName.java new file mode 100644 index 00000000000..d926df9da85 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputCatchParameterName.java @@ -0,0 +1,98 @@ +package com.google.checkstyle.test.chapter5naming.rule526parameternames; + +/** some javadoc. */ +public class InputCatchParameterName { + { + try { + /* foo */ + } catch (Exception e) { + /* foo */ + } + try { + /* foo */ + } catch (Exception ex) { + /* foo */ + } + try { + /* foo */ + } catch (Error | Exception err) { + /* foo */ + } + try { + /* foo */ + } catch (Exception exception) { + /* foo */ + } + try { + /* foo */ + } catch (Exception exception1) { + /* foo */ + } + try { + /* foo */ + } catch (Exception noWorries) { + /* foo */ + } + try { + /* foo */ + } catch (Throwable t) { + /* foo */ + } + try { + throw new InterruptedException("interruptedException"); + } catch (InterruptedException ie) { + /* foo */ + } + try { + /* foo */ + } catch (Exception ok) { + // appropriate to take no action here + } + try { + /* foo */ + } catch (Exception e1) { + try { + /* foo */ + } catch (Exception e2) { + /* foo */ + } + } + try { + /* foo */ + } catch (Throwable t1) { + try { + /* foo */ + } catch (Throwable t2) { + /* foo */ + } + } + try { + /* foo */ + } catch (Exception iException) { + // violation above 'Catch parameter name 'iException' must match pattern' + } + try { + /* foo */ + } catch (Exception ex_1) { // violation 'Catch parameter name 'ex_1' must match pattern' + } + try { + /* foo */ + } catch (Exception eX) { // violation 'Catch parameter name 'eX' must match pattern' + } + try { + /* foo */ + } catch (Exception eXX) { + // 2 violations above: + // 'Abbreviation in name 'eXX' must contain no more than '1' consecutive capital letters.' + // 'Catch parameter name 'eXX' must match pattern' + } + try { + /* foo */ + } catch (Exception x_y_z) { // violation 'Catch parameter name 'x_y_z' must match pattern' + } + try { + /* foo */ + } catch (Exception Ex) { // violation 'Catch parameter name 'Ex' must match pattern' + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputLambdaParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputLambdaParameterName.java index f440cbba237..c4b7cb22ab8 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputLambdaParameterName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputLambdaParameterName.java @@ -3,26 +3,29 @@ import java.util.function.BiFunction; import java.util.function.Function; +/** some javadoc. */ public class InputLambdaParameterName { - Function badNamedParameterWithoutParenthesis = - S -> S.trim().toLowerCase(); // warn + Function badNamedParameterWithoutParenthesis = + S -> S.trim().toLowerCase(); // violation 'Lambda parameter name 'S' must match pattern' - Function badNamedParameterWithParenthesis = - (sT) -> sT.trim().toLowerCase(); // warn + Function badNamedParameterWithParenthesis = (sT) -> sT.trim().toLowerCase(); + // violation above 'Lambda parameter name 'sT' must match pattern' - BiFunction twoBadNamedParameters = (sT1, sT2) -> sT1 + sT2; // warn + BiFunction twoBadNamedParameters = (sT1, sT2) -> sT1 + sT2; + // 2 violations above: + // 'Lambda parameter name 'sT1' must match pattern' + // 'Lambda parameter name 'sT2' must match pattern' - BiFunction badNamedParameterInBiFunction = - (first, _s) -> first + _s; // warn + BiFunction badNamedParameterInBiFunction = + (first, _s) -> first + _s; // violation 'Lambda parameter name '_s' must match pattern' - Function goodNamedParameterWithoutParenthesis = - notTrimmedString -> notTrimmedString.trim().length(); + Function goodNamedParameterWithoutParenthesis = + notTrimmedString -> notTrimmedString.trim().length(); - Function goodNamedParameterWithParenthesis = - (notTrimmedString) -> notTrimmedString.trim().length(); - - BiFunction goodNamedParameters = - (first, second) -> (first + second).length(); + Function goodNamedParameterWithParenthesis = + (notTrimmedString) -> notTrimmedString.trim().length(); + BiFunction goodNamedParameters = + (first, second) -> (first + second).length(); } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputParameterName.java index 6a9329f3a8f..c00ee404dba 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputParameterName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule526parameternames/InputParameterName.java @@ -1,75 +1,61 @@ package com.google.checkstyle.test.chapter5naming.rule526parameternames; -import java.io.*; - -class InputParameterName -{ - - /** Some more Javadoc. */ - public void doSomething(int aaa, int abn, String aaA, - boolean bB) //warn - { - for (Object O : new java.util.ArrayList()) - { - - } - } -} - - -/** Test enum for member naming check */ -enum MyEnum1 -{ - /** ABC constant */ +class InputParameterName { + + /** Some more Javadoc. */ + public void doSomething( + int aaa, + int abn, + String aaA, + boolean bB) { // violation 'Parameter name 'bB' must match pattern' + for (Object obj : new java.util.ArrayList()) {} + } + + /** Test enum for member naming check. */ + enum MyEnum1 { + /** ABC constant. */ ABC, - /** XYZ constant */ + /** XYZ constant. */ XYZ; - /** Should be mSomeMember */ + /** Should be mSomeMember. */ private int someMember; - public void doEnum(int aaaL, - long llll_llll, //warn - boolean bB) {} //warn -} + public void doEnum( + int aaaL, + long llll_llll, // violation 'Parameter name 'llll_llll' must match pattern' + boolean bB) {} // violation 'Parameter name 'bB' must match pattern' + } -/** Test public vs private method parameter naming check. */ -class InputParameterNameSimplePub -{ - /** Valid: public and more than one char Long */ - public void a(int par, int parA) {} + /** Test public vs private method parameter naming check. */ + class InputParameterNameSimplePub { + public void testing0(int par, int parA) {} - /** Invalid: public and one char long */ - public void b(int p) {} + public void testing1(int p) {} - /** Valid: private and one char long. */ - private void c(int p) {} - - /** Holder for inner anonymous classes */ - private void d(int param) { - new Object() { - /** Invalid: public and one char long. */ - public void e(int p) { } - }; + /** Holder for inner anonymous classes. */ + private void testing2(int param) { + new Object() { + public void testing3(int p) {} + }; } - /** Invalid: public constructor and one char long */ - public InputParameterNameSimplePub(int p) { } + /** Invalid: public constructor and one char long. */ + public InputParameterNameSimplePub(int p) {} - /** Valid: private constructor and one char long */ - private InputParameterNameSimplePub(float p) { } + /** Valid: private constructor and one char long. */ + private InputParameterNameSimplePub(float p) {} void toManyArgs( - int $arg1, //warn - int ar$g2, //warn - int arg3$, //warn - int a_rg4, //warn - int _arg5, //warn - int arg6_, //warn - int aArg7, //warn - int aArg8, //warn - int aar_g) //warn - - {} + int $arg1, // violation 'Parameter name .* must match pattern' + int ar$g2, // violation 'Parameter name .* must match pattern' + int arg3$, // violation 'Parameter name .* must match pattern' + int a_rg4, // violation 'Parameter name 'a_rg4' must match pattern' + int _arg5, // violation 'Parameter name '_arg5' must match pattern' + int arg6_, // violation 'Parameter name 'arg6_' must match pattern' + int aArg7, // violation 'Parameter name 'aArg7' must match pattern' + int aArg8, // violation 'Parameter name 'aArg8' must match pattern' + int aar_g) {} // violation 'Parameter name 'aar_g' must match pattern' + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameOneCharVarName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameOneCharVarName.java index 495ced31403..0aac9a84cf5 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameOneCharVarName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameOneCharVarName.java @@ -1,65 +1,66 @@ package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; -import java.io.*; import java.util.HashMap; import java.util.Map; -class InputLocalVariableNameOneCharVarName -{ - public void fooMethod() - { - for(int i = 1; i <10; i++) { //ok - //some code - } +class InputLocalVariableNameOneCharVarName { + /** some javadoc. */ + public void fooMethod() { + for (int i = 1; i < 10; i++) { + // some code + } - int i = 0; // ok + for (int index = 1; index < 10; index++) { + // some code + } - for(int index = 1; index < 10; index++) { //ok - //some code - } + for (int I_ndex = 1; I_ndex < 10; I_ndex++) { + // violation above 'Local variable name 'I_ndex' must match pattern' + // some code + } - for(int I_ndex = 1; I_ndex < 10; I_ndex++) { //warn - //some code - } + int index = 1; - int index = 1; + for (; index < 10; index++) { + // some code + } - for(; index < 10; index++) { //ok - //some code - } + int i = 0; - for(; i < 12; i++) { //ok - //some code - } + for (; i < 12; i++) { + // some code + } - Map map = new HashMap(); + Map map = new HashMap(); - for (Map.Entry e : map.entrySet()) { //ok - //some code - } + for (Map.Entry e : map.entrySet()) { + // some code + } - for (int a = 0, b[] = { 1 }, c[][] = { { 1 }, { 2 } }; a < 10; a++) { //ok - // something - } + int[] b = {1}; + int[][] c = {{1}, {2}}; + for (int a = 0; a < 10; a++) { + // something + } - for(int i_ndex = 1; i_ndex < 10; i_ndex++) { //warn - //some code - } + for (int i_ndex = 1; i_ndex < 10; i_ndex++) { + // violation above 'Local variable name 'i_ndex' must match pattern' + } - for(int ii_i1 = 1; ii_i1 < 10; ii_i1++) { //warn - //some code - } + for (int ii_i1 = 1; ii_i1 < 10; ii_i1++) { + // violation above 'Local variable name 'ii_i1' must match pattern' + } - for(int $index = 1; $index < 10; $index++) { //warn - //some code - } + for (int $index = 1; $index < 10; $index++) { + // violation above 'Local variable name .* must match pattern' + } - for(int in$dex = 1; in$dex < 10; in$dex++) { //warn - //some code - } + for (int in$dex = 1; in$dex < 10; in$dex++) { + // violation above 'Local variable name .* must match pattern' + } - for(int index$ = 1; index$ < 10; index$++) { //warn - //some code - } + for (int index$ = 1; index$ < 10; index$++) { + // violation above 'Local variable name .* must match pattern' } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameSimple.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameSimple.java index fb1440cdb58..a4cc7681b10 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameSimple.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule527localvariablenames/InputLocalVariableNameSimple.java @@ -1,43 +1,40 @@ package com.google.checkstyle.test.chapter5naming.rule527localvariablenames; -final class InputLocalVariableNameSimple -{ - public static final int badConstant = 2; - - public static final int MAX_ROWS = 2; - - private static int badStatic = 2; - - private static int sNumCreated = 0; - - private int badMember = 2; - - private int mNumCreated1 = 0; - - protected int mNumCreated2 = 0; - - private int[] mInts = new int[] {1,2, 3, - 4}; - - /** test local variables */ - private void localVariables() - { - //bad examples - int a; - int aA; //warn - int a1_a; //warn - int A_A; //warn - int aa2_a; //warn - int _a; //warn - int _aa; //warn - int aa_; //warn - int aaa$aaa; //warn - int $aaaaaa; //warn - int aaaaaa$; //warn - - //good examples - int aa; - int aaAa1a; - int aaAaaAa2a1; - } +final class InputLocalVariableNameSimple { + public static final int badConstant = 2; + + public static final int MAX_ROWS = 2; + + private static int badStatic = 2; + + private static int sNumCreated = 0; + + private int badMember = 2; + + private int numCreated1 = 0; + + protected int numCreated2 = 0; + + private int[] ints = new int[] {1, 2, 3, 4}; + + /** test local variables. */ + private void localVariables() { + // bad examples + int a; + int aA; // violation 'Local variable name 'aA' must match pattern' + int a1_a; // violation 'Local variable name 'a1_a' must match pattern' + int A_A; // violation 'Local variable name 'A_A' must match pattern' + int aa2_a; // violation 'Local variable name 'aa2_a' must match pattern' + int _a; // violation 'Local variable name '_a' must match pattern' + int _aa; // violation 'Local variable name '_aa' must match pattern' + int aa_; // violation 'Local variable name 'aa_' must match pattern' + int aaa$aaa; // violation 'Local variable name .* must match pattern' + int $aaaaaa; // violation 'Local variable name .* must match pattern' + int aaaaaa$; // violation 'Local variable name .* must match pattern' + + // good examples + int aa; + int aaAa1a; + int aaAaaAa2a1; + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputClassTypeParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputClassTypeParameterName.java index 923ef250013..fb4ba949dbc 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputClassTypeParameterName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputClassTypeParameterName.java @@ -2,45 +2,44 @@ import java.io.Serializable; -class InputClassTypeParameterName //warn -{ - public void foo() { } +class InputClassTypeParameterName { // violation 'Class type name 't' must match pattern' + public void foo() {} - void foo(int i) { - } + void foo(int i) {} } -class Other { //warn +// violation below 'Top-level class Other has to reside in its own source file.' +class Other { + // violation above 'Class type name 'foo' must match pattern' - foo getOne() { + foo getOne() { return null; - } + } - Tfo$o2T getTwo(Tfo$o2T a) { + T getTwo(T a) { return null; - } + } - foo getShadow() { + foo getShadow() { return null; - } + } - static class Junk <$foo> { //warn - <_abc extends $foo> void getMoreFoo() { - } - } + static class Junk<$foo> { // violation 'Class type name '\$foo' must match pattern' + void getMoreFoo() {} + } } -class MoreOther { +// violation below 'Top-level class MoreOther has to reside in its own source file.' +class MoreOther { - void getMore() { - new Other() { - void getMoreFoo() { - } + void getMore() { + new Other() { + void getMoreFoo() {} }; - Other o = new Other() { - void getMoreFoo() { - } + Other o = + new Other() { + void getMoreFoo() {} }; - } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputInterfaceTypeParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputInterfaceTypeParameterName.java index 07969354b28..038c583df95 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputInterfaceTypeParameterName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputInterfaceTypeParameterName.java @@ -2,85 +2,96 @@ import java.io.Serializable; -public class InputInterfaceTypeParameterName -{ - public void foo() { } +/** some javadoc. */ +public class InputInterfaceTypeParameterName { + public void foo() {} - void foo(int i) { - } + void foo(int i) {} } -class OtherClass { +// violation below 'Top-level class OtherClass has to reside in its own source file.' +class OtherClass { - foo getOne() { - return null;//comment - } + T getOne() { + return null; // comment + } - /*comment*/Tfo$o2T getTwo(Tfo$o2T a) { - return null; - } + /*comment*/ X getTwo(X a) { + return null; + } - foo getShadow() { - return null; - } + E getShadow() { + return null; + } - static class Junk { - <_fo extends foo> void getMoreFoo() { - } - } + static class Junk { + void getMoreFoo() {} + } } -class MoreOtherClass { +// violation below 'Top-level class MoreOtherClass has to reside in its own source file.' +class MoreOtherClass { - void getMore() { - new Other() { - void getMoreFoo() { - } - }; + void getMore() { + new Other() { + void getMoreFoo() {} + }; -// Other o = new Other() { -// void getMoreFoo() { -// } -// }; - } + // Other o = new Other() { + // void getMoreFoo() { + // } + // }; + } } -interface Boo { // warn - Input boo(); +// violation below 'Top-level class Boo has to reside in its own source file.' +interface Boo { // violation 'Interface type name 'Input' must match pattern' + Input boo(); } +// violation below 'Top-level class FooInterface has to reside in its own source file.' interface FooInterface { - T foo(); + T foo(); } +// violation below 'Top-level class FooInterface2 has to reside in its own source file.' interface FooInterface2 { - Input foo(); + Input foo(); } +// violation below 'Top-level class FooInterface3 has to reside in its own source file.' interface FooInterface3 { - Input foo(); + Input foo(); } +// violation below 'Top-level class FooInterface4 has to reside in its own source file.' interface FooInterface4 { - Input foo(); + Input foo(); } +// violation below 'Top-level class FooInterface5 has to reside in its own source file.' interface FooInterface5 { - Input foo(); + Input foo(); } +// violation below 'Top-level class FooInterface6 has to reside in its own source file.' interface FooInterface6 { - Input foo(); + Input foo(); } -interface FooInterface7 { // warn - Input foo(); +interface FooInterface7 { + // 2 violations above: + // 'Top-level class FooInterface7 has to reside in its own source file.' + // 'Interface type name 'Request' must match pattern' + Input foo(); } -interface FooInterface8 { // warn - Input foo(); +interface FooInterface8 { + // 2 violations above: + // 'Top-level class FooInterface8 has to reside in its own source file.' + // 'Interface type name 'TRequest' must match pattern' + Input foo(); } -class Input { - -} +// violation below 'Top-level class Input has to reside in its own source file.' +class Input {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputMethodTypeParameterName.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputMethodTypeParameterName.java index a665db6e9a2..12a3a810547 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputMethodTypeParameterName.java +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule528typevariablenames/InputMethodTypeParameterName.java @@ -2,45 +2,50 @@ import java.io.Serializable; -class InputMethodTypeParameterName -{ - public void foo() { } +class InputMethodTypeParameterName { + public void foo() {} - void foo(int i) { //warn - } + void foo(int i) { // violation 'Method type name 'e_e' must match pattern' + } } -class Other2 { +// violation below 'Top-level class Other2 has to reside in its own source file.' +class Other2 { - foo getOne() { + T getOne() { return null; - } + } - Tfo$o2T getTwo(Tfo$o2T a) { //warn + Tfo$o2T getTwo(Tfo$o2T a) { + // violation above 'Method type name 'Tfo\$o2T' must match pattern' return null; - } + } - foo getShadow() { //warn + T getShadow() { + // violation above 'Method type name 'foo_' must match pattern' return null; - } + } - static class Junk <$foo> { - <_abc extends $foo> void getMoreFoo() { //warn - } + static class Junk { + <_abc extends E> void getMoreFoo() { + // violation above 'Method type name '_abc' must match pattern' } + } } -class MoreOther3 { +// violation below 'Top-level class MoreOther3 has to reside in its own source file.' +class MoreOther3 { - void getMore() { - new Other2() { - void getMoreFoo() { //warn - } + void getMore() { + new Other2() { + void getMoreFoo() { // violation 'Method type name 'T\$' must match pattern' + } }; - Other2 o = new Other2() { - void getMoreFoo() { //warn - } + Other2 o = + new Other2() { + void getMoreFoo() { // violation 'Method type name 'EE' must match pattern' + } }; - } + } } diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputAbbreviationAsWordInTypeNameCheck.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputAbbreviationAsWordInTypeNameCheck.java deleted file mode 100644 index 6727cad8a2b..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputAbbreviationAsWordInTypeNameCheck.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.google.checkstyle.test.chapter5naming.rule53camelcase; - -class InputAbbreviationAsWordInTypeNameCheck { - - int newCustomerId; - - String innerStopwatch; - - boolean supportsIpv6OnIos; - - void XmlHttpRequest() {} - - void YouTubeImporter() {} - - void YoutubeImporter() {} - - class InnerGood { - - int newCustomerId; - - String innerStopwatch; - - boolean supportsIpv6OnIos; - - void XmlHttpRequest() {} - - void YouTubeImporter() {} - - void YoutubeImporter() {} - } - - InputAbbreviationAsWordInTypeNameCheck anonymousGood - = new InputAbbreviationAsWordInTypeNameCheck() { - - int newCustomerId; - - String innerStopwatch; - - boolean supportsIpv6OnIos; - - void XmlHttpRequest() {} - - void YouTubeImporter() {} - - void YoutubeImporter() {} - }; -} - -class AbbreviationsIncorrect { - - int newCustomerID; // warn - - boolean supportsIPv6OnIOS; //warn - - void XMLHTTPRequest() {} //warn - - class InnerBad { - - int newCustomerID; // warn - - boolean supportsIPv6OnIOS; //warn - - void XMLHTTPRequest() {} //warn - } - - InputAbbreviationAsWordInTypeNameCheck anonymousBad - = new InputAbbreviationAsWordInTypeNameCheck() { - - int newCustomerID; // warn - - boolean supportsIPv6OnIOS; //warn - - void XMLHTTPRequest() {} //warn - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseDefined.java b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseDefined.java new file mode 100644 index 00000000000..0d87bd88603 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter5naming/rule53camelcase/InputCamelCaseDefined.java @@ -0,0 +1,99 @@ +package com.google.checkstyle.test.chapter5naming.rule53camelcase; + +class InputCamelCaseDefined { + + int newCustomerId; + + String innerStopwatch; + + boolean supportsIpv6OnIos; + + void XmlHttpRequest() {} + // violation above 'Method name 'XmlHttpRequest' must match pattern' + + void YouTubeImporter() {} + // violation above 'Method name 'YouTubeImporter' must match pattern' + + void YoutubeImporter() {} + // violation above 'Method name 'YoutubeImporter' must match pattern' + + class InnerGood { + + int newCustomerId; + + String innerStopwatch; + + boolean supportsIpv6OnIos; + + void XmlHttpRequest() {} + // violation above 'Method name 'XmlHttpRequest' must match pattern' + + void YouTubeImporter() {} + // violation above 'Method name 'YouTubeImporter' must match pattern' + + void YoutubeImporter() {} + // violation above 'Method name 'YoutubeImporter' must match pattern' + } + + InputCamelCaseDefined anonymousGood = + new InputCamelCaseDefined() { + + int newCustomerId; + + String innerStopwatch; + + boolean supportsIpv6OnIos; + + void XmlHttpRequest() {} + // violation above 'Method name 'XmlHttpRequest' must match pattern' + + void YouTubeImporter() {} + // violation above 'Method name 'YouTubeImporter' must match pattern' + + void YoutubeImporter() {} + // violation above 'Method name 'YoutubeImporter' must match pattern' + }; + + class AbbreviationsIncorrect { + + int newCustomerID; + // violation above 'newCustomerID.* more than '1' .* capital letters.' + + boolean supportsIPv6OnIOS; + // violation above 'supportsIPv6OnIOS.* more than '1' .* capital letters.' + + void XMLHTTPRequest() {} + // 2 violations above: + // 'XMLHTTPRequest.* more than '1' .* capital letters.' + // 'Method name 'XMLHTTPRequest' must match pattern' + + class InnerBad { + + int newCustomerID; + // violation above 'newCustomerID.* more than '1' .* capital letters.' + + boolean supportsIPv6OnIOS; + // violation above 'supportsIPv6OnIOS.* more than '1' .* capital letters.' + + void XMLHTTPRequest() {} + // 2 violations above: + // 'XMLHTTPRequest.* more than '1' .* capital letters.' + // 'Method name 'XMLHTTPRequest' must match pattern' + } + + InputCamelCaseDefined anonymousBad = + new InputCamelCaseDefined() { + + int newCustomerID; + // violation above 'newCustomerID.* more than '1' .* capital letters.' + + boolean supportsIPv6OnIOS; + // violation above 'supportsIPv6OnIOS.* more than '1' .* capital letters.' + + void XMLHTTPRequest() {} + // 2 violations above: + // 'XMLHTTPRequest.* more than '1' .* capital letters.' + // 'Method name 'XMLHTTPRequest' must match pattern' + }; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/InputEmptyBlockCatch.java b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/InputEmptyBlockCatch.java deleted file mode 100644 index 2ef5e009a21..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/InputEmptyBlockCatch.java +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////// -// Test case file for checkstyle. -// Created: 2001 -/////////////////////////////////////////////////////////////////////////////////////////////// -package com.google.checkstyle.test.chapter6programpractice.rule62donotignoreexceptions; - -import java.io.*; -import java.awt.Dimension; -import java.awt.Color; - -class InputEmptyBlockCatch { - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} - finally {} //warn - } - - class Inner { - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} - finally {} //warn - } - } - - Inner anon = new Inner(){ - boolean flag; - void doSm() {} - void foo() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) { /* ignore */ } //ok - finally {/* ignore */} //ok - } - - void foo2() { - try { - if (!flag) { - doSm(); - } - } catch (Exception e) {} - finally {} //warn - } - }; - - void bar1() { - try { - if(!flag) { - doSm(); - } - } catch (Exception expected) {} - } - - void bar2() { - try { - if(!flag) { - doSm(); - } - } catch (Exception expected) {} - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/InputEmptyFinallyBlock.java b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/InputEmptyFinallyBlock.java new file mode 100644 index 00000000000..7ba9a0c8d3f --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule62donotignoreexceptions/InputEmptyFinallyBlock.java @@ -0,0 +1,112 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// Test case file for checkstyle. +// Created: 2001 +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.google.checkstyle.test.chapter6programpractice.rule62donotignoreexceptions; + +class InputEmptyFinallyBlock { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { // ok + /* ignore */ + } // ok + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { + } // violation above 'Empty finally block.' + } + + class Inner { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { // ok + /* ignore */ + } // ok + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { + } // violation above 'Empty finally block.' + } + } + + Inner anon = + new Inner() { + boolean flag; + + void doSm() {} + + void foo() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { // ok + /* ignore */ + } // ok + } + + void foo2() { + try { + if (!flag) { + doSm(); + } + } catch (Exception e) { + /* ignore */ + } finally { + } // violation above 'Empty finally block.' + } + }; + + void bar1() { + try { + if (!flag) { + doSm(); + } + } catch (Exception expected) { + } + } + + void bar2() { + try { + if (!flag) { + doSm(); + } + } catch (Exception expected) { + } + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java index 43a0ae8b569..ea00b49a6ce 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java +++ b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizeExtend.java @@ -2,136 +2,146 @@ class InputNoFinalizeExtend { - public static void doStuff() { - // This method do some stuff - } + public static void doStuff() { + // This method do some stuff + } - protected void finalize() throws Throwable { //warn - try { - doStuff(); - } finally { - super.finalize(); - } + protected void finalize() throws Throwable { // violation 'Avoid using finalizer method.' + try { + doStuff(); + } finally { + super.finalize(); } + } } // negates effect of superclass finalizer +// violation below 'Top-level class EmptyFinalizer has to reside in its own source file.' class EmptyFinalizer { - protected void finalize() throws Throwable { //warn - // empty finalize () - } + protected void finalize() throws Throwable { // violation 'Avoid using finalizer method.' + // empty finalize () + } } // fails to call superclass finalize method +// violation below 'Top-level class WithoutTryCatchFinalizer has to reside in its own source file.' class WithoutTryCatchFinalizer { - public static void doStuff() { - // This method do some stuff - } + public static void doStuff() { + // This method do some stuff + } - protected void finalize() throws Throwable { //warn - doStuff(); - } + protected void finalize() throws Throwable { // violation 'Avoid using finalizer method.' + doStuff(); + } } // public finalizer +// violation below 'Top-level class InputPublicFinalizer has to reside in its own source file.' class InputPublicFinalizer { - public static void doStuff() { - // This method do some stuff - } + public static void doStuff() { + // This method do some stuff + } - public void finalize() throws Throwable { //warn - try { - doStuff(); - } finally { - super.finalize(); - } + public void finalize() throws Throwable { // violation 'Avoid using finalizer method.' + try { + doStuff(); + } finally { + super.finalize(); } + } } // unless (or worse) finalizer +// violation below 'Top-level class InputSuperFinalizer has to reside in its own source file.' class InputSuperFinalizer { - protected void finalize() throws Throwable { //warn - super.finalize(); - } + protected void finalize() throws Throwable { // violation 'Avoid using finalizer method.' + super.finalize(); + } } // public finalizer +// violation below 'Top-level class InputStaticFinalizer has to reside in its own source file.' class InputStaticFinalizer { - public static void doStuff() { - // This method do some stuff - } - - protected void finalize() { //warn - try { - doStuff(); - } finally { + public static void doStuff() { + // This method do some stuff + } - } + protected void finalize() { // violation 'Avoid using finalizer method.' + try { + doStuff(); + } finally { + // do nothing } + } - class InnerFinalizer { - - protected void finalize() { //warn - try { - doStuff(); - } finally { + class InnerFinalizer { - } - } + protected void finalize() { // violation 'Avoid using finalizer method.' + try { + doStuff(); + } finally { + // do nothing + } } + } } +// violation below 'Top-level class WithoutFinalize has to reside in its own source file.' class WithoutFinalize { - public void doStuff() { - // This method do some stuff - } + public void doStuff() { + // This method do some stuff + } - public void finalizeMe() { - // This method do some stuff - } + public void finalizeMe() { + // This method do some stuff + } - public void doFinalize() { - // This method do some stuff - } + public void doFinalize() { + // This method do some stuff + } } +// violation below 'Top-level class WithoutMethods has to reside in its own source file.' class WithoutMethods {} +// violation below 'Top-level class WithAnonymousClass has to reside in its own source file.' class WithAnonymousClass { - public static void doStuff() { - // This method do some stuff - } - - public void foo() { + public static void doStuff() { + // This method do some stuff + } - Ball b = new Ball() { + public void foo() { - public void hit() { - System.identityHashCode("You hit it!"); - } + Ball b = + new Ball() { - protected void finalize() { //warn - try { - doStuff(); - } finally { + public void hit() { + System.identityHashCode("You hit it!"); + } - } + protected void finalize() { // violation 'Avoid using finalizer method.' + try { + doStuff(); + } finally { + // do nothing } + } }; - b.hit(); - } + b.hit(); + } - interface Ball { - void hit(); - } + interface Ball { + void hit(); + } } +// violation below 'Top-level class WithFinalizer has to reside in its own source file.' interface WithFinalizer { - void finalize(); //warn + void finalize(); // violation 'Avoid using finalizer method.' } diff --git a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizer.java b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizer.java index 21b0ada0083..c3889ada222 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizer.java +++ b/src/it/resources/com/google/checkstyle/test/chapter6programpractice/rule64finalizers/InputNoFinalizer.java @@ -1,27 +1,25 @@ package com.google.checkstyle.test.chapter6programpractice.rule64finalizers; -public class InputNoFinalizer -{ - public void finalize() //warn - { - // It's not enough to check if the METHOD_DEF branch contains a PARAMETER_DEF, as that would - // treat this method as having a parameter. - Runnable runnable = new Runnable() { +/** Some javadoc. */ +public class InputNoFinalizer { - public void run() { - reallyFinalize("hi"); - } + /** Some javadoc. */ + public void finalize() { // violation 'Avoid using finalizer method.' + // It's not enough to check if the METHOD_DEF branch contains a PARAMETER_DEF, as that would + // treat this method as having a parameter. + Runnable runnable = + new Runnable() { - // generates a PARAMETER_DEF AST inside the METHOD_DEF of finalize() - private void reallyFinalize(String s) - { - } + public void run() { + reallyFinalize("hi"); + } + + // generates a PARAMETER_DEF AST inside the METHOD_DEF of finalize() + private void reallyFinalize(String s) {} }; - runnable.run(); - } + runnable.run(); + } - // should not be reported by NoFinalizer check - public void finalize(String x) - { - } + // should not be reported by NoFinalizer check + public void finalize(String x) {} } diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputInvalidJavadocPosition.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputInvalidJavadocPosition.java deleted file mode 100644 index 0418ae8cc47..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputInvalidJavadocPosition.java +++ /dev/null @@ -1,54 +0,0 @@ -package /** warn */ com.google.checkstyle.test.chapter7javadoc.rule711generalform; - -/** warn */ -import java.lang.String; - -/** warn */ -/** valid */ -class InputInvalidJavadocPosition { - /** warn */ -} -/** valid */ -/* ignore */ -class InputInvalidJavadocPosition2 { - /** warn */ - static { /* ignore */ } - - /** warn */ - /** valid */ - int field1; - /** valid */ - int[] field2; - /** valid */ - public int[] field3; - /** valid */ - @Deprecated int field4; - - int /** warn */ field20; - int field21 /** warn */; - @Deprecated /** warn */ int field22; - - void method1() {} - /** valid */ - void method2() {} - /** valid */ - T method3() { return null; } - /** valid */ - String[] method4() { return null; } - - void /** warn */ method20() {} - void method21 /** warn */ () {} - void method22(/** warn */) {} - void method23() /** warn */ {} - void method24() { /** warn */ } - void method25() { /** warn */ int variable; } -} -@Deprecated -/** warn */ -class InputInvalidJavadocPosition3 {} -/** valid */ -@Deprecated -class InputInvalidJavadocPosition4 {} -class /** warn */ InputInvalidJavadocPosition5 {} -class InputInvalidJavadocPosition6 /** warn */ {} -/** warn */ diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputSingleLineJavadocAndInvalidJavadocPosition.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputSingleLineJavadocAndInvalidJavadocPosition.java new file mode 100644 index 00000000000..9049b6bad2d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputSingleLineJavadocAndInvalidJavadocPosition.java @@ -0,0 +1,192 @@ +package // violation 'package statement should not be line-wrapped.' + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + com.google.checkstyle.test.chapter7javadoc.rule711generalform; + +/** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' +import java.lang.String; + +/** some javadoc. */ +public class InputSingleLineJavadocAndInvalidJavadocPosition { + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ + void foo1() {} + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ + void foo2() {} + + /** @throws CheckstyleException if a problem occurs */ + // 3 violations above: + // 'Javadoc tag '@throws' should be preceded with an empty line.' + // 'Single-line Javadoc comment should be multi-line.' + // 'Summary javadoc is missing.' + void foo3() {} + + /** + * summary. + * + * @throws CheckstyleException if a problem occurs + */ + void foo4() {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** An especially short bit of Javadoc. */ + void foo6() {} + + /** @inheritDoc */ + // 3 violations above: + // 'Javadoc tag '@inheritDoc' should be preceded with an empty line.' + // 'Single-line Javadoc comment should be multi-line.' + // 'Summary javadoc is missing.' + void foo7() {} + + /** {@inheritDoc} */ + void foo8() {} + + /** @customTag */ + // 3 violations above: + // 'Javadoc tag '@customTag' should be preceded with an empty line.' + // 'Single-line Javadoc comment should be multi-line.' + // 'Summary javadoc is missing.' + void bar() {} + + /** + * summary. + * + *

Some header

+ * + * {@inheritDoc} {@code bar1} text + */ + void bar2() {} + + /** @customTag href="https://github.com/checkstyle/checkstyle/"text */ + // 3 violations above: + // 'Javadoc tag '@customTag' should be preceded with an empty line.' + // 'Single-line Javadoc comment should be multi-line.' + // 'Summary javadoc is missing.' + void bar3() {} + + /** Single line Javadoc that references {@link String}. */ + void bar4() {} + + /** @return in single line javadoc */ + // 3 violations above: + // 'Javadoc tag '@return' should be preceded with an empty line.' + // 'Single-line Javadoc comment should be multi-line.' + // 'Summary javadoc is missing.' + int bar5() { + return 0; + } + + /** + * summary. + * + * @return in multi line javadoc + */ + int bar6() { + return 0; + } +} + +/** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' +/** valid javadoc. */ +class InputInvalidJavadocPosition { + // violation above '.* InputInvalidJavadocPosition has to reside in its own source file.' + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' +} + +/** valid javadoc. */ +/* ignore */ +class InputInvalidJavadocPosition2 { + // violation above '.* InputInvalidJavadocPosition2 has to reside in its own source file.' + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + static { + /* ignore */ + } + + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + /** valid javadoc. */ + int field1; + + /** valid javadoc. */ + int[] field2; + + /** valid javadoc. */ + public int[] field3; + + /** valid javadoc. */ + @Deprecated int field4; + + int + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + field20; + int field21 + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + ; + @Deprecated + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + int field22; + + void method1() {} + + /** valid javadoc. */ + void method2() {} + + /** valid javadoc. */ + T method3() { + return null; + } + + /** valid javadoc. */ + String[] method4() { + return null; + } + + void + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + method20() {} + + void method21 + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + () {} // violation ''(' should be on the previous line.' + + void method22( + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + ) {} + + void method23() + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + {} + + void method24() { + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + } + + void method25() { + /** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + int variable; + } +} + +// violation below '.* InputInvalidJavadocPosition3 has to reside in its own source file.' +@Deprecated +/** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' +class InputInvalidJavadocPosition3 {} + +// violation 2 lines below '.* InputInvalidJavadocPosition4 has to reside in its own source file.' +/** valid javadoc. */ +@Deprecated +class InputInvalidJavadocPosition4 {} + +// violation below '.* InputInvalidJavadocPosition5 has to reside in its own source file.' +class +/** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' +InputInvalidJavadocPosition5 {} +// violation above ''InputInvalidJavadocPosition5' has incorrect indentation .*, expected .* 4.' + +// violation below '.* InputInvalidJavadocPosition6 has to reside in its own source file.' +class InputInvalidJavadocPosition6 +/** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' + {} // violation ''}' at column 4 should be alone on a line.' +/** invalid javadoc. */ // violation 'Javadoc comment is placed in the wrong location.' diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputSingleLineJavadocCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputSingleLineJavadocCheck.java deleted file mode 100644 index 2e9aa08fa37..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule711generalform/InputSingleLineJavadocCheck.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule711generalform; - -class InputSingleLineJavadocCheck{ - - /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} */ - void foo1() {} - - /** - * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} - */ - void foo2() {} - - /** @throws CheckstyleException if a problem occurs */ //warn - void foo3() {} - - /** - * @throws CheckstyleException if a problem occurs - */ - void foo4() {} - - /** An especially short bit of Javadoc. */ - void foo5() {} - - /** - * An especially short bit of Javadoc. - */ - void foo6() {} - - /** @inheritDoc */ //warn - void foo7() {} - - /** {@inheritDoc} */ - void foo8() {} - - /** @customTag */ //warn - void bar() {} - - /**

Some header

{@inheritDoc} {@code bar1} text*/ - void bar2() {} - - /** @customTag href="https://github.com/checkstyle/checkstyle/" text*/ //warn - void bar3() {} - - /** Single line Javadoc that references {@link String}. */ - void bar4() {} -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectJavadocParagraph.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectJavadocParagraph.java new file mode 100644 index 00000000000..109e565ddb6 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectJavadocParagraph.java @@ -0,0 +1,100 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * + *

Some Javadoc. + */ +class InputCorrectJavadocParagraph { + + /** + * Some Javadoc. + * + *

{@code function} will never be invoked with a null value. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

+   * class Foo {
+   *
+   *   void foo() {}
+   * }
+   * 
+ * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + + /** + * Some Javadoc. + * + *

Some Javadoc. + */ + class InnerInputCorrectJavaDocParagraphCheck { + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + } + + InnerInputCorrectJavaDocParagraphCheck anon = + new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

Some Javadoc. + * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectJavadocParagraphCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectJavadocParagraphCheck.java deleted file mode 100644 index 708138c0703..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectJavadocParagraphCheck.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; - -/** - * Some Javadoc. - * - *

Some Javadoc. - * - */ -class InputCorrectJavadocParagraphCheck { - - /** - * Some Javadoc. - * - *

{@code function} will never be invoked with a null value. - * - * @since 8.0 - */ - public static final byte NUL = 0; - - /** - * Some Javadoc. - * - *

Some Javadoc. - * - *

-     * class Foo {
-     *
-     *   void foo() {}
-     * }
-     * 
- * - * @see - * Documentation about GWT emulated source - */ - boolean emulated() {return false;} - - /** - * Some Javadoc. - * - *

Some Javadoc. - * - */ - class InnerInputCorrectJavaDocParagraphCheck { - - /** - * Some Javadoc. - * - *

Some Javadoc. - * - *

Some Javadoc. - * - * @since 8.0 - */ - public static final byte NUL = 0; - - /** - * Some Javadoc. - * - *

Some Javadoc. - * - * @see - * Documentation about GWT emulated source - */ - boolean emulated() {return false;} - } - - InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { - - /** - * Some Javadoc. - * - *

Some Javadoc. - * - *

Some Javadoc. - * - * @since 8.0 - */ - public static final byte NUL = 0; - - /** - * Some Javadoc. - * - *

Some Javadoc. - * - *

Some Javadoc. - * - * @see - * Documentation about GWT emulated source - */ - boolean emulated() {return false;} - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectRequireEmptyLineBeforeBlockTagGroup.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectRequireEmptyLineBeforeBlockTagGroup.java new file mode 100644 index 00000000000..080da0f38ed --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectRequireEmptyLineBeforeBlockTagGroup.java @@ -0,0 +1,38 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * + * @since 8.36 + */ +class InputCorrectRequireEmptyLineBeforeBlockTagGroup { + + /** This javadoc does not have a tag. There should be no violations. */ + public static final byte NO_TAG = 0; + + /** + * This Javadoc has one tag, with an empty line. There should be no violations. + * + * @since 8.36 + */ + public static final byte ONE_TAG = 0; + + /** + * This Javadoc has multiple tags, with an empty line before them. There should be no violations. + * + * @param input this is the first tag + * @return this is the second tag + */ + public static boolean test(boolean input) { + return false; + } + + /** + * summary. + * + * @return this only has a tag. + */ + public static boolean test() { + return false; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectRequireEmptyLineBeforeBlockTagGroupCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectRequireEmptyLineBeforeBlockTagGroupCheck.java deleted file mode 100644 index ce4a23628a3..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputCorrectRequireEmptyLineBeforeBlockTagGroupCheck.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; - -/** - * Some Javadoc. - * - * @since 8.36 - */ -class InputCorrectRequireEmptyLineBeforeBlockTagGroupCheck { - - /** - * This javadoc does not have a tag. There should be no violations. - */ - public static final byte NO_TAG = 0; - - /** - * This Javadoc has one tag, with an empty line. There should be no violations. - * - * @since 8.36 - */ - public static final byte ONE_TAG = 0; - - /** - * This Javadoc has multiple tags, with an empty line before them. There should be no - * violations. - * - * @param input this is the first tag - * @return this is the second tag - */ - public static boolean test(boolean input) { - return false; - } - - /** - * @return this only has a tag. - */ - public static boolean test() { - return false; - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedCorrectJavadocParagraph.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedCorrectJavadocParagraph.java new file mode 100644 index 00000000000..441b60e2f75 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedCorrectJavadocParagraph.java @@ -0,0 +1,100 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * + *

Some Javadoc. + */ +class InputFormattedCorrectJavadocParagraph { + + /** + * Some Javadoc. + * + *

{@code function} will never be invoked with a null value. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

+   * class Foo {
+   *
+   *   void foo() {}
+   * }
+   * 
+ * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + + /** + * Some Javadoc. + * + *

Some Javadoc. + */ + class InnerInputCorrectJavaDocParagraphCheck { + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + } + + InnerInputCorrectJavaDocParagraphCheck anon = + new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + *

Some Javadoc. + * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedCorrectRequireEmptyLineBeforeBlockTagGroup.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedCorrectRequireEmptyLineBeforeBlockTagGroup.java new file mode 100644 index 00000000000..3eeeccbb25b --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedCorrectRequireEmptyLineBeforeBlockTagGroup.java @@ -0,0 +1,38 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * + * @since 8.36 + */ +class InputFormattedCorrectRequireEmptyLineBeforeBlockTagGroup { + + /** This javadoc does not have a tag. There should be no violations. */ + public static final byte NO_TAG = 0; + + /** + * This Javadoc has one tag, with an empty line. There should be no violations. + * + * @since 8.36 + */ + public static final byte ONE_TAG = 0; + + /** + * This Javadoc has multiple tags, with an empty line before them. There should be no violations. + * + * @param input this is the first tag + * @return this is the second tag + */ + public static boolean test(boolean input) { + return false; + } + + /** + * summary. + * + * @return this only has a tag. + */ + public static boolean test() { + return false; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectJavadocParagraph.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectJavadocParagraph.java new file mode 100644 index 00000000000..da701de5496 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectJavadocParagraph.java @@ -0,0 +1,118 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * + *

/^ WARN/ Some Javadoc. + * + *

+ */ +class InputFormattedIncorrectJavadocParagraph { + // violation 3 lines above '

tag should be placed immediately before the first word' + + // violation 4 lines below '

tag should be placed immediately before the first word' + /** + * Some Javadoc. + * + *

+ * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + /** + * Some + * + *

Javadoc. + * + *

Some Javadoc. + * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + + // violation 6 lines below '

tag should be placed immediately before the first word' + // violation 7 lines below '

tag should be placed immediately before the first word' + // violation 8 lines below '

tag should be placed immediately before the first word' + /** + * Some Javadoc. + * + *

+ * + *

+ * + *

+ * + *

/^WARN/ Some Javadoc. + * + *

+ */ + class InnerInputCorrectJavaDocParagraphCheck { + // violation 3 lines above '

tag should be placed immediately before the first word' + + // violation 4 lines below '

tag should be placed immediately before the first word' + /** + * Some Javadoc. + * + *

+ * + * @since 8.0 + */ + public static final byte NUL = 0; + + // violation 8 lines below '

tag should be placed immediately before the first word' + /** + * /^WARN/ Some Javadoc. + * + *

/^WARN/ + * + *

/^WARN/ Some Javadoc. + * + *

+ * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + } + + InnerInputCorrectJavaDocParagraphCheck anon = + new InnerInputCorrectJavaDocParagraphCheck() { + + /** + * Some Javadoc. + * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + // violation 4 lines below '

tag should be placed immediately before the first word' + /** + * /WARN/ Some Javadoc. + * + *

+ * + *

Some Javadoc. + * + * @see + * Documentation about + *

GWT emulated source + */ + // violation 2 lines above '

tag should be preceded with an empty line.' + boolean emulated() { + return false; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectRequireEmptyLineBeforeBlockTagGroup.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectRequireEmptyLineBeforeBlockTagGroup.java new file mode 100644 index 00000000000..ac3d5cf1fd8 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputFormattedIncorrectRequireEmptyLineBeforeBlockTagGroup.java @@ -0,0 +1,28 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * + * @since 8.36 + */ +class InputFormattedIncorrectRequireEmptyLineBeforeBlockTagGroup { + + /** + * This documents the private method. + * + * @param thisParamTagNeedsNewline this documents the parameter. + */ + private boolean paramTagNeedsNewline(boolean thisParamTagNeedsNewline) { + return false; + } + + /** + * This documents the private method. + * + * @param thisParamTagNeedsNewline this documents the parameter. + * @return this one does not need an empty line, but the tag before this one does. + */ + private boolean paramMultiTagNeedsNewline(boolean thisParamTagNeedsNewline) { + return false; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraph.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraph.java new file mode 100644 index 00000000000..b3ca6ce4371 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraph.java @@ -0,0 +1,130 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +// 2 violations 5 lines below: +// '\ tag should be placed immediately before the first word' +// '\ tag should be preceded with an empty line.' +/** + * Some Javadoc. + *

+ * /^ WARN/ Some Javadoc.

+ */ +// 2 violations 2 lines above: +// '\ tag should be placed immediately before the first word' +// '\ tag should be preceded with an empty line.' + +class InputIncorrectJavadocParagraph { + + // 2 violations 4 lines below: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + /** + * Some Javadoc.

+ * + *

Some Javadoc. + * + * @since 8.0 + */ + // violation 4 lines above '\ tag should be placed immediately before the first word' + public static final byte NUL = 0; + + // violation 2 lines below '\ tag should be preceded with an empty line.' + /** + * Some

Javadoc. + * + *

Some Javadoc. + * + * @see + * Documentation about GWT emulated source + */ + boolean emulated() { + return false; + } + + // violation 4 lines below 'Redundant \ tag.' + // 2 violations 4 lines below: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + /**

Some Javadoc. + *

+ *

+ *

/^WARN/ Some Javadoc.

+ */ + // 2 violations 3 lines above: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + // 2 violations 5 lines above: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + class InnerInputCorrectJavaDocParagraphCheck { + + // 2 violations 4 lines below: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + /** + * Some Javadoc.

+ * + * @since 8.0 + */ + public static final byte NUL = 0; + + // 2 violations 4 lines below: + // '\ tag should be placed immediately before the first word' + // 'Redundant \ tag.' + // violation 4 lines below '\ tag should be placed immediately before the first word' + /**

+ * /^WARN/ Some Javadoc. + * + *

+ * /^WARN/ + *

+ * /^WARN/ Some Javadoc.

+ * @see + * Documentation about GWT emulated source + */ + // 2 violations 6 lines above: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + // 2 violations 8 lines above: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + // violation 10 lines above 'Javadoc tag '@see' should be preceded with an empty line.' + boolean emulated() { + return false; + } + } + + InnerInputCorrectJavaDocParagraphCheck anon = + new InnerInputCorrectJavaDocParagraphCheck() { + + // violation 2 lines below 'Redundant \ tag.' + /** + *

Some Javadoc. + * + *

Some Javadoc. + * + * @since 8.0 + */ + public static final byte NUL = 0; + + // 2 violations 5 lines below: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + // violation 4 lines below '\ tag should be placed immediately before the first word' + /** + * /WARN/ Some Javadoc.

+ * + *

Some Javadoc. + * + * @see + * Documentation about

GWT emulated source + */ + // 2 violations 2 lines above: + // '\ tag should be placed immediately before the first word' + // '\ tag should be preceded with an empty line.' + boolean emulated() { + return false; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraphCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraphCheck.java deleted file mode 100644 index 519f77e798b..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectJavadocParagraphCheck.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; - -/** - * Some Javadoc. - *

//warn - * /^ WARN/ Some Javadoc.

//warn - * - */ -class InputIncorrectJavadocParagraphCheck { - - /** - * Some Javadoc.

//warn - * - *

Some Javadoc. //warn - * - * @since 8.0 - */ - public static final byte NUL = 0; - - /** - * Some

Javadoc.//warn - * - *

Some Javadoc. - * - * @see - * Documentation about GWT emulated source - */ - boolean emulated() {return false;} - - /**

Some Javadoc. //warn - *

//warn - *

//warn - *

/^WARN/ Some Javadoc.

*/ //warn - class InnerInputCorrectJavaDocParagraphCheck { - - /** - * Some Javadoc.

//warn - * - * @since 8.0 - */ - public static final byte NUL = 0; - - /**

//warn - * /^WARN/ Some Javadoc. - * - *

//warn - * /^WARN/ - *

//warn - * /^WARN/ Some Javadoc.

//warn - * @see - * Documentation about GWT emulated source - */ - boolean emulated() {return false;} - } - - InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { - - /** - *

Some Javadoc. //warn - * - *

Some Javadoc. - * - * @since 8.0 - */ - public static final byte NUL = 0; - - /** - * /WARN/ Some Javadoc.

//warn - * - *

Some Javadoc. //warn - * - * @see - * Documentation about

GWT emulated source //warn - */ - boolean emulated() {return false;} - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroup.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroup.java new file mode 100644 index 00000000000..76d9d2c84c7 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroup.java @@ -0,0 +1,28 @@ +package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; + +/** + * Some Javadoc. + * @since 8.36 + */ +// violation 2 lines above'Javadoc tag '@since' should be preceded with an empty line.' +class InputIncorrectRequireEmptyLineBeforeBlockTagGroup { + + /** + * This documents the private method. + * @param thisParamTagNeedsNewline this documents the parameter. + */ + // violation 2 lines above 'Javadoc tag '@param' should be preceded with an empty line.' + private boolean paramTagNeedsNewline(boolean thisParamTagNeedsNewline) { + return false; + } + + /** + * This documents the private method. + * @param thisParamTagNeedsNewline this documents the parameter. + * @return this one does not need an empty line, but the tag before this one does. + */ + // violation 3 lines above 'Javadoc tag '@param' should be preceded with an empty line.' + private boolean paramMultiTagNeedsNewline(boolean thisParamTagNeedsNewline) { + return false; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroupCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroupCheck.java deleted file mode 100644 index c5195f90a1a..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule712paragraphs/InputIncorrectRequireEmptyLineBeforeBlockTagGroupCheck.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule712paragraphs; - -/** - * Some Javadoc. - * @since 8.36 //warn - */ -class InputIncorrectRequireEmptyLineBeforeBlockTagGroupCheck { - - /** - * This documents the private method. - * @param thisParamTagNeedsNewline this documents the parameter. //warn - */ - private boolean paramTagNeedsNewline(boolean thisParamTagNeedsNewline) { - return false; - } - - /** - * This documents the private method. - * @param thisParamTagNeedsNewline this documents the parameter. //warn - * @return this one does not need an empty line, but the tag before this one does. - */ - private boolean paramMultiTagNeedsNewline(boolean thisParamTagNeedsNewline) { - return false; - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck1.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck1.java index ef54c83a1fa..72addab668e 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck1.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck1.java @@ -11,101 +11,110 @@ * @since Some javadoc. * @deprecated Some javadoc. */ -class InputCorrectAtClauseOrderCheck1 implements Serializable -{ +class InputCorrectAtClauseOrderCheck1 implements Serializable { - /** - * The client's first name. - * @serial - */ - private String fFirstName; + /** + * The client's first name. + * + * @serial + */ + private String firstName; - /** - * The client's first name. - * @serial - */ - private String sSecondName; + /** + * The client's first name. + * + * @serial + */ + private String secondName; - /** - * The client's first name. - * @serialField - */ - private String tThirdName; + /** + * The client's first name. + * + * @serialField + */ + private String thirdName; + + /** + * Some text. + * + * @param str Some text. + * @return Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + * @deprecated Some text. + */ + String method(String str) throws Exception { + return "null"; + } + + /** + * Some text. + * + * @param str Some text. + * @return Some text. + * @throws Exception Some text. + * @serialData Some javadoc. + */ + String method1(String str) throws Exception { + return "null"; + } + /** + * summary. + * + * @author max + * @version 1.0 + * @since Some javadoc. + */ + class InnerClassWithAnnotations1 { /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. * @throws Exception Some text. - * @serialData Some javadoc. * @deprecated Some text. */ - String method(String aString) throws Exception { // ok - return "null"; + String method(String str) throws Exception { + return "null"; } /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. * @throws Exception Some text. * @serialData Some javadoc. */ - String method1(String aString) throws Exception { - return "null"; - } - - /** - * - * @author max - * @version 1.0 - * @since Some javadoc. - */ - class InnerClassWithAnnotations1 { - /** - * Some text. - * @param aString Some text. - * @return Some text. - * @throws Exception Some text. - * @deprecated Some text. - */ - String method(String aString) throws Exception { - return "null"; - } - - /** - * Some text. - * @param aString Some text. - * @return Some text. - * @throws Exception Some text. - * @serialData Some javadoc. - */ - String method1(String aString) throws Exception { - return "null"; - } + String method1(String str) throws Exception { + return "null"; } + } - InnerClassWithAnnotations1 anon = new InnerClassWithAnnotations1() - { + InnerClassWithAnnotations1 anon = + new InnerClassWithAnnotations1() { /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. * @throws Exception Some text. * @deprecated Some text. */ - String method(String aString) throws Exception { - return "null"; + String method(String str) throws Exception { + return "null"; } /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. * @throws Exception Some text. */ - String method1(String aString) throws Exception { - return "null"; + String method1(String str) throws Exception { + return "null"; } - }; + }; } diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck2.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck2.java index 77cb9475763..d5ffdf07ddd 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck2.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck2.java @@ -11,17 +11,52 @@ * @since Some javadoc. * @deprecated Some javadoc. */ -class InputCorrectAtClauseOrderCheck2 implements Serializable -{ +class InputCorrectAtClauseOrderCheck2 implements Serializable { + /** + * Some text. + * + * @param str Some text. + * @throws Exception Some text. + */ + void method2(String str) throws Exception {} + + /** + * Some text. + * + * @throws Exception Some text. + * @deprecated Some text. + */ + void method3() throws Exception {} + + /** + * Some text. + * + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception { + return "null"; + } + + /** + * summary. + * + * @author max + * @version 1.0 + * @since Some javadoc. + */ + class InnerClassWithAnnotations2 { /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @throws Exception Some text. */ - void method2(String aString) throws Exception {} + void method2(String str) throws Exception {} /** * Some text. + * * @throws Exception Some text. * @deprecated Some text. */ @@ -29,30 +64,30 @@ void method3() throws Exception {} /** * Some text. + * * @return Some text. * @throws Exception Some text. + * @serialData Some javadoc. */ - String method4() throws Exception { // ok - return "null"; + String method4() throws Exception { + return "null"; } + } - /** - * - * @author max - * @version 1.0 - * @since Some javadoc. - */ - class InnerClassWithAnnotations2 - { + InnerClassWithAnnotations2 anon = + new InnerClassWithAnnotations2() { /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @throws Exception Some text. + * @serialData Some javadoc. */ - void method2(String aString) throws Exception {} + void method2(String str) throws Exception {} /** * Some text. + * * @throws Exception Some text. * @deprecated Some text. */ @@ -60,60 +95,34 @@ void method3() throws Exception {} /** * Some text. + * * @return Some text. * @throws Exception Some text. - * @serialData Some javadoc. */ String method4() throws Exception { - return "null"; + return "null"; } - } + }; - InnerClassWithAnnotations2 anon = new InnerClassWithAnnotations2() - { - /** - * Some text. - * @param aString Some text. - * @throws Exception Some text. - * @serialData Some javadoc. - */ - void method2(String aString) throws Exception {} - - /** - * Some text. - * @throws Exception Some text. - * @deprecated Some text. - */ - void method3() throws Exception {} + /** + * Some javadoc. + * + * @author max + * @version 1.0 + * @see Some javadoc. + * @since Some javadoc. + * @deprecated Some javadoc. + */ + enum Foo {} - /** - * Some text. - * @return Some text. - * @throws Exception Some text. - */ - String method4() throws Exception { - return "null"; - } - }; + /** + * Some javadoc. + * + * @author max + * @version 1.0 + * @see Some javadoc. + * @since Some javadoc. + * @deprecated Some javadoc. + */ + interface FooIn {} } -/** - * Some javadoc. - * - * @author max - * @version 1.0 - * @see Some javadoc. - * @since Some javadoc. - * @deprecated Some javadoc. - */ -enum Foo {} - -/** - * Some javadoc. - * - * @author max - * @version 1.0 - * @see Some javadoc. - * @since Some javadoc. - * @deprecated Some javadoc. - */ -interface FooIn {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck3.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck3.java index f73d11edb18..7dfa91fd7e6 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck3.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputCorrectAtClauseOrderCheck3.java @@ -11,94 +11,93 @@ * @since Some javadoc. * @deprecated Some javadoc. */ -class InputCorrectAtClauseOrderCheck3 implements Serializable -{ +class InputCorrectAtClauseOrderCheck3 implements Serializable { + /** + * Some text. + * + * @param str Some text. + * @return Some text. + * @serialData Some javadoc. + * @deprecated Some text. + */ + String method5(String str) { + return "null"; + } + + /** + * Some text. + * + * @param str Some text. + * @param number Some text. + * @param bool Some text. + * @return Some text. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method6(String str, int number, boolean bool) throws Exception { + return "null"; + } + + /** + * summary. + * + * @author max + * @version 1.0 + * @since Some javadoc. + */ + class InnerClassWithAnnotations3 { /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. * @serialData Some javadoc. * @deprecated Some text. */ - String method5(String aString) - { - return "null"; + String method5(String str) { + return "null"; } /** * Some text. - * @param aString Some text. - * @param aInt Some text. - * @param aBoolean Some text. + * + * @param str Some text. + * @param number Some text. + * @param bool Some text. * @return Some text. * @throws Exception Some text. * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; - } - - /** - * - * @author max - * @version 1.0 - * @since Some javadoc. - */ - class InnerClassWithAnnotations3 - { - /** - * Some text. - * @param aString Some text. - * @return Some text. - * @serialData Some javadoc. - * @deprecated Some text. - */ - String method5(String aString) - { - return "null"; - } - - /** - * Some text. - * @param aString Some text. - * @param aInt Some text. - * @param aBoolean Some text. - * @return Some text. - * @throws Exception Some text. - * @deprecated Some text. - */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; - } + String method6(String str, int number, boolean bool) throws Exception { + return "null"; } + } - InnerClassWithAnnotations3 anon = new InnerClassWithAnnotations3() - { + InnerClassWithAnnotations3 anon = + new InnerClassWithAnnotations3() { /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. * @deprecated Some text. */ - String method5(String aString) - { - return "null"; + String method5(String str) { + return "null"; } /** * Some text. - * @param aString Some text. - * @param aInt Some text. - * @param aBoolean Some text. + * + * @param str Some text. + * @param number Some text. + * @param bool Some text. * @return Some text. * @throws Exception Some text. * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; + String method6(String str, int number, boolean bool) throws Exception { + return "null"; } - }; + }; } diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck1.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck1.java index 74f908c1070..df9ee1fa341 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck1.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck1.java @@ -11,109 +11,110 @@ * @see Some javadoc. * @author max */ -class InputIncorrectAtClauseOrderCheck1 implements Serializable -{ - /** - * The client's first name. - * @serial - */ - private String fFirstName; +class InputIncorrectAtClauseOrderCheck1 implements Serializable { + /** + * The client's first name. + * + * @serial + */ + private String firstName; - /** - * The client's first name. - * @serial - */ - private String sSecondName; + /** + * The client's first name. + * + * @serial + */ + private String secondName; - /** - * The client's first name. - * @serialField - */ - private String tThirdName; + /** + * The client's first name. + * + * @serialField + */ + private String thirdName; + + /** + * Some text. + * + * @param str Some text. + * @return Some text. + * @serialData Some javadoc. + * @deprecated Some text. + * @throws Exception Some text. // violation 'Block tags have to appear in the order .*' + */ + String method(String str) throws Exception { + return "null"; + } + /** + * Some text. + * + * @serialData Some javadoc. + * @return Some text. + * @param str Some text. // violation 'Block tags have to appear in the order .*' + * @throws Exception Some text. + */ + String method1(String str) throws Exception { + return "null"; + } + + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max + */ + class InnerClassWithAnnotations1 { /** * Some text. - * @param aString Some text. + * * @return Some text. - * @serialData Some javadoc. * @deprecated Some text. - * @throws Exception Some text. //warn + * @param str Some text. // violation 'Block tags have to appear in the order .*' + * @throws Exception Some text. // violation 'Block tags have to appear in the order .*' */ - String method(String aString) throws Exception - { - return "null"; + String method(String str) throws Exception { + return "null"; } /** * Some text. - * @serialData Some javadoc. - * @return Some text. - * @param aString Some text. //warn - * @throws Exception Some text. - */ - String method1(String aString) throws Exception - { - return "null"; - } - - /** - * Some javadoc. * - * @version 1.0 - * @since Some javadoc. - * @serialData Some javadoc. - * @author max + * @throws Exception Some text. + * @return Some text. // violation 'Block tags have to appear in the order .*' + * @param str Some text. // violation 'Block tags have to appear in the order .*' */ - class InnerClassWithAnnotations1 - { - /** - * Some text. - * @return Some text. - * @deprecated Some text. - * @param aString Some text. //warn - * @throws Exception Some text. //warn - */ - String method(String aString) throws Exception - { - return "null"; - } - - /** - * Some text. - * @throws Exception Some text. - * @return Some text. //warn - * @param aString Some text. //warn - */ - String method1(String aString) throws Exception - { - return "null"; - } + String method1(String str) throws Exception { + return "null"; } + } - InnerClassWithAnnotations1 anon = new InnerClassWithAnnotations1() - { + InnerClassWithAnnotations1 anon = + new InnerClassWithAnnotations1() { /** * Some text. + * * @throws Exception Some text. - * @param aString Some text. //warn + * @param str Some text. // violation 'Block tags have to appear in the order .*' * @serialData Some javadoc. * @deprecated Some text. - * @return Some text. //warn + * @return Some text. // violation 'Block tags have to appear in the order .*' */ - String method(String aString) throws Exception - { - return "null"; + String method(String str) throws Exception { + return "null"; } /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @throws Exception Some text. - * @return Some text. //warn + * @return Some text. // violation 'Block tags have to appear in the order .*' */ - String method1(String aString) throws Exception - { - return "null"; + String method1(String str) throws Exception { + return "null"; } - }; + }; } diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck2.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck2.java index d7b81912b33..37b6b422a33 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck2.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck2.java @@ -11,108 +11,118 @@ * @see Some javadoc. * @author max */ -class InputIncorrectAtClauseOrderCheck2 implements Serializable -{ +class InputIncorrectAtClauseOrderCheck2 implements Serializable { + /** + * Some text. + * + * @throws Exception Some text. + * @param str Some text. // violation 'Block tags have to appear in the order .*' + */ + void method2(String str) throws Exception {} + + /** + * Some text. + * + * @deprecated Some text. + * @throws Exception Some text. // violation 'Block tags have to appear in the order .*' + */ + void method3() throws Exception {} + + /** + * Some text. + * + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception { + return "null"; + } + + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max + */ + class InnerClassWithAnnotations2 { /** * Some text. + * + * @serialData Some javadoc. + * @param str Some text. * @throws Exception Some text. - * @param aString Some text. //warn */ - void method2(String aString) throws Exception {} + void method2(String str) throws Exception {} /** * Some text. + * * @deprecated Some text. - * @throws Exception Some text. //warn + * @throws Exception Some text. // violation 'Block tags have to appear in the order .*' */ void method3() throws Exception {} /** * Some text. - * @return Some text. + * * @throws Exception Some text. + * @serialData Some javadoc. + * @return Some text. // violation 'Block tags have to appear in the order .*' */ String method4() throws Exception { - return "null"; + return "null"; } + } - /** - * Some javadoc. - * - * @version 1.0 - * @since Some javadoc. - * @serialData Some javadoc. - * @author max - */ - class InnerClassWithAnnotations2 { + InnerClassWithAnnotations2 anon = + new InnerClassWithAnnotations2() { /** * Some text. - * @serialData Some javadoc. - * @param aString Some text. + * * @throws Exception Some text. + * @param str Some text. // violation 'Block tags have to appear in the order .*' */ - void method2(String aString) throws Exception {} + void method2(String str) throws Exception {} /** * Some text. + * * @deprecated Some text. - * @throws Exception Some text. //warn + * @throws Exception Some text. // violation 'Block tags have to appear in the order .*' */ void method3() throws Exception {} /** * Some text. + * * @throws Exception Some text. - * @serialData Some javadoc. - * @return Some text. //warn + * @return Some text. // violation 'Block tags have to appear in the order .*' */ String method4() throws Exception { - return "null"; + return "null"; } - } - - InnerClassWithAnnotations2 anon = new InnerClassWithAnnotations2() { - /** - * Some text. - * @throws Exception Some text. - * @param aString Some text. //warn - */ - void method2(String aString) throws Exception {} + }; - /** - * Some text. - * @deprecated Some text. - * @throws Exception Some text. //warn - */ - void method3() throws Exception {} + /** + * Some javadoc. + * + * @since Some javadoc. + * @version 1.0 + * @deprecated Some javadoc. + * @see Some javadoc. + * @author max + */ + enum Foo5 {} - /** - * Some text. - * @throws Exception Some text. - * @return Some text. //warn - */ - String method4() throws Exception { - return "null"; - } - }; + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max + */ + interface FooIn1 {} } -/** - * Some javadoc. - * - * @since Some javadoc. - * @version 1.0 - * @deprecated Some javadoc. - * @see Some javadoc. - * @author max - */ -enum Foo5 {} - -/** - * Some javadoc. - * - * @version 1.0 - * @since Some javadoc. - * @serialData Some javadoc. - * @author max - */ -interface FooIn1 {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck3.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck3.java index 7d67a290265..56099b8e7bb 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck3.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputIncorrectAtClauseOrderCheck3.java @@ -11,98 +11,96 @@ * @see Some javadoc. * @author max */ -class InputIncorrectAtClauseOrderCheck3 implements Serializable -{ +class InputIncorrectAtClauseOrderCheck3 implements Serializable { + + /** + * Some text. + * + * @deprecated Some text. + * @return Some text. // violation 'Block tags have to appear in the order .*' + * @param str Some text. // violation 'Block tags have to appear in the order .*' + */ + String method5(String str) { + return "null"; + } + + /** + * Some text. + * + * @param str Some text. + * @return Some text. + * @serialData Some javadoc. + * @param number Some text. // violation 'Block tags have to appear in the order .*' + * @throws Exception Some text. + * @param bool Some text. // violation 'Block tags have to appear in the order .*' + * @deprecated Some text. + */ + String method6(String str, int number, boolean bool) throws Exception { + return "null"; + } + + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max + */ + class InnerClassWithAnnotations3 { /** * Some text. + * + * @param str Some text. * @deprecated Some text. - * @return Some text. //warn - * @param aString Some text. //warn + * @return Some text. // violation 'Block tags have to appear in the order .*' */ - String method5(String aString) - { - return "null"; + String method5(String str) { + return "null"; } /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. - * @serialData Some javadoc. - * @param aInt Some text. //warn + * @param number Some text. // violation 'Block tags have to appear in the order .*' * @throws Exception Some text. - * @param aBoolean Some text. //warn + * @param bool Some text. // violation 'Block tags have to appear in the order .*' * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; - } - - /** - * Some javadoc. - * - * @version 1.0 - * @since Some javadoc. - * @serialData Some javadoc. - * @author max - */ - class InnerClassWithAnnotations3 - { - - /** - * Some text. - * @param aString Some text. - * @deprecated Some text. - * @return Some text. //warn - */ - String method5(String aString) - { - return "null"; - } - - /** - * Some text. - * @param aString Some text. - * @return Some text. - * @param aInt Some text. //warn - * @throws Exception Some text. - * @param aBoolean Some text. //warn - * @deprecated Some text. - */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; - } + String method6(String str, int number, boolean bool) throws Exception { + return "null"; } + } - InnerClassWithAnnotations3 anon = new InnerClassWithAnnotations3() - { + InnerClassWithAnnotations3 anon = + new InnerClassWithAnnotations3() { /** * Some text. + * * @deprecated Some text. - * @return Some text. //warn - * @param aString Some text. //warn + * @return Some text. // violation 'Block tags have to appear in the order .*' + * @param str Some text. // violation 'Block tags have to appear in the order .*' */ - String method5(String aString) - { - return "null"; + String method5(String str) { + return "null"; } /** * Some text. - * @param aString Some text. + * + * @param str Some text. * @return Some text. - * @param aInt Some text. //warn + * @param number Some text. // violation 'Block tags have to appear in the order .*' * @throws Exception Some text. - * @param aBoolean Some text. //warn + * @param bool Some text. // violation 'Block tags have to appear in the order .*' * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; + String method6(String str, int number, boolean bool) throws Exception { + return "null"; } - }; + }; } diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputJavaDocTagContinuationIndentation.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputJavaDocTagContinuationIndentation.java index 20f3ac8743f..810129958ab 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputJavaDocTagContinuationIndentation.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputJavaDocTagContinuationIndentation.java @@ -14,312 +14,326 @@ * @author max * Some javadoc. */ -class InputJavaDocTagContinuationIndentation implements Serializable -{ - /** - * The client's first name. - * @serial Some javadoc. - * Some javadoc. - */ - private String fFirstName; +class InputJavaDocTagContinuationIndentation implements Serializable { + /** + * The client's first name. + * + * @serial Some javadoc. + * Some javadoc. + */ + private String firstName; - /** - * The client's first name. - * @serial - * Some javadoc. - */ - private String sSecondName; + /** + * The client's first name. + * + * @serial + * Some javadoc. + */ + private String secondName; - /** - * The client's first name. - * @serialField - * Some javadoc. - */ - private String tThirdName; + /** + * The client's first name. + * + * @serialField + * Some javadoc. + */ + private String thirdName; + /** + * Some text. + * + * @param str Some javadoc. + * Some javadoc. + * @return Some text. + * @serialData Some javadoc. + * @throws Exception Some text. + * Some javadoc. // violation '.* incorrect indentation level, expected level should be 4.' + * @deprecated Some text. + */ + String method(String str) throws Exception { + return "null"; + } + + /** + * Some text. + * + * @serialData Some javadoc. + * @param str Some text. + * Some javadoc. + * @return Some text. + * @throws Exception Some text. + */ + String method1(String str) throws Exception { + return "null"; + } + + /** + * Some text. + * + * @param str Some text. + * Some javadoc. + * @throws Exception Some text. + */ + void method2(String str) throws Exception {} + + /** + * Some text. + * + * @throws Exception Some text. + * @deprecated Some text. + * Some javadoc. + */ + void method3() throws Exception {} + + /** + * Some text. + * + * @return Some text. + * @throws Exception Some text. + */ + String method4() throws Exception { + return "null"; + } + + /** + * Some text. + * + * @param str Some text. + * @return Some text. + * @deprecated Some text. + */ + String method5(String str) { + return "null"; + } + + /** + * Some text. + * + * @param str Some text. + * @param bool Some text. + * @param number Some text. + * Some javadoc. // violation '.* incorrect indentation level, expected level should be 4.' + * @return Some text. + * Some javadoc. // violation '.* incorrect indentation level, expected level should be 4.' + * @serialData Some javadoc. + * @throws Exception Some text. + * @deprecated Some text. + */ + String method6(String str, int number, boolean bool) throws Exception { + return "null"; + } + + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * @serialData Some javadoc. + * @author max + */ + class InnerClassWithAnnotations { /** * Some text. - * @param aString Some javadoc. - * Some javadoc. + * + * @param str Some text. * @return Some text. - * @serialData Some javadoc. - * @deprecated Some text. - * Some javadoc. // warn * @throws Exception Some text. + * Some javadoc. + * @deprecated Some text. + * Some javadoc. */ - String method(String aString) throws Exception - { - return "null"; + String method(String str) throws Exception { + return "null"; } /** * Some text. - * @serialData Some javadoc. - * @return Some text. + * + * @param str Some text. * Some javadoc. - * @param aString Some text. + * @return Some text. * @throws Exception Some text. + * Some javadoc. */ - String method1(String aString) throws Exception - { - return "null"; + String method1(String str) throws Exception { + return "null"; } /** * Some text. - * @throws Exception Some text. + * + * @serialData Some javadoc. + * Some javadoc. + * @param str Some text. * Some javadoc. - * @param aString Some text. + * @throws Exception Some text. */ - void method2(String aString) throws Exception {} + void method2(String str) throws Exception {} /** * Some text. - * @deprecated Some text. + * * @throws Exception Some text. - * Some javadoc. + * @deprecated Some text. */ void method3() throws Exception {} /** * Some text. + * * @return Some text. * @throws Exception Some text. + * @serialData Some javadoc. */ - String method4() throws Exception - { - return "null"; + String method4() throws Exception { + return "null"; } /** * Some text. - * @deprecated Some text. + * + * @param str Some text. * @return Some text. - * @param aString Some text. + * @deprecated Some text. */ - String method5(String aString) - { - return "null"; + String method5(String str) { + return "null"; } /** * Some text. - * @param aString Some text. + * + * @param str Some text. + * @param number Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' + * @param bool Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' * @return Some text. - * Some javadoc. // warn - * @serialData Some javadoc. - * @param aInt Some text. - * Some javadoc. // warn * @throws Exception Some text. - * @param aBoolean Some text. * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; + String method6(String str, int number, boolean bool) throws Exception { + return "null"; } + } - /** - * Some javadoc. - * - * @version 1.0 - * @since Some javadoc. - * @serialData Some javadoc. - * @author max - */ - class InnerClassWithAnnotations - { + InnerClassWithAnnotations anon = + new InnerClassWithAnnotations() { /** * Some text. + * + * @param str Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' * @return Some text. - * @deprecated Some text. - * Some javadoc. - * @param aString Some text. * @throws Exception Some text. - * Some javadoc. - */ - String method(String aString) throws Exception - { - return "null"; - } - - /** - * Some text. - * @throws Exception Some text. - * Some javadoc. - * @return Some text. - * @param aString Some text. - * Some javadoc. - */ - String method1(String aString) throws Exception - { - return "null"; - } - - /** - * Some text. * @serialData Some javadoc. - * Some javadoc. - * @param aString Some text. - * Some javadoc. - * @throws Exception Some text. - */ - void method2(String aString) throws Exception {} - - /** - * Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' * @deprecated Some text. - * @throws Exception Some text. */ - void method3() throws Exception {} - - /** - * Some text. - * @throws Exception Some text. - * @serialData Some javadoc. - * @return Some text. - */ - String method4() throws Exception - { - return "null"; + String method(String str) throws Exception { + return "null"; } /** * Some text. - * @param aString Some text. - * @deprecated Some text. - * @return Some text. - */ - String method5(String aString) - { - return "null"; - } - - /** - * Some text. - * @param aString Some text. + * + * @param str Some text. + * Some javadoc. * @return Some text. - * @param aInt Some text. - * Some javadoc. // warn * @throws Exception Some text. - * @param aBoolean Some text. - * Some javadoc. // warn - * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; + String method1(String str) throws Exception { + return "null"; } - } - InnerClassWithAnnotations anon = new InnerClassWithAnnotations() - { /** * Some text. + * + * @param str Some text. * @throws Exception Some text. - * @param aString Some text. - * Some javadoc. // warn - * @serialData Some javadoc. - * Some javadoc. // warn - * @deprecated Some text. - * @return Some text. - */ - String method(String aString) throws Exception - { - return "null"; - } - - /** - * Some text. - * @param aString Some text. * Some javadoc. - * @throws Exception Some text. - * @return Some text. */ - String method1(String aString) throws Exception - { - return "null"; - } + void method2(String str) throws Exception {} /** * Some text. + * * @throws Exception Some text. - * Some javadoc. - * @param aString Some text. - */ - void method2(String aString) throws Exception {} - - /** - * Some text. * @deprecated Some text. * Some javadoc. - * @throws Exception Some text. */ void method3() throws Exception {} /** * Some text. - * @throws Exception Some text. + * * @return Some text. + * @throws Exception Some text. */ - String method4() throws Exception - { - return "null"; + String method4() throws Exception { + return "null"; } /** * Some text. - * @deprecated Some text. + * + * @param str Some text. * @return Some text. - * @param aString Some text. + * @deprecated Some text. */ - String method5(String aString) - { - return "null"; + String method5(String str) { + return "null"; } /** * Some text. * Some javadoc. - * @param aString Some text. - * Some javadoc. // warn + * + * @param str Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' + * @param number Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' + * @param bool Some text. * @return Some text. - * @param aInt Some text. - * Some javadoc. // warn * @throws Exception Some text. - * Some javadoc. // warn - * @param aBoolean Some text. + * Some javadoc. + * // violation above '.* incorrect indentation level, expected level should be 4.' * @deprecated Some text. */ - String method6(String aString, int aInt, boolean aBoolean) throws Exception - { - return "null"; + String method6(String str, int number, boolean bool) throws Exception { + return "null"; } - }; -} + }; -/** - * Some javadoc. - * - * @since Some javadoc. - * @version 1.0 - * @deprecated Some javadoc. - * Some javadoc. - * Some javadoc. - * @see Some javadoc. - * Some javadoc. // warn - * @author max - */ -enum Foo3 {} + /** + * Some javadoc. + * + * @since Some javadoc. + * @version 1.0 + * @deprecated Some javadoc. + * Some javadoc. + * Some javadoc. + * @see Some javadoc. + * Some javadoc. // violation '.* incorrect indentation level, expected level should be 4.' + * @author max + */ + enum Foo3 {} -/** - * Some javadoc. - * - * @version 1.0 - * @since Some javadoc. - * Some javadoc. - * @serialData Some javadoc. - * Some javadoc. // warn - * @author max - */ -interface FooIn5 {} + /** + * Some javadoc. + * + * @version 1.0 + * @since Some javadoc. + * Some javadoc. + * @serialData Some javadoc. + * Some javadoc. // violation '.* incorrect indentation level, expected level should be 4.' + * @author max + */ + interface FooIn5 {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescription.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescription.java new file mode 100644 index 00000000000..13bbdfdf268 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescription.java @@ -0,0 +1,68 @@ +package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; + +class InputNonEmptyAtclauseDescription { + /** + * Some javadoc. + * + * @param a Some javadoc + * @param b Some javadoc + * @param c Some javadoc + * @return Some javadoc + * @throws Exception Some javadoc + * @deprecated Some javadoc + */ + public int foo1(String a, int b, double c) throws Exception { + return 1; + } + + /** + * Some javadoc. + * + * @param a Some javadoc + * @param b Some javadoc + * @param c Some javadoc + * @return Some javadoc + * @throws Exception Some javadoc + */ + public int foo2(String a, int b, double c) throws Exception { + return 1; + } + + // violation 9 lines below 'At-clause should have a non-empty description.' + // violation 9 lines below 'At-clause should have a non-empty description.' + // violation 9 lines below 'At-clause should have a non-empty description.' + // violation 9 lines below 'At-clause should have a non-empty description.' + // violation 9 lines below 'At-clause should have a non-empty description.' + // violation 9 lines below 'At-clause should have a non-empty description.' + /** + * some javadoc. + * + * @param a + * @param b + * @param c + * @throws Exception + * @deprecated + * @deprecated + */ + public int foo3(String a, int b, double c) throws Exception { + return 1; + } + + // violation 8 lines below 'At-clause should have a non-empty description.' + // violation 8 lines below 'At-clause should have a non-empty description.' + // violation 8 lines below 'At-clause should have a non-empty description.' + // violation 8 lines below 'At-clause should have a non-empty description.' + // violation 8 lines below 'At-clause should have a non-empty description.' + /** + * some javadoc. + * + * @param a + * @param b + * @param c + * @throws Exception + * @deprecated + */ + public int foo4(String a, int b, double c) throws Exception { + return 1; + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java deleted file mode 100644 index 7d03f5f7dd5..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheck.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; - -class InputNonEmptyAtclauseDescriptionCheck -{ - /** - * Some javadoc - * @param a Some javadoc - * @param b Some javadoc - * @param c Some javadoc - * @return Some javadoc - * @throws Exception Some javadoc - * @deprecated Some javadoc - */ - public int foo1(String a, int b, double c) throws Exception - { - return 1; - } - - /** - * - * @param a Some javadoc - * @param b Some javadoc - * @param c Some javadoc - * @return Some javadoc - * @throws Exception Some javadoc - */ - public int foo2(String a, int b, double c) throws Exception - { - return 1; - } - - /** - * - * @param a - * @param b - * @param c - * @deprecated - * @throws Exception - * @deprecated - */ - public int foo3(String a, int b, double c) throws Exception - { - return 1; - } - - /** - * - * @param a - * @param b - * @param c - * @deprecated - * @throws Exception - */ - public int foo4(String a, int b, double c) throws Exception - { - return 1; - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java deleted file mode 100644 index e3a59b395db..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionCheckSpaceSeq.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; - -class InputNonEmptyAtclauseDescriptionCheckSpaceSeq -{ - /** - * Some javadoc. - * @param a Some javadoc. - * @param b Some javadoc. - */ - public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a, int b) - { - - } - - /** - * Some javadoc. - * @param a Some javadoc. - * @deprecated Some javadoc. - */ - public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a) - { - - } - - /** - * Some javadoc. - * @param a - * @param b - * @param c - */ - public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a, int b, double c) - { - - } - - /** - * - * @param a - * @param e - * @deprecated - */ - public InputNonEmptyAtclauseDescriptionCheckSpaceSeq(String a, boolean e) - { - - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionSpaceSeq.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionSpaceSeq.java new file mode 100644 index 00000000000..f92bcd782b2 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule713atclauses/InputNonEmptyAtclauseDescriptionSpaceSeq.java @@ -0,0 +1,43 @@ +package com.google.checkstyle.test.chapter7javadoc.rule713atclauses; + +class InputNonEmptyAtclauseDescriptionSpaceSeq { + /** + * Some javadoc. + * + * @param a Some javadoc. + * @param b Some javadoc. + */ + public InputNonEmptyAtclauseDescriptionSpaceSeq(String a, int b) {} + + /** + * Some javadoc. + * + * @param a Some javadoc. + * @deprecated Some javadoc. + */ + public InputNonEmptyAtclauseDescriptionSpaceSeq(String a) {} + + // violation 6 lines below 'At-clause should have a non-empty description.' + // violation 6 lines below 'At-clause should have a non-empty description.' + // violation 6 lines below 'At-clause should have a non-empty description.' + /** + * Some javadoc. + * + * @param a + * @param b + * @param c + */ + public InputNonEmptyAtclauseDescriptionSpaceSeq(String a, int b, double c) {} + + // violation 6 lines below 'At-clause should have a non-empty description.' + // violation 6 lines below 'At-clause should have a non-empty description.' + // violation 6 lines below 'At-clause should have a non-empty description.' + /** + * Some javadoc. + * + * @param a + * @param e + * @deprecated + */ + public InputNonEmptyAtclauseDescriptionSpaceSeq(String a, boolean e) {} +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputCorrectSummaryFragment.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputCorrectSummaryFragment.java new file mode 100644 index 00000000000..b654863b8d0 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputCorrectSummaryFragment.java @@ -0,0 +1,113 @@ +package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; + +/** Some Javadoc A {@code Foo} is a simple Javadoc. */ +class InputCorrectSummaryFragment { + + /** Some Javadoc This method returns. */ + public static final byte NUL = 0; + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ + void foo3() {} + + /** + * This is valid. + * + * @throws Exception if a problem occurs. + */ + void foo4() throws Exception {} + + /** An especially This method returns short bit of Javadoc. */ + void foo5() {} + + /** An especially short bit of Javadoc. This method returns. */ + void foo6() {} + + /** This is valid. */ + class InnerInputCorrectJavaDocParagraphCheck { + + /** foooo@foooo. */ + public static final byte NUL = 0; + + /** Some java@doc. This method returns. */ + public static final byte NUL_2 = 0; + + /** Returns the customer ID. This method returns. */ + int getId() { + return 666; + } + + /** This is valid. . */ + void foo2() {} + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. This method returns. */ + void foo3() {} + + /** + * This is valid. + * + * @throws Exception if a problem occurs. + */ + void foo4() throws Exception {} + + /** + * JAXB Provider Use Only: Provides partial default implementations for some javax.xml.bind + * interfaces. + */ + void foo5() {} + + /** An especially short (int... A) bit of Javadoc. This method returns. */ + void foo6() {} + } + + /** + * Some javadoc. A {@code Foo} is a simple Javadoc. + * + *

Some Javadoc. A {@code Foo} is a simple Javadoc. + */ + InnerInputCorrectJavaDocParagraphCheck anon = + new InnerInputCorrectJavaDocParagraphCheck() { + + /** JAXB 1.0 only default validation event handler. */ + public static final byte NUL = 0; + + /** Returns the current state. This method returns. */ + boolean emulated(String s) { + return false; + } + + /** Some Javadoc. This method returns some javadoc. */ + boolean emulated() { + return false; + } + + /** Some Javadoc. This method returns some javadoc. Some Javadoc. */ + boolean emulated1() { + return false; + } + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ + void foo3() {} + + /** + * This is valid. + * + * @throws Exception if a problem occurs. + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** An especially short bit of Javadoc. */ + void foo6() {} + + /** + * This is valid. + * + * @return Some Javadoc the customer ID. + */ + int geId() { + return 666; + } + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputCorrectSummaryJavaDocCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputCorrectSummaryJavaDocCheck.java deleted file mode 100644 index 09c0fcd0a0f..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputCorrectSummaryJavaDocCheck.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; - -/** - * Some Javadoc A {@code Foo} is a simple Javadoc. - */ -class InputCorrectSummaryJavaDocCheck { - - /** - * Some Javadoc This method returns. - */ - public static final byte NUL = 0; - - /** - * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. - */ - void foo3() {} - - /** - * This is valid. - * @throws Exception if a problem occurs. - */ - void foo4() throws Exception {} - - /** An especially This method returns short bit of Javadoc. */ - void foo5() {} - - /** - * An especially short - * bit of Javadoc. This method returns. - */ - void foo6() {} - - /** - * This is valid. - * - */ - class InnerInputCorrectJavaDocParagraphCheck { - - /** - * foooo@foooo. - */ - public static final byte NUL = 0; - - /** - * Some java@doc. - * This method returns. - */ - public static final byte NUL_2 = 0; - - /** - * Returns the customer ID. This method returns. - */ - int getId() {return 666;} - - /** - * This is valid. - * . - */ - void foo2() {} - - /** - * As of JDK 1.1, - * replaced by {@link #setBounds(int,int,int,int)}. This method returns. - */ - void foo3() {} - - /** - * This is valid. - * @throws Exception if a problem occurs. - */ - void foo4() throws Exception {} - - /** - * JAXB Provider Use Only: Provides partial default - * implementations for some javax.xml.bind interfaces. - */ - void foo5() {} - - /** - * An especially short (int... A) bit of Javadoc. This - * method returns. - */ - void foo6() {} - } - - /** - * Some - * javadoc. A {@code Foo} is a simple Javadoc. - * - * Some Javadoc. A {@code Foo} - * is a simple Javadoc. - */ - InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { - - /** - * JAXB 1.0 only default validation event handler. - */ - public static final byte NUL = 0; - - /** - * Returns the current state. - * This method returns. - */ - boolean emulated(String s) {return false;} - - /** - * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. - */ - void foo3() {} - - /** - * This is valid. - * @throws Exception if a problem occurs. - */ - void foo4() throws Exception {} - - /** An especially short bit of Javadoc. */ - void foo5() {} - - /** - * An especially short bit of Javadoc. - */ - void foo6() {} - - /** - * Some Javadoc. This method returns some javadoc. - */ - boolean emulated() {return false;} - - /** - * Some Javadoc. This method returns some javadoc. Some Javadoc. - */ - boolean emulated1() {return false;} - - /** - * This is valid. - * @return Some Javadoc the customer ID. - */ - int geId() {return 666;} - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputIncorrectSummaryFragment.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputIncorrectSummaryFragment.java new file mode 100644 index 00000000000..f87b9eb525d --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputIncorrectSummaryFragment.java @@ -0,0 +1,96 @@ +package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; + +/** A {@code Foo. Foo} is a simple Javadoc. Some javadoc. */ +class InputIncorrectSummaryFragment { + + // violation below 'First sentence of Javadoc is missing an ending period.' + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} */ + void foo3() {} + + // violation below 'Summary javadoc is missing.' + /** + * @throws Exception if a problem occurs + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** An especially short bit of Javadoc. */ + void foo6() {} + + /** Some Javadoc. */ + public static final byte NUL = 0; + + // violation below 'Summary javadoc is missing.' + /** */ + class InnerInputCorrectJavaDocParagraphCheck { + + // violation below 'First sentence of Javadoc is missing an ending period.' + /** foooo@foooo */ + public static final byte NUL = 0; + + /** Some java@doc. */ + public static final byte NUL_2 = 0; + + // violation below 'Forbidden summary fragment.' + /** This method returns some javadoc. Some javadoc. */ + boolean emulated() { + return false; + } + + // violation below 'Summary javadoc is missing.' + /** */ + void foo2() {} + + // violation below 'Summary javadoc is missing.' + /** + * @return the customer ID some javadoc. + */ + int geId() { + return 666; + } + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ + void foo3() {} + + // violation below 'Summary javadoc is missing.' + /** + * @throws Exception if a problem occurs + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** An especially short bit of Javadoc. */ + void foo6() {} + } + + // violation below 'Forbidden summary fragment.' + /** A {@code InnerInputCorrectJavaDocParagraphCheck} is a simple code. */ + InnerInputCorrectJavaDocParagraphCheck anon = + new InnerInputCorrectJavaDocParagraphCheck() { + + /** Some Javadoc. */ + public static final byte NUL = 0; + + /** Some Javadoc. */ + void emulated(String s) {} + + /** As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. */ + void foo3() {} + + // violation below 'Summary javadoc is missing.' + /** + * @throws Exception if a problem occurs + */ + void foo4() throws Exception {} + + /** An especially short bit of Javadoc. */ + void foo5() {} + + /** An especially short bit of Javadoc. */ + void foo6() {} + }; +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputIncorrectSummaryJavaDocCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputIncorrectSummaryJavaDocCheck.java deleted file mode 100644 index 78d116711fb..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule72thesummaryfragment/InputIncorrectSummaryJavaDocCheck.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule72thesummaryfragment; - -/** - * A {@code Foo. Foo} - * is a simple Javadoc. Some javadoc. - */ -class InputIncorrectSummaryJavaDocCheck { - - /** - * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)} - */ - void foo3() {} - -/*warn*//** - * @throws Exception if a problem occurs - */ - void foo4() throws Exception {} - - /** An especially short bit of Javadoc. */ - void foo5() {} - - /** - * An especially short bit of Javadoc. - */ - void foo6() {} - - /** - * Some Javadoc. - */ - public static final byte NUL = 0; - -/*warn*//** - * - */ - class InnerInputCorrectJavaDocParagraphCheck { - -/*warn*//** - * foooo@foooo - */ - public static final byte NUL = 0; - - /** - * Some java@doc. - */ - public static final byte NUL_2 = 0; - - /*warn*//** - * This method - * returns some javadoc. Some javadoc. - */ - boolean emulated() {return false;} - -/*warn*//** - * - */ - void foo2() {} - -/*warn*//** - * @return the - * customer ID some javadoc. - */ - int geId() {return 666;} - - /** - * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. - */ - void foo3() {} - -/*warn*//** - * @throws Exception if a problem occurs - */ - void foo4() throws Exception {} - - /** An especially short bit of Javadoc. */ - void foo5() {} - - /** - * An especially short bit of Javadoc. - */ - void foo6() {} - } - -/*warn*//** - * A {@code InnerInputCorrectJavaDocParagraphCheck} is a simple code. - */ - InnerInputCorrectJavaDocParagraphCheck anon = new InnerInputCorrectJavaDocParagraphCheck() { - - /** - * Some Javadoc. - */ - public static final byte NUL = 0; - - /** - * Some Javadoc. - */ - void emulated(String s) {} - - /** - * As of JDK 1.1, replaced by {@link #setBounds(int,int,int,int)}. - */ - void foo3() {} - -/*warn*//** - * @throws Exception if a problem occurs - */ - void foo4() throws Exception {} - - /** An especially short bit of Javadoc. */ - void foo5() {} - - /** - * An especially short bit of Javadoc. - */ - void foo6() {} - }; -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodAndMissingJavadocMethod.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodAndMissingJavadocMethod.java new file mode 100644 index 00000000000..d60baa2b3a9 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodAndMissingJavadocMethod.java @@ -0,0 +1,152 @@ +package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; + +/** + * The following is a bad tag. + * + * @mytag Hello + */ +public class InputJavadocMethodAndMissingJavadocMethod extends OverrideClasss { + // with comments + + /** + * Some javadoc. + * + * @return Some javadoc. + */ + int foo1() { + return 1; + } + + /** Some javadoc. */ + String foo2() { + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + /** Some javadoc. */ + void foo3() { + foo2(); + } + + /** Some javadoc. */ + void foo4() {} + + // without comments + + int foo5() { + return 1; + } + + String foo6() { + return "Fooooooooooooooo" + "oooooooo"; + } + + // violation below 'Missing a Javadoc comment.' + public String foo7() { + // making the method + // exceed "minLineCount" property limit ( 2 ) + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + // ok, private method does not require javadoc + private String correct(String param) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param; + } + + // ok, default scope method does not require javadoc + String defaultScope(int x) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + x; + } + + // ok, methods smaller than 2 lines does not require javadoc + public void smallMethod1() { + foo2(); + } + + // ok, methods smaller than 2 lines does not require javadoc + protected void smallMethod2() { + foo2(); + } + + /** Ok, missing params tags and return tags in javadoc are allowed. */ + public String testingParams(String param1, String param2) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param1 + param2; + } + + /** Ok, missing params tags and return tags in javadoc are allowed. */ + protected String testingParams(int param1, int param2) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param1 + param2; + } + + // violation below 'Missing a Javadoc comment.' + public InputJavadocMethodAndMissingJavadocMethod() { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, private constructor does not require javadoc + private InputJavadocMethodAndMissingJavadocMethod(float x) { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, default scope constructor does not require javadoc + InputJavadocMethodAndMissingJavadocMethod(int a) { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, constructors smaller than 2 lines does not require javadoc + public InputJavadocMethodAndMissingJavadocMethod(int a, int b) { + foo2(); + } + + // ok, constructors smaller than 2 lines does not require javadoc + private InputJavadocMethodAndMissingJavadocMethod(float a, float b) { + foo2(); + } + + /** Ok, missing params tags in javadoc are allowed. */ + public InputJavadocMethodAndMissingJavadocMethod(double a, double b) { + foo2(); + foo91(); + foo5(); + foo82(); + } + + void foo81() { + foo2(); + } + + void foo82() {} + + void paramviolation(String param) { + foo2(); + } + + @MyAnnotationn + String foo91() { + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + @Override + public String foo92() { + return "Fooooo" + "ooo" + "ooooooo" + "ooooo" + "ooo"; + } +} + +// violation below 'Top-level class OverrideClasss has to reside in its own source file.' +class OverrideClasss { + + public String foo92() { + return "Fooooo" + "ooo" + "ooooooo" + "ooooo" + "ooo"; + } +} + +// violation below 'Top-level class MyAnnotationn has to reside in its own source file.' +@interface MyAnnotationn {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodCheck.java deleted file mode 100644 index edea005def5..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputJavadocMethodCheck.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; - -/** - * The following is a bad tag. - * @mytag Hello - */ -public class InputJavadocMethodCheck extends OverrideClass -{ - //with comments - - /** - * Some javadoc. - * @return Some javadoc. - */ - int foo1() - { - return 1; - } - - /** - * Some javadoc. - * - */ - String foo2() - { - return "Fooooooooooooooo" - + "ooooo" - + "ooo"; - } - - /** - * Some javadoc. - */ - void foo3() - { - foo2(); - } - - /** - * Some javadoc. - */ - void foo4() {} - - //without comments - - int foo5() - { - return 1; - } - - String foo6() - { - return "Fooooooooooooooo" - + "oooooooo"; - } - - public String foo7() - { - return "Fooooooooooooooo" - + "ooooo" - + "ooo"; - } - - void foo81() - { - foo2(); - } - - void foo82() { - - - - - - } - - @MyAnnotation - String foo91() - { - return "Fooooooooooooooo" - + "ooooo" - + "ooo"; - } - - @Override - public String foo92() - { - return "Fooooo" - + "ooo" - + "ooooooo" - + "ooooo" - + "ooo"; - } -} - - -class OverrideClass { - - public String foo92() - { - return "Fooooo" - + "ooo" - + "ooooooo" - + "ooooo" - + "ooo"; - } -} -@interface MyAnnotation {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputMissingJavadocMethodCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputMissingJavadocMethodCheck.java deleted file mode 100644 index 263f548dcf0..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule731selfexplanatory/InputMissingJavadocMethodCheck.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule731selfexplanatory; - -/** - * The following is a bad tag. - * @mytag Hello - */ -public class InputMissingJavadocMethodCheck extends OverrideClass -{ - //with comments - - /** - * Some javadoc. - * @return Some javadoc. - */ - int foo1() - { - return 1; - } - - /** - * Some javadoc. - * - */ - String foo2() - { - return "Fooooooooooooooo" - + "ooooo" - + "ooo"; - } - - /** - * Some javadoc. - */ - void foo3() - { - foo2(); - } - - /** - * Some javadoc. - */ - void foo4() {} - - //without comments - - int foo5() - { - return 1; - } - - String foo6() - { - return "Fooooooooooooooo" - + "oooooooo"; - } - - public String foo7() //warn - { - return "Fooooooooooooooo" - + "ooooo" - + "ooo"; - } - - void foo81() - { - foo2(); - } - - void foo82() { - - - - - - } - - @MyAnnotation - String foo91() - { - return "Fooooooooooooooo" - + "ooooo" - + "ooo"; - } - - @Override - public String foo92() - { - return "Fooooo" - + "ooo" - + "ooooooo" - + "ooooo" - + "ooo"; - } -} - - -class MissingOverrideClass { - - public String foo92() - { - return "Fooooo" - + "ooo" - + "ooooooo" - + "ooooo" - + "ooo"; - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides/InputJavadocMethodAndMissingJavadocMethod.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides/InputJavadocMethodAndMissingJavadocMethod.java new file mode 100644 index 00000000000..abbc8e94c2f --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule732exceptionoverrides/InputJavadocMethodAndMissingJavadocMethod.java @@ -0,0 +1,152 @@ +package com.google.checkstyle.test.chapter7javadoc.rule732exceptionoverrides; + +/** + * The following is a bad tag. + * + * @mytag Hello + */ +public class InputJavadocMethodAndMissingJavadocMethod extends OverrideClass { + // with comments + + /** + * Some javadoc. + * + * @return Some javadoc. + */ + int foo1() { + return 1; + } + + /** Some javadoc. */ + String foo2() { + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + /** Some javadoc. */ + void foo3() { + foo2(); + } + + /** Some javadoc. */ + void foo4() {} + + // without comments + + int foo5() { + return 1; + } + + String foo6() { + return "Fooooooooooooooo" + "oooooooo"; + } + + // violation below 'Missing a Javadoc comment.' + public String foo7() { + // making the method + // exceed "minLineCount" property limit ( 2 ) + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + // ok, private method does not require javadoc + private String correct(String param) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param; + } + + // ok, default scope method does not require javadoc + String defaultScope(int x) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + x; + } + + // ok, methods smaller than 2 lines does not require javadoc + public void smallMethod1() { + foo2(); + } + + // ok, methods smaller than 2 lines does not require javadoc + protected void smallMethod2() { + foo2(); + } + + /** Ok, missing params tags and return tags in javadoc are allowed. */ + public String testingParams(String param1, String param2) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param1 + param2; + } + + /** Ok, missing params tags and return tags in javadoc are allowed. */ + protected String testingParams(int param1, int param2) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param1 + param2; + } + + // violation below 'Missing a Javadoc comment.' + public InputJavadocMethodAndMissingJavadocMethod() { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, private constructor does not require javadoc + private InputJavadocMethodAndMissingJavadocMethod(float x) { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, default scope constructor does not require javadoc + InputJavadocMethodAndMissingJavadocMethod(int a) { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, constructors smaller than 2 lines does not require javadoc + public InputJavadocMethodAndMissingJavadocMethod(int a, int b) { + foo2(); + } + + // ok, constructors smaller than 2 lines does not require javadoc + private InputJavadocMethodAndMissingJavadocMethod(float a, float b) { + foo2(); + } + + /** Ok, missing params tags in javadoc are allowed. */ + public InputJavadocMethodAndMissingJavadocMethod(double a, double b) { + foo2(); + foo91(); + foo5(); + foo82(); + } + + void foo81() { + foo2(); + } + + void foo82() {} + + void paramviolation(String param) { + foo2(); + } + + @MyAnnotation + String foo91() { + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + @Override + public String foo92() { + return "Fooooo" + "ooo" + "ooooooo" + "ooooo" + "ooo"; + } +} + +// violation below 'Top-level class OverrideClass has to reside in its own source file.' +class OverrideClass { + + public String foo92() { + return "Fooooo" + "ooo" + "ooooooo" + "ooooo" + "ooo"; + } +} + +// violation below 'Top-level class MyAnnotation has to reside in its own source file.' +@interface MyAnnotation {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InputInvalidJavadocPosition.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InputInvalidJavadocPosition.java index 55e23a1de74..e65812348ec 100644 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InputInvalidJavadocPosition.java +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule734nonrequiredjavadoc/InputInvalidJavadocPosition.java @@ -1,54 +1,122 @@ -package /** warn */ com.google.checkstyle.test.chapter7javadoc.rule734nonrequiredjavadoc; +package // violation 'package statement should not be line-wrapped.' + /** odd javadoc */ // violation 'Javadoc comment is placed in the wrong location.' + com.google.checkstyle.test.chapter7javadoc.rule734nonrequiredjavadoc; -/** warn */ +// violation below 'Javadoc comment is placed in the wrong location.' +/** odd javadoc */ import java.lang.String; -/** warn */ -/** valid */ +// violation below 'Javadoc comment is placed in the wrong location.' +/** odd javadoc */ +/** valid javadoc. */ class InputInvalidJavadocPosition { - /** warn */ + /** odd javadoc */ + // violation above 'Javadoc comment is placed in the wrong location.' } -/** valid */ + +/** valid javadoc. */ /* ignore */ class InputInvalidJavadocPosition2 { - /** warn */ - static { /* ignore */ } - - /** warn */ - /** valid */ - int field1; - /** valid */ - int[] field2; - /** valid */ - public int[] field3; - /** valid */ - @Deprecated int field4; - - int /** warn */ field20; - int field21 /** warn */; - @Deprecated /** warn */ int field22; - - void method1() {} - /** valid */ - void method2() {} - /** valid */ - T method3() { return null; } - /** valid */ - String[] method4() { return null; } - - void /** warn */ method20() {} - void method21 /** warn */ () {} - void method22(/** warn */) {} - void method23() /** warn */ {} - void method24() { /** warn */ } - void method25() { /** warn */ int variable; } + // violation above '.* InputInvalidJavadocPosition2 has to reside in its own source file.' + + /** odd javadoc */ // violation 'Javadoc comment is placed in the wrong location.' + static { + /* ignore */ + } + + // violation below 'Javadoc comment is placed in the wrong location.' + /** odd javadoc */ + /** valid javadoc. */ + int field1; + + /** valid javadoc. */ + int[] field2; + + /** valid javadoc. */ + public int[] field3; + + /** valid javadoc. */ + @Deprecated int field4; + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + int + /** odd javadoc */ + field20; + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + int field21 + /** odd javadoc */; + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + @Deprecated + /** odd javadoc */ + int field22; + + void method1() {} + + /** valid javadoc. */ + void method2() {} + + /** valid javadoc. */ + T method3() { + return null; + } + + /** valid javadoc. */ + String[] method4() { + return null; + } + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + void + /** odd javadoc */ + method20() {} + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + void method21 + /** odd javadoc */ + () {} // violation ''(' should be on the previous line.' + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + void method22( + /** odd javadoc */ + ) {} + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + void method23() + /** odd javadoc */ + {} + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + void method24() { + /** odd javadoc */ + } + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + void method25() { + /** odd javadoc */ + int variable; + } + + @Deprecated + /** odd javadoc */ + // violation above 'Javadoc comment is placed in the wrong location.' + class InputInvalidJavadocPosition3 {} + + /** valid javadoc. */ + @Deprecated + class InputInvalidJavadocPosition4 {} + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + class + /** odd javadoc */ + InputInvalidJavadocPosition5 {} + // violation above ''InputInvalidJavadocPosition5' has incorrect indentation .* 2, expected .* 6.' + + // violation 2 lines below 'Javadoc comment is placed in the wrong location.' + class InputInvalidJavadocPosition6 + /** odd javadoc */ + {} // violation ''}' at column 6 should be alone on a line.' + /** odd javadoc */ + // violation above 'Javadoc comment is placed in the wrong location.' } -@Deprecated -/** warn */ -class InputInvalidJavadocPosition3 {} -/** valid */ -@Deprecated -class InputInvalidJavadocPosition4 {} -class /** warn */ InputInvalidJavadocPosition5 {} -class InputInvalidJavadocPosition6 /** warn */ {} -/** warn */ diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputJavadocMethodAndMissingJavadocMethod.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputJavadocMethodAndMissingJavadocMethod.java new file mode 100644 index 00000000000..81b12d82c14 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputJavadocMethodAndMissingJavadocMethod.java @@ -0,0 +1,152 @@ +package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; + +/** + * The following is a bad tag. + * + * @mytag Hello + */ +public class InputJavadocMethodAndMissingJavadocMethod extends OverrideClass { + // with comments + + /** + * Some javadoc. + * + * @return Some javadoc. + */ + int foo1() { + return 1; + } + + /** Some javadoc. */ + String foo2() { + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + /** Some javadoc. */ + void foo3() { + foo2(); + } + + /** Some javadoc. */ + void foo4() {} + + // without comments + + int foo5() { + return 1; + } + + String foo6() { + return "Fooooooooooooooo" + "oooooooo"; + } + + // violation below 'Missing a Javadoc comment.' + public String foo7() { + // making the method + // exceed "minLineCount" property limit ( 2 ) + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + // ok, private method does not require javadoc + private String correct(String param) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param; + } + + // ok, default scope method does not require javadoc + String defaultScope(int x) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + x; + } + + // ok, methods smaller than 2 lines does not require javadoc + public void smallMethod1() { + foo2(); + } + + // ok, methods smaller than 2 lines does not require javadoc + protected void smallMethod2() { + foo2(); + } + + /** Ok, missing params tags and return tags in javadoc are allowed. */ + public String testingParams(String param1, String param2) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param1 + param2; + } + + /** Ok, missing params tags and return tags in javadoc are allowed. */ + protected String testingParams(int param1, int param2) { + return "Fooooooooooooooo" + "ooooo" + "ooo" + param1 + param2; + } + + // violation below 'Missing a Javadoc comment.' + public InputJavadocMethodAndMissingJavadocMethod() { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, private constructor does not require javadoc + private InputJavadocMethodAndMissingJavadocMethod(float x) { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, default scope constructor does not require javadoc + InputJavadocMethodAndMissingJavadocMethod(int a) { + foo2(); + foo91(); + foo4(); + foo3(); + } + + // ok, constructors smaller than 2 lines does not require javadoc + public InputJavadocMethodAndMissingJavadocMethod(int a, int b) { + foo2(); + } + + // ok, constructors smaller than 2 lines does not require javadoc + private InputJavadocMethodAndMissingJavadocMethod(float a, float b) { + foo2(); + } + + /** Ok, missing params tags in javadoc are allowed. */ + public InputJavadocMethodAndMissingJavadocMethod(double a, double b) { + foo2(); + foo91(); + foo5(); + foo82(); + } + + void foo81() { + foo2(); + } + + void foo82() {} + + void paramviolation(String param) { + foo2(); + } + + @MyAnnotation + String foo91() { + return "Fooooooooooooooo" + "ooooo" + "ooo"; + } + + @Override + public String foo92() { + return "Fooooo" + "ooo" + "ooooooo" + "ooooo" + "ooo"; + } +} + +// violation below 'Top-level class OverrideClass has to reside in its own source file.' +class OverrideClass { + + public String foo92() { + return "Fooooo" + "ooo" + "ooooooo" + "ooooo" + "ooo"; + } +} + +// violation below 'Top-level class MyAnnotation has to reside in its own source file.' +@interface MyAnnotation {} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCheck.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCheck.java deleted file mode 100644 index 6c6307887e4..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCheck.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; - -public class InputMissingJavadocTypeCheck { //warn - - public class Inner { // warn - - } - - public enum MyEnum { // warn - - } - - public interface MyInterface { // warn - class MyInterfaceClass {} // warn - } - - public @interface MyAnnotation { // warn - - } - - protected class InnerProtected { // warn - - } - - protected enum MyEnumProtected { // warn - - } - - protected interface MyInterfaceProtected { // warn - - } - - protected @interface MyAnnotationProtected { //warn - - } - - public void myMethod() { - class MyMethodClass {} // ok - } - -} - -class AdditionalClass { // OK, not public - -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCheckNoViolations.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCheckNoViolations.java deleted file mode 100644 index 96195ba753d..00000000000 --- a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCheckNoViolations.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; - -/** - * This is a Javadoc comment. - */ -public class InputMissingJavadocTypeCheckNoViolations { // OK - private int myInt; // OK - int myOtherInt; // OK - - /** - * This is a Javadoc comment. - */ - public class InnerPublic implements MyInterfacePublic { // OK - - } - - /** - * This is a Javadoc comment. - */ - public enum MyEnumPublic { // OK - - } - - /** - * This is a Javadoc comment. - */ - public interface MyInterfacePublic { // OK - - /** - * This is a Javadoc comment. - */ - class MyInterfaceClass {} // OK - } - - /** - * This is a Javadoc comment. - */ - public @interface MyAnnotationPublic { // OK - - } - - /** - * This is a Javadoc comment. - */ - protected class InnerProtected { // OK - - } - - /** - * This is a Javadoc comment. - */ - protected enum MyEnumProtected { // OK - - } - - /** - * This is a Javadoc comment. - */ - protected interface MyInterfaceProtected { // OK - - } - - /** - * This is a Javadoc comment. - */ - protected @interface MyAnnotationProtected { // OK - - } - - class Inner { // OK - - } - - enum MyEnum { // OK - - } - - interface MyInterface { // OK - - } - - @interface MyAnnotation { // OK - - } - - private class InnerPrivate { // OK - - } - - private enum MyEnumPrivate { // OK - - } - - private interface MyInterfacePrivate { // OK - - } - - private @interface MyAnnotationPrivate { // OK - - } - - public void myMethod() { - class MyMethodClass {} // OK - } -} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCorrect.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCorrect.java new file mode 100644 index 00000000000..6819aae57f8 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeCorrect.java @@ -0,0 +1,55 @@ +package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; + +/** This is a Javadoc comment. */ +public class InputMissingJavadocTypeCorrect { + private int myInt; + int myOtherInt; + + /** This is a Javadoc comment. */ + public class InnerPublic implements MyInterfacePublic {} + + /** This is a Javadoc comment. */ + public enum MyEnumPublic {} + + /** This is a Javadoc comment. */ + public interface MyInterfacePublic { + + /** This is a Javadoc comment. */ + class MyInterfaceClass {} + } + + /** This is a Javadoc comment. */ + public @interface MyAnnotationPublic {} + + /** This is a Javadoc comment. */ + protected class InnerProtected {} + + /** This is a Javadoc comment. */ + protected enum MyEnumProtected {} + + /** This is a Javadoc comment. */ + protected interface MyInterfaceProtected {} + + /** This is a Javadoc comment. */ + protected @interface MyAnnotationProtected {} + + class Inner {} + + enum MyEnum {} + + interface MyInterface {} + + @interface MyAnnotation {} + + private class InnerPrivate {} + + private enum MyEnumPrivate {} + + private interface MyInterfacePrivate {} + + private @interface MyAnnotationPrivate {} + + public void myMethod() { + class MyMethodClass {} + } +} diff --git a/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeIncorrect.java b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeIncorrect.java new file mode 100644 index 00000000000..ed9b4b8fbd8 --- /dev/null +++ b/src/it/resources/com/google/checkstyle/test/chapter7javadoc/rule73wherejavadocrequired/InputMissingJavadocTypeIncorrect.java @@ -0,0 +1,36 @@ +package com.google.checkstyle.test.chapter7javadoc.rule73wherejavadocrequired; + +public class InputMissingJavadocTypeIncorrect { // violation 'Missing a Javadoc comment.' + + public class Inner { // violation 'Missing a Javadoc comment.' + } + + public enum MyEnum { // violation 'Missing a Javadoc comment.' + } + + public interface MyInterface { // violation 'Missing a Javadoc comment.' + class MyInterfaceClass {} // violation 'Missing a Javadoc comment.' + } + + public @interface MyAnnotation { // violation 'Missing a Javadoc comment.' + } + + protected class InnerProtected { // violation 'Missing a Javadoc comment.' + } + + protected enum MyEnumProtected { // violation 'Missing a Javadoc comment.' + } + + protected interface MyInterfaceProtected { // violation 'Missing a Javadoc comment.' + } + + protected @interface MyAnnotationProtected { // violation 'Missing a Javadoc comment.' + } + + public void myMethod() { + class MyMethodClass {} + } + + class AdditionalClass { // OK, not public + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameAnnotation.java new file mode 100644 index 00000000000..0937e6e5f54 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameAnnotation.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public class InputXpathAbbreviationAsWordInNameAnnotation { + + @interface ANNOTATION { // warn + + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameAnnotationField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameAnnotationField.java new file mode 100644 index 00000000000..b718b6917f3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameAnnotationField.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public @interface InputXpathAbbreviationAsWordInNameAnnotationField { + + String ANNOTATION_FIELD(); // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameClass.java new file mode 100644 index 00000000000..4f30ade2da5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameClass.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public class InputXpathAbbreviationAsWordInNameClass { + + class CLASS { // warn + + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameEnum.java new file mode 100644 index 00000000000..7d6dd276151 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameEnum.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public class InputXpathAbbreviationAsWordInNameEnum { + + enum ENUMERATION { // warn + + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameField.java new file mode 100644 index 00000000000..57e43f8a7a3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameField.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public class InputXpathAbbreviationAsWordInNameField { + + int FIELD; // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameInterface.java new file mode 100644 index 00000000000..05b7c86f9bf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameInterface.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public class InputXpathAbbreviationAsWordInNameInterface { + + interface INTERFACE { // warn + + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameMethod.java new file mode 100644 index 00000000000..b501fd88b55 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameMethod.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public interface InputXpathAbbreviationAsWordInNameMethod { + + void METHOD(); // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameParameter.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameParameter.java new file mode 100644 index 00000000000..32fe570cf6c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameParameter.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public interface InputXpathAbbreviationAsWordInNameParameter { + + void method(int PARAMETER); // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameVariable.java new file mode 100644 index 00000000000..198d1c24cb2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/InputXpathAbbreviationAsWordInNameVariable.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; + +public class InputXpathAbbreviationAsWordInNameVariable { + + void method() { + int VARIABLE; // warn + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation.java deleted file mode 100644 index e4b615a5017..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public class SuppressionXpathRegressionAbbreviationAsWordInNameAnnotation { - - @interface ANNOTATION { // warn - - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField.java deleted file mode 100644 index 13b121dfcc8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public @interface SuppressionXpathRegressionAbbreviationAsWordInNameAnnotationField { - - String ANNOTATION_FIELD(); // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameClass.java deleted file mode 100644 index f3f4ee78da8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameClass.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public class SuppressionXpathRegressionAbbreviationAsWordInNameClass { - - class CLASS { // warn - - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameEnum.java deleted file mode 100644 index 7b3c8bfd271..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameEnum.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public class SuppressionXpathRegressionAbbreviationAsWordInNameEnum { - - enum ENUMERATION { // warn - - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameField.java deleted file mode 100644 index ef3f4b72ee9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameField.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public class SuppressionXpathRegressionAbbreviationAsWordInNameField { - - int FIELD; // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameInterface.java deleted file mode 100644 index 3a9fd12ffd8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameInterface.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public class SuppressionXpathRegressionAbbreviationAsWordInNameInterface { - - interface INTERFACE { // warn - - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameMethod.java deleted file mode 100644 index a9d269c868b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameMethod.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public interface SuppressionXpathRegressionAbbreviationAsWordInNameMethod { - - void METHOD(); // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameParameter.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameParameter.java deleted file mode 100644 index 99231cc3d67..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameParameter.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public interface SuppressionXpathRegressionAbbreviationAsWordInNameParameter { - - void method(int PARAMETER); // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameVariable.java deleted file mode 100644 index d212b18be5a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abbreviationaswordinname/SuppressionXpathRegressionAbbreviationAsWordInNameVariable.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abbreviationaswordinname; - -public class SuppressionXpathRegressionAbbreviationAsWordInNameVariable { - - void method() { - int VARIABLE; // warn - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameInner.java new file mode 100644 index 00000000000..e0b114df63a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameInner.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.abstractclassname; + +public class InputXpathAbstractClassNameInner { + abstract class MyClass { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameNoModifier.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameNoModifier.java new file mode 100644 index 00000000000..33651a0cffc --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameNoModifier.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.abstractclassname; + +public class InputXpathAbstractClassNameNoModifier { + class AbstractMyClass { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameTop.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameTop.java new file mode 100644 index 00000000000..9d7ea667f81 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/InputXpathAbstractClassNameTop.java @@ -0,0 +1,4 @@ +package org.checkstyle.suppressionxpathfilter.abstractclassname; + +public abstract class InputXpathAbstractClassNameTop { // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameInner.java deleted file mode 100644 index 421ad21f3bf..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameInner.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abstractclassname; - -public class SuppressionXpathRegressionAbstractClassNameInner { - abstract class MyClass { // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameNoModifier.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameNoModifier.java deleted file mode 100644 index a690d379943..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameNoModifier.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abstractclassname; - -public class SuppressionXpathRegressionAbstractClassNameNoModifier { - class AbstractMyClass { // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameTop.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameTop.java deleted file mode 100644 index bda9ac7903a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/abstractclassname/SuppressionXpathRegressionAbstractClassNameTop.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.abstractclassname; - -public abstract class SuppressionXpathRegressionAbstractClassNameTop { // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationAnnotation.java new file mode 100644 index 00000000000..5a2bb56da66 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationAnnotation.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@Annotation("bar") @interface InputXpathAnnotationLocationAnnotation {//warn + +} + +@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) +@interface Annotation { + + String value() default ""; + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationCTOR.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationCTOR.java new file mode 100644 index 00000000000..48011d5a5f1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationCTOR.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +public class InputXpathAnnotationLocationCTOR { + @CTORAnnotation(value = "") public InputXpathAnnotationLocationCTOR()//warn + { + // comment + } +} + +@interface CTORAnnotation { + String value(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationClass.java new file mode 100644 index 00000000000..20f3720a4e6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationClass.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@ClassAnnotation("bar") class InputXpathAnnotationLocationClass { //warn + +} + +@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE}) +@interface ClassAnnotation { + + String value() default ""; + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationEnum.java new file mode 100644 index 00000000000..570afc65e08 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationEnum.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; + +@EnumAnnotation("bar") enum InputXpathAnnotationLocationEnum { //warn + + SuppressionXpathRegressionAnnotationLocationEnum() { + } + +} + +@Target({ElementType.FIELD, ElementType.TYPE}) +@interface EnumAnnotation { + + String value() default ""; + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationInterface.java new file mode 100644 index 00000000000..e9c1edbd440 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationInterface.java @@ -0,0 +1,25 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Target; + +@InterfaceAnnotation("bar") interface InputXpathAnnotationLocationInterface { //warn + +} + +@Repeatable(InterfaceAnnotations.class) +@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) +@interface InterfaceAnnotation { + + String value() default ""; + +} + +@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) +@interface InterfaceAnnotations { + + InterfaceAnnotation[] value(); + +} + diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationMethod.java new file mode 100644 index 00000000000..66c51b2327a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationMethod.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +public class InputXpathAnnotationLocationMethod { + @MethodAnnotation("foo") void foo1() {}//warn +} +@interface MethodAnnotation { + String value(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationVariable.java new file mode 100644 index 00000000000..d8bc41bcfa0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/InputXpathAnnotationLocationVariable.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.annotationlocation; + +public class InputXpathAnnotationLocationVariable { + @VariableAnnotation(value = "") public int b; //warn +} +@interface VariableAnnotation { + String value(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationAnnotation.java deleted file mode 100644 index 3bf5265ae22..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationAnnotation.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@Annotation("bar") @interface SuppressionXpathRegressionAnnotationLocationAnnotation {//warn - -} - -@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD}) -@interface Annotation { - - String value() default ""; - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationCTOR.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationCTOR.java deleted file mode 100644 index 55b1041aec2..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationCTOR.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -public class SuppressionXpathRegressionAnnotationLocationCTOR { - @CTORAnnotation(value = "") public SuppressionXpathRegressionAnnotationLocationCTOR()//warn - { - // comment - } -} - -@interface CTORAnnotation { - String value(); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationClass.java deleted file mode 100644 index 10d5357350c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationClass.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@ClassAnnotation("bar") class SuppressionXpathRegressionAnnotationLocationClass { //warn - -} - -@Target({ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE}) -@interface ClassAnnotation { - - String value() default ""; - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationEnum.java deleted file mode 100644 index bb5266efc6c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationEnum.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -@EnumAnnotation("bar") enum SuppressionXpathRegressionAnnotationLocationEnum { //warn - - SuppressionXpathRegressionAnnotationLocationEnum() { - } - -} - -@Target({ElementType.FIELD, ElementType.TYPE}) -@interface EnumAnnotation { - - String value() default ""; - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationInterface.java deleted file mode 100644 index 36e6e5728ef..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Repeatable; -import java.lang.annotation.Target; - -@InterfaceAnnotation("bar") interface SuppressionXpathRegressionAnnotationLocationInterface { //warn - -} - -@Repeatable(InterfaceAnnotations.class) -@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) -@interface InterfaceAnnotation { - - String value() default ""; - -} - -@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE}) -@interface InterfaceAnnotations { - - InterfaceAnnotation[] value(); - -} - diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationMethod.java deleted file mode 100644 index 624247d91c0..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationMethod.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -public class SuppressionXpathRegressionAnnotationLocationMethod { - @MethodAnnotation("foo") void foo1() {}//warn -} -@interface MethodAnnotation { - String value(); -} - - diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationVariable.java deleted file mode 100644 index 926318c4322..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationlocation/SuppressionXpathRegressionAnnotationLocationVariable.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationlocation; - -public class SuppressionXpathRegressionAnnotationLocationVariable { - @VariableAnnotation(value = "") public int b; //warn -} -@interface VariableAnnotation { - String value(); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineField.java new file mode 100644 index 00000000000..cb652991f02 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineField.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.annotationonsameline; + +import java.util.ArrayList; +import java.util.List; + +public class InputXpathAnnotationOnSameLineField { + @Deprecated //warn + private List names = new ArrayList<>(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineInterface.java new file mode 100644 index 00000000000..6dcc7ffd526 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineInterface.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.annotationonsameline; + +@Deprecated //warn +interface InputXpathAnnotationOnSameLineInterface { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineMethod.java new file mode 100644 index 00000000000..ab070e0929b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/InputXpathAnnotationOnSameLineMethod.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.annotationonsameline; + +public class InputXpathAnnotationOnSameLineMethod { + @Deprecated int x; + + @Deprecated //warn + public int getX() { + return (int) x; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineOne.java deleted file mode 100644 index 329e01a5232..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineOne.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationonsameline; - -public class SuppressionXpathRegressionAnnotationOnSameLineOne { - @Deprecated int x; - - @Deprecated //warn - public int getX() { - return (int) x; - } -} - diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineThree.java deleted file mode 100644 index 6f947db192c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineThree.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationonsameline; - -@Deprecated //warn -interface SuppressionXpathRegressionAnnotationOnSameLineThree { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineTwo.java deleted file mode 100644 index c9162d849da..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationonsameline/SuppressionXpathRegressionAnnotationOnSameLineTwo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationonsameline; - -import java.util.ArrayList; -import java.util.List; - -public class SuppressionXpathRegressionAnnotationOnSameLineTwo { - @Deprecated //warn - private List names = new ArrayList<>(); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleEight.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleEight.java new file mode 100644 index 00000000000..b8950ec7ab1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleEight.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@SuppressWarnings({"something",}) //warn +public class InputXpathAnnotationUseStyleEight { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleFive.java new file mode 100644 index 00000000000..05bc97e2dd0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleFive.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@SuppressWarnings(value={"foo", "bar"}) //warn +public class InputXpathAnnotationUseStyleFive { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleFour.java new file mode 100644 index 00000000000..3c0e4d2360f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleFour.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@SuppressWarnings({}) //warn +public class InputXpathAnnotationUseStyleFour { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleOne.java new file mode 100644 index 00000000000..875e7f4112a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleOne.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@Deprecated +@SuppressWarnings({""}) //warn +public class InputXpathAnnotationUseStyleOne { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleSeven.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleSeven.java new file mode 100644 index 00000000000..53ed92235b8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleSeven.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@Deprecated +@SuppressWarnings(value={"foo"}) //warn +public class InputXpathAnnotationUseStyleSeven { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleSix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleSix.java new file mode 100644 index 00000000000..919573828d1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleSix.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@SuppressWarnings({"foo", "bar"}) //warn +public class InputXpathAnnotationUseStyleSix { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleThree.java new file mode 100644 index 00000000000..6563b281986 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleThree.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +public class InputXpathAnnotationUseStyleThree { + @SuppressWarnings({"common",}) //warn + public void foo() { + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleTwo.java new file mode 100644 index 00000000000..5932ff6c020 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/InputXpathAnnotationUseStyleTwo.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.annotationusestyle; + +@Deprecated //warn +public class InputXpathAnnotationUseStyleTwo { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleEight.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleEight.java deleted file mode 100644 index 11546e6b9f8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleEight.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@SuppressWarnings({"something",}) //warn -public class SuppressionXpathRegressionAnnotationUseStyleEight { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleFive.java deleted file mode 100644 index a6888344ea2..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleFive.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@SuppressWarnings(value={"foo", "bar"}) //warn -public class SuppressionXpathRegressionAnnotationUseStyleFive { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleFour.java deleted file mode 100644 index 4aa1c92d31f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleFour.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@SuppressWarnings({}) //warn -public class SuppressionXpathRegressionAnnotationUseStyleFour { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleOne.java deleted file mode 100644 index 7810c3ff28a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleOne.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@Deprecated -@SuppressWarnings({""}) //warn -public class SuppressionXpathRegressionAnnotationUseStyleOne { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleSeven.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleSeven.java deleted file mode 100644 index 0f2b8b72f3c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleSeven.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@Deprecated -@SuppressWarnings(value={"foo"}) //warn -public class SuppressionXpathRegressionAnnotationUseStyleSeven { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleSix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleSix.java deleted file mode 100644 index b604edb86ba..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleSix.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@SuppressWarnings({"foo", "bar"}) //warn -public class SuppressionXpathRegressionAnnotationUseStyleSix { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleThree.java deleted file mode 100644 index 17d99624853..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleThree.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -public class SuppressionXpathRegressionAnnotationUseStyleThree { - @SuppressWarnings({"common",}) //warn - public void foo() { - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleTwo.java deleted file mode 100644 index 0d382fd8e2f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/annotationusestyle/SuppressionXpathRegressionAnnotationUseStyleTwo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.annotationusestyle; - -@Deprecated //warn -public class SuppressionXpathRegressionAnnotationUseStyleTwo { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/InputXpathAnonInnerLength.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/InputXpathAnonInnerLength.java new file mode 100644 index 00000000000..1ccacd68401 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/InputXpathAnonInnerLength.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.anoninnerlength; + +import java.util.Comparator; + +public class InputXpathAnonInnerLength { + public int compare(String v1, String v2) { + Comparator comp = new Comparator() { // warn: inner class is 6 lines (max=5) + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }; + return comp.compare(v1, v2); + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/InputXpathAnonInnerLengthDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/InputXpathAnonInnerLengthDefault.java new file mode 100644 index 00000000000..2c5df7d522e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/InputXpathAnonInnerLengthDefault.java @@ -0,0 +1,34 @@ +package org.checkstyle.suppressionxpathfilter.anoninnerlength; + +import java.util.Comparator; + +public class InputXpathAnonInnerLengthDefault { + public void test() { + Runnable runnable = new Runnable() { // warn: inner class is 26 lines (max=20) + @Override + public void run() { + int x = 10; + String s = ""; + switch (x) { + case 1: + s = "A"; + break; + case 2: + s = "B"; + break; + case 3: + s = "C"; + break; + case 4: + s = "D"; + break; + case 5: + s = "E"; + break; + default: + s = "X"; + } + } + }; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/SuppressionXpathRegressionAnonInnerLength.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/SuppressionXpathRegressionAnonInnerLength.java deleted file mode 100644 index 35d19b502c4..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/SuppressionXpathRegressionAnonInnerLength.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.anoninnerlength; - -import java.util.Comparator; - -public class SuppressionXpathRegressionAnonInnerLength { - public int compare(String v1, String v2) { - Comparator comp = new Comparator() { // warn: inner class is 6 lines (max=5) - @Override - public int compare(String s1, String s2) { - return s1.compareTo(s2); - } - }; - return comp.compare(v1, v2); - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/SuppressionXpathRegressionAnonInnerLengthDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/SuppressionXpathRegressionAnonInnerLengthDefault.java deleted file mode 100644 index e1bf8c704b9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/anoninnerlength/SuppressionXpathRegressionAnonInnerLengthDefault.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.anoninnerlength; - -import java.util.Comparator; - -public class SuppressionXpathRegressionAnonInnerLengthDefault { - public void test() { - Runnable runnable = new Runnable() { // warn: inner class is 26 lines (max=20) - @Override - public void run() { - int x = 10; - String s = ""; - switch (x) { - case 1: - s = "A"; - break; - case 2: - s = "B"; - break; - case 3: - s = "C"; - break; - case 4: - s = "D"; - break; - case 5: - s = "E"; - break; - default: - s = "X"; - } - } - }; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/InputXpathArrayTrailingCommaLinear.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/InputXpathArrayTrailingCommaLinear.java new file mode 100644 index 00000000000..9509f333bf2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/InputXpathArrayTrailingCommaLinear.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.arraytrailingcomma; + +public class InputXpathArrayTrailingCommaLinear +{ + int[] a1 = new int[] + { + 1, + 2, + 3, + }; + + int[] a2 = new int[] + { + 1, + 2, + 3 // warn + }; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/InputXpathArrayTrailingCommaMatrix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/InputXpathArrayTrailingCommaMatrix.java new file mode 100644 index 00000000000..3b05778da78 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/InputXpathArrayTrailingCommaMatrix.java @@ -0,0 +1,20 @@ +package org.checkstyle.suppressionxpathfilter.arraytrailingcomma; + +public class InputXpathArrayTrailingCommaMatrix +{ + int[][] d1 = new int[][] + { + {1, 2,}, + {3, 3,}, + {5, 6,}, + }; + + int[][] d2 = new int[][] + { + {1, + 2}, + {3, 3,}, + {5, 6,} // warn + }; + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/SuppressionXpathRegressionArrayTrailingCommaOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/SuppressionXpathRegressionArrayTrailingCommaOne.java deleted file mode 100644 index e60a014373c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/SuppressionXpathRegressionArrayTrailingCommaOne.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.arraytrailingcomma; - -public class SuppressionXpathRegressionArrayTrailingCommaOne -{ - int[] a1 = new int[] - { - 1, - 2, - 3, - }; - - int[] a2 = new int[] - { - 1, - 2, - 3 // warn - }; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/SuppressionXpathRegressionArrayTrailingCommaTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/SuppressionXpathRegressionArrayTrailingCommaTwo.java deleted file mode 100644 index 3b00c2f10bf..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytrailingcomma/SuppressionXpathRegressionArrayTrailingCommaTwo.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.arraytrailingcomma; - -public class SuppressionXpathRegressionArrayTrailingCommaTwo -{ - int[][] d1 = new int[][] - { - {1, 2,}, - {3, 3,}, - {5, 6,}, - }; - - int[][] d2 = new int[][] - { - {1, - 2}, - {3, 3,}, - {5, 6,} // warn - }; - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/InputXpathArrayTypeStyleMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/InputXpathArrayTypeStyleMethodDef.java new file mode 100644 index 00000000000..ec4e8bafad0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/InputXpathArrayTypeStyleMethodDef.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.arraytypestyle; + +public class InputXpathArrayTypeStyleMethodDef { + byte getData()[] { // warn + return null; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/InputXpathArrayTypeStyleVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/InputXpathArrayTypeStyleVariable.java new file mode 100644 index 00000000000..02ec7765a93 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/InputXpathArrayTypeStyleVariable.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.arraytypestyle; + +public class InputXpathArrayTypeStyleVariable { + String strings[]; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/SuppressionXpathRegressionArrayTypeStyleMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/SuppressionXpathRegressionArrayTypeStyleMethodDef.java deleted file mode 100644 index 4b6c0958c8f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/SuppressionXpathRegressionArrayTypeStyleMethodDef.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.arraytypestyle; - -public class SuppressionXpathRegressionArrayTypeStyleMethodDef { - byte getData()[] { // warn - return null; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/SuppressionXpathRegressionArrayTypeStyleVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/SuppressionXpathRegressionArrayTypeStyleVariable.java deleted file mode 100644 index 053f033b867..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/arraytypestyle/SuppressionXpathRegressionArrayTypeStyleVariable.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.arraytypestyle; - -public class SuppressionXpathRegressionArrayTypeStyleVariable { - String strings[]; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/InputXpathAvoidDoubleBraceInitializationClassFields.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/InputXpathAvoidDoubleBraceInitializationClassFields.java new file mode 100644 index 00000000000..c7f1366fe0d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/InputXpathAvoidDoubleBraceInitializationClassFields.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.avoiddoublebraceinitialization; + +import java.util.*; + +public class InputXpathAvoidDoubleBraceInitializationClassFields { + List list = new ArrayList() { //warn + {} + }; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/InputXpathAvoidDoubleBraceInitializationMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/InputXpathAvoidDoubleBraceInitializationMethodDef.java new file mode 100644 index 00000000000..dc9588336c0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/InputXpathAvoidDoubleBraceInitializationMethodDef.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.avoiddoublebraceinitialization; + +import java.util.HashSet; + +public class InputXpathAvoidDoubleBraceInitializationMethodDef { + public void test() { + new HashSet() {{ /** warn */ + add("foo"); + add("bar"); + }}; + } + + enum InnerEnum { + ; + {} + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/SuppressionXpathRegressionAvoidDoubleBraceInitialization.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/SuppressionXpathRegressionAvoidDoubleBraceInitialization.java deleted file mode 100644 index ed128f0141b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/SuppressionXpathRegressionAvoidDoubleBraceInitialization.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoiddoublebraceinitialization; - -import java.util.*; - -public class SuppressionXpathRegressionAvoidDoubleBraceInitialization { - List list = new ArrayList() { //warn - {} - }; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo.java deleted file mode 100644 index 44cce2d161e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoiddoublebraceinitialization/SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoiddoublebraceinitialization; - -import java.util.HashSet; - -public class SuppressionXpathRegressionAvoidDoubleBraceInitializationTwo { - public void test() { - new HashSet() {{ /** warn */ - add("foo"); - add("bar"); - }}; - } - - enum InnerEnum { - ; - {} - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersAllEscaped.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersAllEscaped.java new file mode 100644 index 00000000000..b5fa7ef1ce3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersAllEscaped.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; + +public class InputXpathAvoidEscapedUnicodeCharactersAllEscaped { + private String unitAbbrev9 = "\u03bcs"; /* warn */ + String allCharactersEscaped = "\u03bc\u03bc"; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersControlCharacters.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersControlCharacters.java new file mode 100644 index 00000000000..86ef0415927 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersControlCharacters.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; + +public class InputXpathAvoidEscapedUnicodeCharactersControlCharacters { + private String unitAbbrev9 = "\u03bcs"; /* warn */ + private String nonPrintableCharacter = "\u0008"; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersDefault.java new file mode 100644 index 00000000000..2d476fd06e6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersDefault.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; + +public class InputXpathAvoidEscapedUnicodeCharactersDefault { + private String unitAbbrev2 = "\u03bcs"; /* warn */ +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersNonPrintable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersNonPrintable.java new file mode 100644 index 00000000000..069598675a3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersNonPrintable.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; + +public class InputXpathAvoidEscapedUnicodeCharactersNonPrintable { + private String unitAbbrev9 = "\u03bcs"; /* warn */ + private String nonPrintableCharacter = "\ufeff"; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersTailComment.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersTailComment.java new file mode 100644 index 00000000000..f31f7264570 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/InputXpathAvoidEscapedUnicodeCharactersTailComment.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; + +public class InputXpathAvoidEscapedUnicodeCharactersTailComment { + /* warn */ private String unitAbbrev9 = "\u03bcs"; + String unitAbbrev = "\u03bcs"; // Greek letter mu, "s" +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped.java deleted file mode 100644 index b3ba68b1ab6..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; - -public class SuppressionXpathRegressionAvoidEscapedUnicodeCharactersAllEscaped { - private String unitAbbrev9 = "\u03bcs"; /* warn */ - String allCharactersEscaped = "\u03bc\u03bc"; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters.java deleted file mode 100644 index 2077c0f0476..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; - -public class SuppressionXpathRegressionAvoidEscapedUnicodeCharactersControlCharacters { - private String unitAbbrev9 = "\u03bcs"; /* warn */ - private String nonPrintableCharacter = "\u0008"; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault.java deleted file mode 100644 index 44f22770de0..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; - -public class SuppressionXpathRegressionAvoidEscapedUnicodeCharactersDefault { - private String unitAbbrev2 = "\u03bcs"; /* warn */ -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable.java deleted file mode 100644 index 1802a76b5eb..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; - -public class SuppressionXpathRegressionAvoidEscapedUnicodeCharactersNonPrintable { - private String unitAbbrev9 = "\u03bcs"; /* warn */ - private String nonPrintableCharacter = "\ufeff"; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment.java deleted file mode 100644 index c1a75705c4f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidescapedunicodecharacters/SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidescapedunicodecharacters; - -public class SuppressionXpathRegressionAvoidEscapedUnicodeCharactersTailComment { - /* warn */ private String unitAbbrev9 = "\u03bcs"; - String unitAbbrev = "\u03bcs"; // Greek letter mu, "s" -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsAssert.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsAssert.java new file mode 100644 index 00000000000..a1f1d82e1fa --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsAssert.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.avoidinlineconditionals; + +public class InputXpathAvoidInlineConditionalsAssert { + + void assertA(String a) { + // JLS §14.10 - The assert Statement + // assert Expression1 : Expression2 + assert a.equals(null) ? true : false : "Expression2"; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsAssign.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsAssign.java new file mode 100644 index 00000000000..49ec1783c58 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsAssign.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.avoidinlineconditionals; + +public class InputXpathAvoidInlineConditionalsAssign { + String b; + + void setB(String a) { + b = (a == null || a.length() < 1) ? null : a.substring(1); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsVariableDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsVariableDef.java new file mode 100644 index 00000000000..a44da170dba --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/InputXpathAvoidInlineConditionalsVariableDef.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.avoidinlineconditionals; + +public class InputXpathAvoidInlineConditionalsVariableDef { + String substring(String a) { + String b = (a == null || a.length() < 1) ? null : a.substring(1); // warn + return b; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsAssert.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsAssert.java deleted file mode 100644 index ffe5aacf788..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsAssert.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidinlineconditionals; - -public class SuppressionXpathRegressionAvoidInlineConditionalsAssert { - - void assertA(String a) { - // JLS §14.10 - The assert Statement - // assert Expression1 : Expression2 - assert a.equals(null) ? true : false : "Expression2"; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsAssign.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsAssign.java deleted file mode 100644 index 9e60848ecfe..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsAssign.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidinlineconditionals; - -public class SuppressionXpathRegressionAvoidInlineConditionalsAssign { - String b; - - void setB(String a) { - b = (a == null || a.length() < 1) ? null : a.substring(1); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsVariableDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsVariableDef.java deleted file mode 100644 index 0771f55b30a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidinlineconditionals/SuppressionXpathRegressionAvoidInlineConditionalsVariableDef.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidinlineconditionals; - -public class SuppressionXpathRegressionAvoidInlineConditionalsVariableDef { - String substring(String a) { - String b = (a == null || a.length() < 1) ? null : a.substring(1); // warn - return b; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksAllowedInSwitchCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksAllowedInSwitchCase.java new file mode 100644 index 00000000000..ef81149e29a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksAllowedInSwitchCase.java @@ -0,0 +1,26 @@ +package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; + +public class InputXpathAvoidNestedBlocksAllowedInSwitchCase { + + int s(int a) { + int x; + int y; + switch (a) { + case 0: + x = 1; + { // warn: statement outside block + y = -1; + break; + } + case 1: { // ok: allowInSwitchCase=true + x = 2; + y = -2; + break; + } + default: + x = 3; + y = -3; + } + return x + y; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksBreakOutside.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksBreakOutside.java new file mode 100644 index 00000000000..820fef6fe29 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksBreakOutside.java @@ -0,0 +1,19 @@ +package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; + +public class InputXpathAvoidNestedBlocksBreakOutside { + int s(int a) { + int x; + int y; + switch (a) { + case 0: { // warn: break outside block + x = 2; + y = -2; + } + break; + default: + x = 3; + y = -3; + } + return x + y; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksEmpty.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksEmpty.java new file mode 100644 index 00000000000..be16427fb09 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksEmpty.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; + +public class InputXpathAvoidNestedBlocksEmpty { + + void empty() { + {} // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksNotAllowedInSwitchCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksNotAllowedInSwitchCase.java new file mode 100644 index 00000000000..3d4f571418b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksNotAllowedInSwitchCase.java @@ -0,0 +1,20 @@ +package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; + +public class InputXpathAvoidNestedBlocksNotAllowedInSwitchCase { + + int s(int a) { + int x; + int y; + switch (a) { + case 0: { // warn: allowInSwitchCase=false + x = 2; + y = -2; + break; + } + default: + x = 3; + y = -3; + } + return x + y; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksVariable.java new file mode 100644 index 00000000000..09ff5c51da5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/InputXpathAvoidNestedBlocksVariable.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; + +public class InputXpathAvoidNestedBlocksVariable { + + void varAssign() { + int whichIsWhich = 0; + { // warn + whichIsWhich = 2; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksEmpty.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksEmpty.java deleted file mode 100644 index eacd47e4b8c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksEmpty.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; - -public class SuppressionXpathRegressionAvoidNestedBlocksEmpty { - - void empty() { - {} // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksSwitch1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksSwitch1.java deleted file mode 100644 index dbd423ffd2c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksSwitch1.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; - -public class SuppressionXpathRegressionAvoidNestedBlocksSwitch1 { - - int s(int a) { - int x; - int y; - switch (a) { - case 0: { // warn: break outside block - x = 0; - y = 0; - } - break; - case 1: - x = 1; - { // warn: statement outside block - y = -1; - break; - } - case 2: { // warn: allowInSwitchCase=false - x = 2; - y = -2; - break; - } - default: - x = 3; - y = -3; - } - return x + y; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksSwitch2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksSwitch2.java deleted file mode 100644 index f269bd95de4..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksSwitch2.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; - -public class SuppressionXpathRegressionAvoidNestedBlocksSwitch2 { - - int s(int a) { - int x; - int y; - switch (a) { - case 0: { // warn: break outside block - x = 0; - y = 0; - } - break; - case 1: - x = 1; - { // warn: statement outside block - y = -1; - break; - } - case 2: { // ok: allowInSwitchCase=true - x = 2; - y = -2; - break; - } - default: - x = 3; - y = -3; - } - return x + y; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksVariable.java deleted file mode 100644 index 67aabc6794f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnestedblocks/SuppressionXpathRegressionAvoidNestedBlocksVariable.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidnestedblocks; - -public class SuppressionXpathRegressionAvoidNestedBlocksVariable { - - void varAssign() { - int whichIsWhich = 0; - { // warn - whichIsWhich = 2; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/InputXpathAvoidNoArgumentSuperConstructorCallDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/InputXpathAvoidNoArgumentSuperConstructorCallDefault.java new file mode 100644 index 00000000000..5a86328c049 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/InputXpathAvoidNoArgumentSuperConstructorCallDefault.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.avoidnoargumentsuperconstructorcall; + +public class InputXpathAvoidNoArgumentSuperConstructorCallDefault { + InputXpathAvoidNoArgumentSuperConstructorCallDefault() { + super(); //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/InputXpathAvoidNoArgumentSuperConstructorCallInnerClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/InputXpathAvoidNoArgumentSuperConstructorCallInnerClass.java new file mode 100644 index 00000000000..c0323d6b5cd --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/InputXpathAvoidNoArgumentSuperConstructorCallInnerClass.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.avoidnoargumentsuperconstructorcall; + +public class InputXpathAvoidNoArgumentSuperConstructorCallInnerClass { + public void test() { + class Inner { + Inner() { + super(); /** warn */ + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall.java deleted file mode 100644 index 9df053da7f9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidnoargumentsuperconstructorcall; - -public class SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall { - SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCall() { - super(); //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCallInnerClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCallInnerClass.java deleted file mode 100644 index d7b8b9a8609..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidnoargumentsuperconstructorcall/SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCallInnerClass.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidnoargumentsuperconstructorcall; - -public class SuppressionXpathRegressionAvoidNoArgumentSuperConstructorCallInnerClass { - public void test() { - class Inner { - Inner() { - super(); /** warn */ - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/InputXpathAvoidStarImportOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/InputXpathAvoidStarImportOne.java new file mode 100644 index 00000000000..f491d30bb65 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/InputXpathAvoidStarImportOne.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidstarimport; + +import static javax.swing.WindowConstants.*; // warn + +public class InputXpathAvoidStarImportOne { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/InputXpathAvoidStarImportTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/InputXpathAvoidStarImportTwo.java new file mode 100644 index 00000000000..428c94a9360 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/InputXpathAvoidStarImportTwo.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.avoidstarimport; + +import java.util.Scanner; +import java.io.*; // warn + +public class InputXpathAvoidStarImportTwo { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/SuppressionXpathRegressionAvoidStarImport1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/SuppressionXpathRegressionAvoidStarImport1.java deleted file mode 100644 index cab4e116b7d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/SuppressionXpathRegressionAvoidStarImport1.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidstarimport; - -import static javax.swing.WindowConstants.*; // warn - -public class SuppressionXpathRegressionAvoidStarImport1 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/SuppressionXpathRegressionAvoidStarImport2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/SuppressionXpathRegressionAvoidStarImport2.java deleted file mode 100644 index 58702d9ac1b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstarimport/SuppressionXpathRegressionAvoidStarImport2.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidstarimport; - -import java.util.Scanner; -import java.io.*; // warn - -public class SuppressionXpathRegressionAvoidStarImport2 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/InputXpathAvoidStaticImportOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/InputXpathAvoidStaticImportOne.java new file mode 100644 index 00000000000..ebef008acde --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/InputXpathAvoidStaticImportOne.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidstaticimport; + +import static javax.swing.WindowConstants.*; // warn + +public class InputXpathAvoidStaticImportOne { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/InputXpathAvoidStaticImportTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/InputXpathAvoidStaticImportTwo.java new file mode 100644 index 00000000000..01d11c190cf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/InputXpathAvoidStaticImportTwo.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.avoidstaticimport; + +import static java.io.File.createTempFile; // warn + +public class InputXpathAvoidStaticImportTwo { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/SuppressionXpathRegressionAvoidStaticImport1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/SuppressionXpathRegressionAvoidStaticImport1.java deleted file mode 100644 index b8c5d436fdd..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/SuppressionXpathRegressionAvoidStaticImport1.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidstaticimport; - -import static javax.swing.WindowConstants.*; // warn - -public class SuppressionXpathRegressionAvoidStaticImport1 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/SuppressionXpathRegressionAvoidStaticImport2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/SuppressionXpathRegressionAvoidStaticImport2.java deleted file mode 100644 index 6bcfc7bd04a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/avoidstaticimport/SuppressionXpathRegressionAvoidStaticImport2.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.avoidstaticimport; - -import static java.io.File.createTempFile; // warn - -public class SuppressionXpathRegressionAvoidStaticImport2 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityCatchBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityCatchBlock.java new file mode 100644 index 00000000000..3a19cb5139f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityCatchBlock.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.booleanexpressioncomplexity; + +public class InputXpathBooleanExpressionComplexityCatchBlock { + public boolean methodOne() { + boolean a = true; + boolean b = false; + try { + a = b; + } catch(Exception e) { + boolean d = (a & b) | (b ^ a) | (a ^ b) | // warn + (a & b) | (b ^ a) | (a ^ b); + } + return true; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityClassFields.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityClassFields.java new file mode 100644 index 00000000000..e16d9af2175 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityClassFields.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.booleanexpressioncomplexity; + +public class InputXpathBooleanExpressionComplexityClassFields { + public void methodTwo() { + boolean a = true; + boolean b = false; + + boolean c = (a & b) | (b ^ a); // OK + boolean d = (a & b) | (b ^ a) | (a ^ b) | // warn + (a & b) | (b ^ a) | (a ^ b); + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityConditionals.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityConditionals.java new file mode 100644 index 00000000000..1e5dfe39b91 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/booleanexpressioncomplexity/InputXpathBooleanExpressionComplexityConditionals.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.booleanexpressioncomplexity; + +public class InputXpathBooleanExpressionComplexityConditionals { + public void methodThree() { + boolean a = true; + boolean b = false; + boolean c = true; + + if (((a && (b & a)) || (b ^ a))) { // warn + a = b; + } else if ((a || b) ^ (a && b)) { // OK + c = b; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameAnonymous.java new file mode 100644 index 00000000000..4eb8a94bbe9 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameAnonymous.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +public class InputXpathCatchParameterNameAnonymous { + class InnerClass { + InnerClass() { + new Runnable() { + @Override + public void run() { + try { + } catch (Exception e1) { + } try { + } catch (Exception E1) { // warn + } + } + }; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameEnum.java new file mode 100644 index 00000000000..7ee62d2e901 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameEnum.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +public enum InputXpathCatchParameterNameEnum { + VALUE { + @Override + public void method(String op) { + switch (op) { + case "x": + try { + } catch (Exception eX) { // warn + } + break; + } + } + }; + + public abstract void method(String op); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameInterface.java new file mode 100644 index 00000000000..44e139b2352 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameInterface.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +interface InputXpathCatchParameterNameInterface { + interface InnerInterface { + default void method() { + try { + } catch (Exception EX) { // warn + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameLambda.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameLambda.java new file mode 100644 index 00000000000..2bfb9cf8c87 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameLambda.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +import java.util.function.Function; + +abstract class InputXpathCatchParameterNameLambda { + abstract void abstracMethod(); + + private final Function lambdaFunction = a -> { + Integer i = a; + for (; i > 10; i--) { + try { + } catch (Exception e) { // warn + } + } + return i; + }; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameNested.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameNested.java new file mode 100644 index 00000000000..b81cc36c2a7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameNested.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +public class InputXpathCatchParameterNameNested { + public static class NestedClass { + void method() { + if (true) { + try { + try { + } catch (Exception i) { // warn + } + } catch (Exception e) { + } + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameSimple.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameSimple.java new file mode 100644 index 00000000000..7fda2b7c818 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameSimple.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +public class InputXpathCatchParameterNameSimple { + void method() { + try { + } catch (Exception e1) { // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameStaticInit.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameStaticInit.java new file mode 100644 index 00000000000..9f0f27bb31a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/catchparametername/InputXpathCatchParameterNameStaticInit.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.catchparametername; + +public class InputXpathCatchParameterNameStaticInit { + static { + do { + try { + } catch (Exception Ex) { // warn + try { + } catch (Exception e1) { + } + } + } while (false); + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/InputXpathClassMemberImpliedModifierEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/InputXpathClassMemberImpliedModifierEnum.java new file mode 100644 index 00000000000..308f916cbe9 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/InputXpathClassMemberImpliedModifierEnum.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.classmemberimpliedmodifier; + +public class InputXpathClassMemberImpliedModifierEnum { + public enum Count { //warn + ONE, TWO, THREE; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/InputXpathClassMemberImpliedModifierInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/InputXpathClassMemberImpliedModifierInterface.java new file mode 100644 index 00000000000..52d9da03afc --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/InputXpathClassMemberImpliedModifierInterface.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.classmemberimpliedmodifier; + +public class InputXpathClassMemberImpliedModifierInterface { + public interface Foo { //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/SuppressionXpathRegressionClassMemberImpliedModifierOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/SuppressionXpathRegressionClassMemberImpliedModifierOne.java deleted file mode 100644 index 69ca9275850..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/SuppressionXpathRegressionClassMemberImpliedModifierOne.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.classmemberimpliedmodifier; - -public class SuppressionXpathRegressionClassMemberImpliedModifierOne { - public interface Foo { //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/SuppressionXpathRegressionClassMemberImpliedModifierTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/SuppressionXpathRegressionClassMemberImpliedModifierTwo.java deleted file mode 100644 index dfbfb9d42fe..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/classmemberimpliedmodifier/SuppressionXpathRegressionClassMemberImpliedModifierTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.classmemberimpliedmodifier; - -public class SuppressionXpathRegressionClassMemberImpliedModifierTwo { - public enum Count { //warn - ONE, TWO, THREE; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationBlock.java new file mode 100644 index 00000000000..4fb16661a86 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationBlock.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationBlock { + /* // warn + * Javadoc comment + */ + float f; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationDistributedStatement.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationDistributedStatement.java new file mode 100644 index 00000000000..98e9066a863 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationDistributedStatement.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +import java.util.Arrays; + +public class InputXpathCommentsIndentationDistributedStatement { + public void foo() { + String s = ""; + int n = s + .length(); + // Comment // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationEmptyCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationEmptyCase.java new file mode 100644 index 00000000000..8f4dc0dfd1a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationEmptyCase.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationEmptyCase { + int n; + + public void foo() { + switch(n) { + case 1: +// Comment // warn + default: + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationNonEmptyCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationNonEmptyCase.java new file mode 100644 index 00000000000..b1ff3cbbf20 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationNonEmptyCase.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationNonEmptyCase { + int n; + + public void foo() { + switch(n) { + case 1: + if (true) {} + // Comment // warn + default: + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSeparator.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSeparator.java new file mode 100644 index 00000000000..6fa183157ed --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSeparator.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationSeparator { + public void main(String[] args) { + int n; + } + + /////////////// Comment separator // warn + + public void foo() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSingleLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSingleLine.java new file mode 100644 index 00000000000..227bd47d3fa --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSingleLine.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationSingleLine { + int n; + // Comment // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSingleLineBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSingleLineBlock.java new file mode 100644 index 00000000000..b0a22166645 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationSingleLineBlock.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationSingleLineBlock { + public void foo() { +// Single Line +// block Comment // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationWithinBlockStatement.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationWithinBlockStatement.java new file mode 100644 index 00000000000..70bb3990841 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/InputXpathCommentsIndentationWithinBlockStatement.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.commentsindentation; + +public class InputXpathCommentsIndentationWithinBlockStatement { + public void foo() { + String s = "F" + // Comment // warn + + "O" + + "O"; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationBlock.java deleted file mode 100644 index f760b34bdf9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationBlock.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationBlock { - /* // warn - * Javadoc comment - */ - float f; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationDistributedStatement.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationDistributedStatement.java deleted file mode 100644 index 40c84c8c6b9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationDistributedStatement.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -import java.util.Arrays; - -public class SuppressionXpathRegressionCommentsIndentationDistributedStatement { - public void foo() { - String s = ""; - int n = s - .length(); - // Comment // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationEmptyCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationEmptyCase.java deleted file mode 100644 index 22effa12561..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationEmptyCase.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationEmptyCase { - int n; - - public void foo() { - switch(n) { - case 1: -// Comment // warn - default: - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationNonEmptyCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationNonEmptyCase.java deleted file mode 100644 index c3f4d8f77f7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationNonEmptyCase.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationNonEmptyCase { - int n; - - public void foo() { - switch(n) { - case 1: - if (true) {} - // Comment // warn - default: - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSeparator.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSeparator.java deleted file mode 100644 index 7a573524a64..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSeparator.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationSeparator { - public void main(String[] args) { - int n; - } - - /////////////// Comment separator // warn - - public void foo() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSingleLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSingleLine.java deleted file mode 100644 index c689c15c6ad..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSingleLine.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationSingleLine { - int n; - // Comment // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSingleLineBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSingleLineBlock.java deleted file mode 100644 index 4c8f6feec52..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationSingleLineBlock.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationSingleLineBlock { - public void foo() { -// Single Line -// block Comment // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationWithinBlockStatement.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationWithinBlockStatement.java deleted file mode 100644 index 3f6fade8191..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/commentsindentation/SuppressionXpathRegressionCommentsIndentationWithinBlockStatement.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.commentsindentation; - -public class SuppressionXpathRegressionCommentsIndentationWithinBlockStatement { - public void foo() { - String s = "F" - // Comment // warn - + "O" - + "O"; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameCamelCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameCamelCase.java new file mode 100644 index 00000000000..a919a7c932f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameCamelCase.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.constantname; + +public class InputXpathConstantNameCamelCase { + public static final int badConstant = 2; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameLowercase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameLowercase.java new file mode 100644 index 00000000000..20cae75b8de --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameLowercase.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.constantname; + +public class InputXpathConstantNameLowercase { + public static final int number = 7; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameWithBeginningUnderscore.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameWithBeginningUnderscore.java new file mode 100644 index 00000000000..977b2d5b7e1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameWithBeginningUnderscore.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.constantname; + +public class InputXpathConstantNameWithBeginningUnderscore { + private static final String _CONSTANT = "a"; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameWithTwoUnderscores.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameWithTwoUnderscores.java new file mode 100644 index 00000000000..55c52f6af36 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/InputXpathConstantNameWithTwoUnderscores.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.constantname; + +public class InputXpathConstantNameWithTwoUnderscores { + private static final int BAD__NAME = 3; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameCamelCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameCamelCase.java deleted file mode 100644 index 95b4b1c05da..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameCamelCase.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.constantname; - -public class SuppressionXpathRegressionConstantNameCamelCase { - public static final int badConstant = 2; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameLowercase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameLowercase.java deleted file mode 100644 index bda9d2cf6d5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameLowercase.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.constantname; - -public class SuppressionXpathRegressionConstantNameLowercase { - public static final int number = 7; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameWithBeginningUnderscore.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameWithBeginningUnderscore.java deleted file mode 100644 index 4bff90c149a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameWithBeginningUnderscore.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.constantname; - -public class SuppressionXpathRegressionConstantNameWithBeginningUnderscore { - private static final String _CONSTANT = "a"; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameWithTwoUnderscores.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameWithTwoUnderscores.java deleted file mode 100644 index b2c1a20ce9e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/constantname/SuppressionXpathRegressionConstantNameWithTwoUnderscores.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.constantname; - -public class SuppressionXpathRegressionConstantNameWithTwoUnderscores { - private static final int BAD__NAME = 3; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingClass.java new file mode 100644 index 00000000000..925a9881163 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingClass.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.constructorsdeclarationgrouping; + +public class InputXpathConstructorsDeclarationGroupingClass { + InputXpathConstructorsDeclarationGroupingClass() {} + + InputXpathConstructorsDeclarationGroupingClass(int a) {} + + int x; + + InputXpathConstructorsDeclarationGroupingClass(String str) {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingEnum.java new file mode 100644 index 00000000000..5b41b807e06 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/constructorsdeclarationgrouping/InputXpathConstructorsDeclarationGroupingEnum.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.constructorsdeclarationgrouping; + +public enum InputXpathConstructorsDeclarationGroupingEnum { + ONE; + + InputXpathConstructorsDeclarationGroupingEnum() {} + + InputXpathConstructorsDeclarationGroupingEnum(String str) {} + + int f; + + InputXpathConstructorsDeclarationGroupingEnum(int x) {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInClass.java new file mode 100644 index 00000000000..8a2c341fea2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInClass.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.covariantequals; + +public class InputXpathCovariantEqualsInClass { + + public boolean equals(InputXpathCovariantEqualsInClass i) { // warn + return false; + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInEnum.java new file mode 100644 index 00000000000..80eb5e7017a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/InputXpathCovariantEqualsInEnum.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.covariantequals; + +public enum InputXpathCovariantEqualsInEnum { + + EQUALS; + + public boolean equals(InputXpathCovariantEqualsInEnum i) { // warn + return false; + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInClass.java deleted file mode 100644 index 7b71091052a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInClass.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.covariantequals; - -public class SuppressionXpathRegressionCovariantEqualsInClass { - - public boolean equals(SuppressionXpathRegressionCovariantEqualsInClass i) { // warn - return false; - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInEnum.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInEnum.java deleted file mode 100644 index 28de41773da..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/covariantequals/SuppressionXpathRegressionCovariantEqualsInEnum.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.covariantequals; - -public enum SuppressionXpathRegressionCovariantEqualsInEnum { - - EQUALS; - - public boolean equals(SuppressionXpathRegressionCovariantEqualsInEnum i) { // warn - return false; - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderFive.java new file mode 100644 index 00000000000..9af2dd37bfd --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderFive.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.customimportorder; + +import static java.util.Arrays.sort; + +import java.io.File; +import java.io.FileInputStream; +import static java.lang.Math.PI; // warn +import java.util.HashMap; +import java.util.Scanner; + +public class InputXpathCustomImportOrderFive { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderFour.java new file mode 100644 index 00000000000..4463824e61a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderFour.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.customimportorder; + +import static java.util.Arrays.sort; +import static java.lang.Math.PI; +import com.puppycrawl.tools.checkstyle.api.DetailAST; // warn + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Scanner; + +public class InputXpathCustomImportOrderFour { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderOne.java new file mode 100644 index 00000000000..a30e51f3e69 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderOne.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.customimportorder; + +import static java.util.Arrays.sort; +import static java.lang.Math.PI; // warn + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Scanner; + +public class InputXpathCustomImportOrderOne { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderSix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderSix.java new file mode 100644 index 00000000000..8ef832df7b9 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderSix.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.customimportorder; + +import static java.util.Arrays.sort; +import static java.lang.Math.PI; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; // warn + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Scanner; + +public class InputXpathCustomImportOrderSix { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderThree.java new file mode 100644 index 00000000000..e3148c54742 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderThree.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.customimportorder; + +import static java.util.Arrays.sort; + +import static java.lang.Math.PI; // warn + +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Scanner; + +public class InputXpathCustomImportOrderThree { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderTwo.java new file mode 100644 index 00000000000..77ee3c42279 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/InputXpathCustomImportOrderTwo.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.customimportorder; + +import static java.util.Arrays.sort; +import static java.lang.Math.PI; +import java.io.File; // warn +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.Scanner; + +public class InputXpathCustomImportOrderTwo { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderFive.java deleted file mode 100644 index eaee6967524..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderFive.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.customimportorder; - -import static java.util.Arrays.sort; - -import java.io.File; -import java.io.FileInputStream; -import static java.lang.Math.PI; // warn -import java.util.HashMap; -import java.util.Scanner; - -public class SuppressionXpathRegressionCustomImportOrderFive { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderFour.java deleted file mode 100644 index bba7d260147..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderFour.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.customimportorder; - -import static java.util.Arrays.sort; -import static java.lang.Math.PI; -import com.puppycrawl.tools.checkstyle.api.DetailAST; // warn - -import java.io.File; -import java.io.FileInputStream; -import java.util.HashMap; -import java.util.Scanner; - -public class SuppressionXpathRegressionCustomImportOrderFour { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderOne.java deleted file mode 100644 index e9837309db8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderOne.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.customimportorder; - -import static java.util.Arrays.sort; -import static java.lang.Math.PI; // warn - -import java.io.File; -import java.io.FileInputStream; -import java.util.HashMap; -import java.util.Scanner; - -public class SuppressionXpathRegressionCustomImportOrderOne { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderSix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderSix.java deleted file mode 100644 index 77c9b37fe26..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderSix.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.customimportorder; - -import static java.util.Arrays.sort; -import static java.lang.Math.PI; - -import com.puppycrawl.tools.checkstyle.api.DetailAST; // warn - -import java.io.File; -import java.io.FileInputStream; -import java.util.HashMap; -import java.util.Scanner; - -public class SuppressionXpathRegressionCustomImportOrderSix { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderThree.java deleted file mode 100644 index cade4b0e750..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderThree.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.customimportorder; - -import static java.util.Arrays.sort; - -import static java.lang.Math.PI; // warn - -import java.io.File; -import java.io.FileInputStream; -import java.util.HashMap; -import java.util.Scanner; - -public class SuppressionXpathRegressionCustomImportOrderThree { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderTwo.java deleted file mode 100644 index e85ba270c0f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/customimportorder/SuppressionXpathRegressionCustomImportOrderTwo.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.customimportorder; - -import static java.util.Arrays.sort; -import static java.lang.Math.PI; -import java.io.File; // warn -import java.io.FileInputStream; -import java.util.HashMap; -import java.util.Scanner; - -public class SuppressionXpathRegressionCustomImportOrderTwo { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/InputXpathCyclomaticComplexityConditionals.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/InputXpathCyclomaticComplexityConditionals.java new file mode 100644 index 00000000000..9adc4742021 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/InputXpathCyclomaticComplexityConditionals.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.cyclomaticcomplexity; + +public class InputXpathCyclomaticComplexityConditionals { + public void test(int a, int b) { //warn + if (a > b) { + + } else { + + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/InputXpathCyclomaticComplexitySwitchBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/InputXpathCyclomaticComplexitySwitchBlock.java new file mode 100644 index 00000000000..fc503199de9 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/InputXpathCyclomaticComplexitySwitchBlock.java @@ -0,0 +1,25 @@ +package org.checkstyle.suppressionxpathfilter.cyclomaticcomplexity; + +public class InputXpathCyclomaticComplexitySwitchBlock { + + + public void foo2() { //warn + String programmingLanguage = "Java"; + switch (programmingLanguage) { + case "Java": + case "C#": + case "C++": + String.CASE_INSENSITIVE_ORDER.equals(programmingLanguage + + " is an object oriented programming language."); + break; + case "C": + String.CASE_INSENSITIVE_ORDER.equals(programmingLanguage + + " is not an object oriented programming language."); + break; + default: + String.CASE_INSENSITIVE_ORDER.equals(programmingLanguage + + " is unknown language."); + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/SuppressionXpathRegressionCyclomaticComplexityOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/SuppressionXpathRegressionCyclomaticComplexityOne.java deleted file mode 100644 index f13c30fe797..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/SuppressionXpathRegressionCyclomaticComplexityOne.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.cyclomaticcomplexity; - -public class SuppressionXpathRegressionCyclomaticComplexityOne { - public void test(int a, int b) { //warn - if (a > b) { - - } else { - - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/SuppressionXpathRegressionCyclomaticComplexityTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/SuppressionXpathRegressionCyclomaticComplexityTwo.java deleted file mode 100644 index 110b1029892..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/cyclomaticcomplexity/SuppressionXpathRegressionCyclomaticComplexityTwo.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.cyclomaticcomplexity; - -public class SuppressionXpathRegressionCyclomaticComplexityTwo { - - - public void foo2() { //warn - String programmingLanguage = "Java"; - switch (programmingLanguage) { - case "Java": - case "C#": - case "C++": - String.CASE_INSENSITIVE_ORDER.equals(programmingLanguage - + " is an object oriented programming language."); - break; - case "C": - String.CASE_INSENSITIVE_ORDER.equals(programmingLanguage - + " is not an object oriented programming language."); - break; - default: - String.CASE_INSENSITIVE_ORDER.equals(programmingLanguage - + " is unknown language."); - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/InputXpathDeclarationOrderNonStatic.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/InputXpathDeclarationOrderNonStatic.java new file mode 100644 index 00000000000..b49ab808fdf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/InputXpathDeclarationOrderNonStatic.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.declarationorder; + +public class InputXpathDeclarationOrderNonStatic { + private int age; + public String name; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/InputXpathDeclarationOrderStatic.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/InputXpathDeclarationOrderStatic.java new file mode 100644 index 00000000000..a0b19c7f25a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/InputXpathDeclarationOrderStatic.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.declarationorder; + +public class InputXpathDeclarationOrderStatic { + public static void foo1() {} + public static final double MAX = 0.60; //warn + public static void foo2() {} +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/SuppressionXpathRegressionDeclarationOrderOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/SuppressionXpathRegressionDeclarationOrderOne.java deleted file mode 100644 index e2f252f4781..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/SuppressionXpathRegressionDeclarationOrderOne.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.declarationorder; - -public class SuppressionXpathRegressionDeclarationOrderOne { - private int age; - public String name; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/SuppressionXpathRegressionDeclarationOrderTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/SuppressionXpathRegressionDeclarationOrderTwo.java deleted file mode 100644 index da419e17099..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/declarationorder/SuppressionXpathRegressionDeclarationOrderTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.declarationorder; - -public class SuppressionXpathRegressionDeclarationOrderTwo { - public static void foo1() {} - public static final double MAX = 0.60; //warn - public static void foo2() {} -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/InputXpathDefaultComesLastEmptyCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/InputXpathDefaultComesLastEmptyCase.java new file mode 100644 index 00000000000..04cbd0b4e98 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/InputXpathDefaultComesLastEmptyCase.java @@ -0,0 +1,22 @@ +package org.checkstyle.suppressionxpathfilter.defaultcomeslast; + +public class InputXpathDefaultComesLastEmptyCase { + public void test(int i) { + switch (i) { + case 1: + default: + break; + case 2: + break; + } + + switch (i) { + case 1: + default: //warn + case 2: + break; + case 3: + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/InputXpathDefaultComesLastNonEmptyCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/InputXpathDefaultComesLastNonEmptyCase.java new file mode 100644 index 00000000000..63ca796837c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/InputXpathDefaultComesLastNonEmptyCase.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.defaultcomeslast; + +public class InputXpathDefaultComesLastNonEmptyCase { + public void test() { + String lang = "Java"; + int id = 0; + switch (lang) { + default : id = -1; //warn + case "C++" : id = 1; break; + case "Python" : id = 2; break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/SuppressionXpathRegressionDefaultComesLastOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/SuppressionXpathRegressionDefaultComesLastOne.java deleted file mode 100644 index f05f9b2422b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/SuppressionXpathRegressionDefaultComesLastOne.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.defaultcomeslast; - -public class SuppressionXpathRegressionDefaultComesLastOne { - public void test() { - String lang = "Java"; - int id = 0; - switch (lang) { - default : id = -1; //warn - case "C++" : id = 1; break; - case "Python" : id = 2; break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/SuppressionXpathRegressionDefaultComesLastTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/SuppressionXpathRegressionDefaultComesLastTwo.java deleted file mode 100644 index 6e401ea4208..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/defaultcomeslast/SuppressionXpathRegressionDefaultComesLastTwo.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.defaultcomeslast; - -public class SuppressionXpathRegressionDefaultComesLastTwo { - public void test(int i) { - switch (i) { - case 1: - default: - break; - case 2: - break; - } - - switch (i) { - case 1: - default: //warn - case 2: - break; - case 3: - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyblock/InputXpathEmptyBlockEmpty.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyblock/InputXpathEmptyBlockEmpty.java new file mode 100644 index 00000000000..110b46909c4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyblock/InputXpathEmptyBlockEmpty.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.emptyblock; + +public class InputXpathEmptyBlockEmpty { + private void emptyLoop() { + for (int i = 0; i < 10; i++) {} // warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyblock/SuppressionXpathRegressionEmptyBlockEmpty.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyblock/SuppressionXpathRegressionEmptyBlockEmpty.java deleted file mode 100644 index 7a078b8dcee..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyblock/SuppressionXpathRegressionEmptyBlockEmpty.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptyblock; - -public class SuppressionXpathRegressionEmptyBlockEmpty { - private void emptyLoop() { - for (int i = 0; i < 10; i++) {} // warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/InputXpathEmptyCatchBlockOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/InputXpathEmptyCatchBlockOne.java new file mode 100644 index 00000000000..aa61045cbbf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/InputXpathEmptyCatchBlockOne.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.emptycatchblock; + +public class InputXpathEmptyCatchBlockOne { + public static void main(String[] args) { + + try { + throw new RuntimeException(); + } catch (RuntimeException e) {} //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/InputXpathEmptyCatchBlockTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/InputXpathEmptyCatchBlockTwo.java new file mode 100644 index 00000000000..dc90e2be539 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/InputXpathEmptyCatchBlockTwo.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.emptycatchblock; + +public class InputXpathEmptyCatchBlockTwo { + public static void main(String[] args) { + + try { + throw new RuntimeException(); + } catch (RuntimeException e) /*warn*/ { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/SuppressionXpathRegressionEmptyCatchBlock1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/SuppressionXpathRegressionEmptyCatchBlock1.java deleted file mode 100644 index 97c58ccac5b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/SuppressionXpathRegressionEmptyCatchBlock1.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptycatchblock; - -public class SuppressionXpathRegressionEmptyCatchBlock1 { - public static void main(String[] args) { - - try { - throw new RuntimeException(); - } catch (RuntimeException e) {} //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/SuppressionXpathRegressionEmptyCatchBlock2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/SuppressionXpathRegressionEmptyCatchBlock2.java deleted file mode 100644 index 8627de4634e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptycatchblock/SuppressionXpathRegressionEmptyCatchBlock2.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptycatchblock; - -public class SuppressionXpathRegressionEmptyCatchBlock2 { - public static void main(String[] args) { - - try { - throw new RuntimeException(); - } catch (RuntimeException e) /*warn*/ { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/InputXpathEmptyForInitializerPadNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/InputXpathEmptyForInitializerPadNotPreceded.java new file mode 100644 index 00000000000..3e1d4aa2160 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/InputXpathEmptyForInitializerPadNotPreceded.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.emptyforinitializerpad; + +public class InputXpathEmptyForInitializerPadNotPreceded { + void method(int bad, int good) { + for (; bad < 1; bad++ ) {//warn + } + for ( ; good < 2; good++ ) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/InputXpathEmptyForInitializerPadPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/InputXpathEmptyForInitializerPadPreceded.java new file mode 100644 index 00000000000..ee94d554412 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/InputXpathEmptyForInitializerPadPreceded.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.emptyforinitializerpad; + +public class InputXpathEmptyForInitializerPadPreceded { + void method(int bad, int good) { + for ( ; bad < 1; bad++ ) {//warn + } + for (; good < 2; good++ ) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/SuppressionXpathRegressionEmptyForInitializerPadNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/SuppressionXpathRegressionEmptyForInitializerPadNotPreceded.java deleted file mode 100644 index ea29614aba3..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/SuppressionXpathRegressionEmptyForInitializerPadNotPreceded.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptyforinitializerpad; - -public class SuppressionXpathRegressionEmptyForInitializerPadNotPreceded { - void method(int bad, int good) { - for (; bad < 1; bad++ ) {//warn - } - for ( ; good < 2; good++ ) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/SuppressionXpathRegressionEmptyForInitializerPadPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/SuppressionXpathRegressionEmptyForInitializerPadPreceded.java deleted file mode 100644 index 56787308207..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforinitializerpad/SuppressionXpathRegressionEmptyForInitializerPadPreceded.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptyforinitializerpad; - -public class SuppressionXpathRegressionEmptyForInitializerPadPreceded { - void method(int bad, int good) { - for ( ; bad < 1; bad++ ) {//warn - } - for (; good < 2; good++ ) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/InputXpathEmptyForIteratorPadFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/InputXpathEmptyForIteratorPadFollowed.java new file mode 100644 index 00000000000..96b10544294 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/InputXpathEmptyForIteratorPadFollowed.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.emptyforiteratorpad; + +public class InputXpathEmptyForIteratorPadFollowed { + void method(int bad, int good) { + for (bad = 0; ++bad < 1; ) {//warn + } + for (good = 0; ++good < 2;) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/InputXpathEmptyForIteratorPadNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/InputXpathEmptyForIteratorPadNotFollowed.java new file mode 100644 index 00000000000..1b538b9a706 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/InputXpathEmptyForIteratorPadNotFollowed.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.emptyforiteratorpad; + +public class InputXpathEmptyForIteratorPadNotFollowed { + void method(int bad, int good) { + for (bad = 0; ++bad < 2;) {//warn + } + for (good = 0; ++good < 1; ) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/SuppressionXpathRegressionEmptyForIteratorPadFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/SuppressionXpathRegressionEmptyForIteratorPadFollowed.java deleted file mode 100644 index cceae02bd9f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/SuppressionXpathRegressionEmptyForIteratorPadFollowed.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptyforiteratorpad; - -public class SuppressionXpathRegressionEmptyForIteratorPadFollowed { - void method(int bad, int good) { - for (bad = 0; ++bad < 1; ) {//warn - } - for (good = 0; ++good < 2;) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/SuppressionXpathRegressionEmptyForIteratorPadNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/SuppressionXpathRegressionEmptyForIteratorPadNotFollowed.java deleted file mode 100644 index 282516add90..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptyforiteratorpad/SuppressionXpathRegressionEmptyForIteratorPadNotFollowed.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptyforiteratorpad; - -public class SuppressionXpathRegressionEmptyForIteratorPadNotFollowed { - void method(int bad, int good) { - for (bad = 0; ++bad < 2;) {//warn - } - for (good = 0; ++good < 1; ) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorFive.java new file mode 100644 index 00000000000..cc9486393f5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorFive.java @@ -0,0 +1,22 @@ +package org.checkstyle.suppressionxpathfilter.emptylineseparator; + +import java.io.IOException; + +public class InputXpathEmptyLineSeparatorFive { + + int foo1() throws Exception { + int a = 1; + int b = 2; + try { + if (a != b) { + throw new IOException(); + } + // warn + + + } catch(IOException e) { + return 1; + } + return 0; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorFour.java new file mode 100644 index 00000000000..9ebe69cf295 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorFour.java @@ -0,0 +1,15 @@ +/////////////////////////////////////////////////// +//HEADER +/////////////////////////////////////////////////// + +package org.checkstyle.suppressionxpathfilter.emptylineseparator; + +class InputXpathEmptyLineSeparatorFour { + public static final int FOO_CONST = 1; + + public void foo() {} + + public void foo1() {} // warn + + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorOne.java similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator1.java rename to src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorOne.java diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorThree.java new file mode 100644 index 00000000000..f2beb9314cf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorThree.java @@ -0,0 +1,10 @@ +/////////////////////////////////////////////////// +//HEADER +/////////////////////////////////////////////////// +package org.checkstyle.suppressionxpathfilter.emptylineseparator; +import java.io.*; +class InputXpathEmptyLineSeparatorThree { + public static final int FOO_CONST = 1; + public void foo() {} + public void foo1() {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorTwo.java similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator2.java rename to src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/InputXpathEmptyLineSeparatorTwo.java diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator3.java deleted file mode 100644 index 84616eb5f39..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator3.java +++ /dev/null @@ -1,10 +0,0 @@ -/////////////////////////////////////////////////// -//HEADER -/////////////////////////////////////////////////// -package org.checkstyle.suppressionxpathfilter.emptylineseparator; -import java.io.*; -class SuppressionXpathRegressionEmptyLineSeparator3 { - public static final int FOO_CONST = 1; - public void foo() {} - public void foo1() {} // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator4.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator4.java deleted file mode 100644 index 6a23443ad00..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator4.java +++ /dev/null @@ -1,15 +0,0 @@ -/////////////////////////////////////////////////// -//HEADER -/////////////////////////////////////////////////// - -package org.checkstyle.suppressionxpathfilter.emptylineseparator; - -class SuppressionXpathRegressionEmptyLineSeparator4 { - public static final int FOO_CONST = 1; - - public void foo() {} - - public void foo1() {} // warn - - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator5.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator5.java deleted file mode 100644 index 38086505d84..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptylineseparator/SuppressionXpathRegressionEmptyLineSeparator5.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptylineseparator; - -import java.io.IOException; - -public class SuppressionXpathRegressionEmptyLineSeparator5 { - - int foo1() throws Exception { - int a = 1; - int b = 2; - try { - if (a != b) { - throw new IOException(); - } - // warn - - - } catch(IOException e) { - return 1; - } - return 0; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/InputXpathEmptyStatementConditionals.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/InputXpathEmptyStatementConditionals.java new file mode 100644 index 00000000000..5b9babce63f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/InputXpathEmptyStatementConditionals.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.emptystatement; + +public class InputXpathEmptyStatementConditionals { + public void foo() { + int i = 0; + if (i > 3); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/InputXpathEmptyStatementLoops.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/InputXpathEmptyStatementLoops.java new file mode 100644 index 00000000000..217c0cef2ad --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/InputXpathEmptyStatementLoops.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.emptystatement; + +public class InputXpathEmptyStatementLoops { + public void foo() { + for (int i = 0; i < 5; i++); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/SuppressionXpathRegressionEmptyStatement1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/SuppressionXpathRegressionEmptyStatement1.java deleted file mode 100644 index 7fcc83dd48b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/SuppressionXpathRegressionEmptyStatement1.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptystatement; - -public class SuppressionXpathRegressionEmptyStatement1 { - public void foo() { - for (int i = 0; i < 5; i++); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/SuppressionXpathRegressionEmptyStatement2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/SuppressionXpathRegressionEmptyStatement2.java deleted file mode 100644 index 3e254e5764a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/emptystatement/SuppressionXpathRegressionEmptyStatement2.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.emptystatement; - -public class SuppressionXpathRegressionEmptyStatement2 { - public void foo() { - int i = 0; - if (i > 3); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/InputXpathEqualsAvoidNull.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/InputXpathEqualsAvoidNull.java new file mode 100644 index 00000000000..1e7c41945d6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/InputXpathEqualsAvoidNull.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.equalsavoidnull; + +public class InputXpathEqualsAvoidNull { + public void test() { + String nullString = null; + nullString.equals("Another string"); //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/InputXpathEqualsAvoidNullIgnoreCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/InputXpathEqualsAvoidNullIgnoreCase.java new file mode 100644 index 00000000000..a6762b01f47 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/InputXpathEqualsAvoidNullIgnoreCase.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.equalsavoidnull; + +public class InputXpathEqualsAvoidNullIgnoreCase { + public void test() { + String nullString = null; + nullString.equalsIgnoreCase("Another string"); //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/SuppressionXpathRegressionEqualsAvoidNull.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/SuppressionXpathRegressionEqualsAvoidNull.java deleted file mode 100644 index 551cecbfc48..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/SuppressionXpathRegressionEqualsAvoidNull.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.equalsavoidnull; - -public class SuppressionXpathRegressionEqualsAvoidNull { - public void test() { - String nullString = null; - nullString.equals("Another string"); //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/SuppressionXpathRegressionEqualsAvoidNullIgnoreCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/SuppressionXpathRegressionEqualsAvoidNullIgnoreCase.java deleted file mode 100644 index 892fcb79a27..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalsavoidnull/SuppressionXpathRegressionEqualsAvoidNullIgnoreCase.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.equalsavoidnull; - -public class SuppressionXpathRegressionEqualsAvoidNullIgnoreCase { - public void test() { - String nullString = null; - nullString.equalsIgnoreCase("Another string"); //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeEqualsOnly.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeEqualsOnly.java new file mode 100644 index 00000000000..f18f089bd3e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeEqualsOnly.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.equalshashcode; + +public class InputXpathEqualsHashCodeEqualsOnly { + public boolean equals(Object obj) { // warn + return false; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeHashCodeOnly.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeHashCodeOnly.java new file mode 100644 index 00000000000..377992f1472 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeHashCodeOnly.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.equalshashcode; + +public class InputXpathEqualsHashCodeHashCodeOnly { + public int hashCode() { // warn + return 0; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeNestedCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeNestedCase.java new file mode 100644 index 00000000000..69b2c7b6403 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/equalshashcode/InputXpathEqualsHashCodeNestedCase.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.equalshashcode; + +public class InputXpathEqualsHashCodeNestedCase { + public static class innerClass { + public boolean equals(Object obj) { // warn + return false; + } + } +} + diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountCustomMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountCustomMax.java new file mode 100644 index 00000000000..71af3de777b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountCustomMax.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.executablestatementcount; + +public class InputXpathExecutableStatementCountCustomMax { + public InputXpathExecutableStatementCountCustomMax() // warn + { + int i = 1; + if (System.currentTimeMillis() == 0) { + } else if (System.currentTimeMillis() == 0) { + } else { + } + } + /** Empty constructor */ + public InputXpathExecutableStatementCountCustomMax(int i) {} +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountDefault.java new file mode 100644 index 00000000000..dda072f955f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountDefault.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.executablestatementcount; + +public class InputXpathExecutableStatementCountDefault { + public void ElseIfLadder() { // warn + if (System.currentTimeMillis() == 0) { + } else { + if (System.currentTimeMillis() == 0) { + } else { + if (System.currentTimeMillis() == 0) { + } + } + + if (System.currentTimeMillis() == 0) { + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountLambdas.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountLambdas.java new file mode 100644 index 00000000000..1905a2d469e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/executablestatementcount/InputXpathExecutableStatementCountLambdas.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.executablestatementcount; + +import java.util.function.Consumer; +import java.util.function.Function; + +public class InputXpathExecutableStatementCountLambdas { + Consumer c = (s) -> { // warn + String str = s.toString(); + str = str + "!"; + }; + + Consumer t = a -> a.toString().trim(); // ok + Function x1 = a -> a; // ok + Function y = a -> null; // ok +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/InputXpathExplicitInitializationObjectType.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/InputXpathExplicitInitializationObjectType.java new file mode 100644 index 00000000000..47b032e5cc4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/InputXpathExplicitInitializationObjectType.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.explicitinitialization; + +public class InputXpathExplicitInitializationObjectType { + private int a; + + private Object bar = null; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/InputXpathExplicitInitializationPrimitiveType.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/InputXpathExplicitInitializationPrimitiveType.java new file mode 100644 index 00000000000..508b9debe19 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/InputXpathExplicitInitializationPrimitiveType.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.explicitinitialization; + +public class InputXpathExplicitInitializationPrimitiveType { + private int a = 0; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/SuppressionXpathRegressionExplicitInitializationOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/SuppressionXpathRegressionExplicitInitializationOne.java deleted file mode 100644 index 8fff9736304..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/SuppressionXpathRegressionExplicitInitializationOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.explicitinitialization; - -public class SuppressionXpathRegressionExplicitInitializationOne { - private int a = 0; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/SuppressionXpathRegressionExplicitInitializationTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/SuppressionXpathRegressionExplicitInitializationTwo.java deleted file mode 100644 index 2576ccdec13..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/explicitinitialization/SuppressionXpathRegressionExplicitInitializationTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.explicitinitialization; - -public class SuppressionXpathRegressionExplicitInitializationTwo { - private int a; - - private Object bar = null; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/InputXpathFallThrough.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/InputXpathFallThrough.java new file mode 100644 index 00000000000..90b245bb840 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/InputXpathFallThrough.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.fallthrough; + +public class InputXpathFallThrough { + public void test() { + int id = 0; + switch (id) { + case 0: break; + case 1: if (1 == 0) { + break; + }; + case 2: break; //warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/InputXpathFallThroughDefaultCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/InputXpathFallThroughDefaultCase.java new file mode 100644 index 00000000000..57e60f0b97d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/InputXpathFallThroughDefaultCase.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.fallthrough; + +public class InputXpathFallThroughDefaultCase { + void methodFallThruCustomWords(int i, int j, boolean cond) { + while (true) { + switch (i){ + case 0: + i++; + break; + default: //warn + i++; + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/SuppressionXpathRegressionFallThroughOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/SuppressionXpathRegressionFallThroughOne.java deleted file mode 100644 index 8fa1f7cb6c5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/SuppressionXpathRegressionFallThroughOne.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.fallthrough; - -public class SuppressionXpathRegressionFallThroughOne { - public void test() { - int id = 0; - switch (id) { - case 0: break; - case 1: if (1 == 0) { - break; - }; - case 2: break; //warn - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/SuppressionXpathRegressionFallThroughTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/SuppressionXpathRegressionFallThroughTwo.java deleted file mode 100644 index 69bcf349797..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/fallthrough/SuppressionXpathRegressionFallThroughTwo.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.fallthrough; - -public class SuppressionXpathRegressionFallThroughTwo { - void methodFallThruCustomWords(int i, int j, boolean cond) { - while (true) { - switch (i){ - case 0: - i++; - break; - default: //warn - i++; - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/InputXpathFinalClassDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/InputXpathFinalClassDefault.java new file mode 100644 index 00000000000..2295ed6e864 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/InputXpathFinalClassDefault.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.finalclass; + +public class InputXpathFinalClassDefault { // warn + private InputXpathFinalClassDefault() { + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/InputXpathFinalClassInnerClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/InputXpathFinalClassInnerClass.java new file mode 100644 index 00000000000..a86934321b3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/InputXpathFinalClassInnerClass.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.finalclass; + +public class InputXpathFinalClassInnerClass { + class Test { // warn + private Test(){ + + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/SuppressionXpathRegressionFinalClass1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/SuppressionXpathRegressionFinalClass1.java deleted file mode 100644 index be192f9e2b3..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/SuppressionXpathRegressionFinalClass1.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.finalclass; - -public class SuppressionXpathRegressionFinalClass1 { // warn - private SuppressionXpathRegressionFinalClass1() { - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/SuppressionXpathRegressionFinalClass2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/SuppressionXpathRegressionFinalClass2.java deleted file mode 100644 index 36ac58ec39d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalclass/SuppressionXpathRegressionFinalClass2.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.finalclass; - -public class SuppressionXpathRegressionFinalClass2 { - class Test { // warn - private Test(){ - - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableConditionals.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableConditionals.java new file mode 100644 index 00000000000..b797dbf73ae --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableConditionals.java @@ -0,0 +1,22 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableConditionals { + private void checkCodeBlock() { + try { + + final int from; + if (true) { + from = 0; + } else if (true) { + boolean body = false; // warn + if (body) return; + from = 0; + } else { + return; + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} + diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableCtor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableCtor.java new file mode 100644 index 00000000000..b65ca947381 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableCtor.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableCtor { + InputXpathFinalLocalVariableCtor(int a) { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableEnhancedFor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableEnhancedFor.java new file mode 100644 index 00000000000..b3eb6bb6118 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableEnhancedFor.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableEnhancedFor { + public void method1() + { + final java.util.List list = new java.util.ArrayList<>(); + + for(Object a : list){ // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableForLoop.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableForLoop.java new file mode 100644 index 00000000000..0532b9fe878 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableForLoop.java @@ -0,0 +1,20 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableForLoop { + public void method2() { + for (int i = 0; i < 5; i++) { + int x; // warn + x = 3; + } + int y; + for (int i = 0; i < 5; i++) { + y = 3; + } + for (int i = 0; i < 5; i++) { + int z; + for (int j = 0; j < 5; j++) { + z = 3; + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableInnerClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableInnerClass.java new file mode 100644 index 00000000000..11c2118c219 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableInnerClass.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableInnerClass { + class InnerClass { + public void test1() { + final boolean b = true; + int shouldBeFinal; // warn + + if (b) { + shouldBeFinal = 1; + } else { + shouldBeFinal = 2; + } + } + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableMethodDef.java new file mode 100644 index 00000000000..ce6e4a69268 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableMethodDef.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableMethodDef { + public void testMethod() { + int x; // warn + x = 3; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableParameterDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableParameterDef.java new file mode 100644 index 00000000000..397d16d05fc --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableParameterDef.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableParameterDef { + public void method(int aArg, final int aFinal, int aArg2) // warn + { + int z = 0; + + z++; + + aArg2++; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableSwitchCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableSwitchCase.java new file mode 100644 index 00000000000..20586314afc --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableSwitchCase.java @@ -0,0 +1,23 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableSwitchCase { + class InnerClass { + public void method(final int i) { + switch (i) { + case 1: + int foo = 1; // warn + break; + default: + } + switch (i) { + case 1: + int foo = 1; + break; + case 2: + foo = 2; + break; + default: + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableTryBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableTryBlock.java new file mode 100644 index 00000000000..a8f11e7851d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finallocalvariable/InputXpathFinalLocalVariableTryBlock.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.finallocalvariable; + +public class InputXpathFinalLocalVariableTryBlock { + private void checkCodeBlock() { + try { + int start = 0; // warn + + final int from; + if (true) { + from = 0; + } else { + return; + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersAnonymous.java new file mode 100644 index 00000000000..bc55f331780 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersAnonymous.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.finalparameters; + +public class InputXpathFinalParametersAnonymous { + + class AnonymousClass { + public void method(int argOne, int argTwo) {} // ok, int is primitive + } + + public void createClass() { + AnonymousClass obj = new AnonymousClass() { + public void method(String[] argOne, final String[] argTwo) {} // warn + }; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersCtor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersCtor.java new file mode 100644 index 00000000000..b13701fc3f6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersCtor.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.finalparameters; + +public class InputXpathFinalParametersCtor { + + public InputXpathFinalParametersCtor(int argOne, final int argTwo) { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersMethod.java new file mode 100644 index 00000000000..136df31d81c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/finalparameters/InputXpathFinalParametersMethod.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.finalparameters; + +public class InputXpathFinalParametersMethod { + + public void method(int argOne, final int argTwo) { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceEnd.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceEnd.java new file mode 100644 index 00000000000..951c9a4b9b4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceEnd.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.util.Collections; + +public class InputXpathGenericWhitespaceEnd { + void bad(Class cls) {//warn + } + void good(Class cls) { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedOne.java new file mode 100644 index 00000000000..6950860b8af --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedOne.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.io.Serializable; + +public class InputXpathGenericWhitespaceNestedOne { + & Serializable> void bad() {//warn + } + & Serializable> void good() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedThree.java new file mode 100644 index 00000000000..2438476eccd --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedThree.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.io.Serializable; + +public class InputXpathGenericWhitespaceNestedThree { + , X> void bad() {//warn + } + , X> void good() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedTwo.java new file mode 100644 index 00000000000..f7b155f9ce9 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceNestedTwo.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.io.Serializable; + +public class InputXpathGenericWhitespaceNestedTwo { + & Serializable> void bad() {//warn + } + & Serializable> void good() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceSingleOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceSingleOne.java new file mode 100644 index 00000000000..69859ea87b6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceSingleOne.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.util.Collections; + +public class InputXpathGenericWhitespaceSingleOne { + Object bad = Collections. emptySet();//warn + Object good = Collections.emptySet(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceSingleTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceSingleTwo.java new file mode 100644 index 00000000000..2bf83017b4b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceSingleTwo.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.io.Serializable; + +public class InputXpathGenericWhitespaceSingleTwo { + void bad() {//warn + } + void good() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartOne.java new file mode 100644 index 00000000000..01865d2d7aa --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartOne.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.util.Collections; + +public class InputXpathGenericWhitespaceStartOne { + public void bad() {//warn + } + public void good() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartThree.java new file mode 100644 index 00000000000..b6214eb4fc5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartThree.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.util.Collections; + +public class InputXpathGenericWhitespaceStartThree { + < E> void bad() {//warn + } + void good() { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartTwo.java new file mode 100644 index 00000000000..ee0ce7f39bb --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/InputXpathGenericWhitespaceStartTwo.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.genericwhitespace; + +import java.util.function.Consumer; + +public class InputXpathGenericWhitespaceStartTwo { + public void bad(Consumer consumer) {//warn + } + public void good(Consumer consumer) { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceEnd.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceEnd.java deleted file mode 100644 index 6ac5e5a4c32..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceEnd.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.util.Collections; - -public class SuppressionXpathRegressionGenericWhitespaceEnd { - void bad(Class cls) {//warn - } - void good(Class cls) { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsOne.java deleted file mode 100644 index a392d6dd912..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsOne.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.io.Serializable; - -public class SuppressionXpathRegressionGenericWhitespaceNestedGenericsOne { - & Serializable> void bad() {//warn - } - & Serializable> void good() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsThree.java deleted file mode 100644 index d6f8f921541..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsThree.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.io.Serializable; - -public class SuppressionXpathRegressionGenericWhitespaceNestedGenericsThree { - , X> void bad() {//warn - } - , X> void good() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsTwo.java deleted file mode 100644 index 19e37368b33..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceNestedGenericsTwo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.io.Serializable; - -public class SuppressionXpathRegressionGenericWhitespaceNestedGenericsTwo { - & Serializable> void bad() {//warn - } - & Serializable> void good() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceSingleGenericOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceSingleGenericOne.java deleted file mode 100644 index 80a1a543c59..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceSingleGenericOne.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.util.Collections; - -public class SuppressionXpathRegressionGenericWhitespaceSingleGenericOne { - Object bad = Collections. emptySet();//warn - Object good = Collections.emptySet(); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceSingleGenericTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceSingleGenericTwo.java deleted file mode 100644 index 33fbc9af078..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceSingleGenericTwo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.io.Serializable; - -public class SuppressionXpathRegressionGenericWhitespaceSingleGenericTwo { - void bad() {//warn - } - void good() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartOne.java deleted file mode 100644 index 5d18b475ff9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartOne.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.util.Collections; - -public class SuppressionXpathRegressionGenericWhitespaceStartOne { - public void bad() {//warn - } - public void good() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartThree.java deleted file mode 100644 index a2ebac7dedd..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartThree.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.util.Collections; - -public class SuppressionXpathRegressionGenericWhitespaceStartThree { - < E> void bad() {//warn - } - void good() { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartTwo.java deleted file mode 100644 index a216fdb85ef..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/genericwhitespace/SuppressionXpathRegressionGenericWhitespaceStartTwo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.genericwhitespace; - -import java.util.function.Consumer; - -public class SuppressionXpathRegressionGenericWhitespaceStartTwo { - public void bad(Consumer consumer) {//warn - } - public void good(Consumer consumer) { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/InputXpathHiddenFieldLambdaExpInMethodCall.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/InputXpathHiddenFieldLambdaExpInMethodCall.java new file mode 100644 index 00000000000..1577c14246d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/InputXpathHiddenFieldLambdaExpInMethodCall.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.hiddenfield; + +import java.util.Arrays; +import java.util.List; + +public class InputXpathHiddenFieldLambdaExpInMethodCall { + List numbers = Arrays.asList(1, 2, 3, 4, 5, 6); + Integer value = Integer.valueOf(1); + { + numbers.forEach((Integer value) -> String.valueOf(value)); //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/InputXpathHiddenFieldMethodParam.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/InputXpathHiddenFieldMethodParam.java new file mode 100644 index 00000000000..892405607b4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/InputXpathHiddenFieldMethodParam.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.hiddenfield; + +public class InputXpathHiddenFieldMethodParam { + static int someField; + static Object other = null; + Object field = null; + + static void method(Object field, Object other) { //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/SuppressionXpathRegressionHiddenFieldOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/SuppressionXpathRegressionHiddenFieldOne.java deleted file mode 100644 index 165a18b7e8a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/SuppressionXpathRegressionHiddenFieldOne.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.hiddenfield; - -import java.util.Arrays; -import java.util.List; - -public class SuppressionXpathRegressionHiddenFieldOne { - List numbers = Arrays.asList(1, 2, 3, 4, 5, 6); - Integer value = Integer.valueOf(1); - { - numbers.forEach((Integer value) -> String.valueOf(value)); //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/SuppressionXpathRegressionHiddenFieldTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/SuppressionXpathRegressionHiddenFieldTwo.java deleted file mode 100644 index b5d4aed3a51..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/hiddenfield/SuppressionXpathRegressionHiddenFieldTwo.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.hiddenfield; - -public class SuppressionXpathRegressionHiddenFieldTwo { - static int someField; - static Object other = null; - Object field = null; - - static void method(Object field, Object other) { //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/InputXpathIllegalCatchOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/InputXpathIllegalCatchOne.java new file mode 100644 index 00000000000..14482345101 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/InputXpathIllegalCatchOne.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.illegalcatch; + +public class InputXpathIllegalCatchOne { + public void fun() { + try { + } catch (RuntimeException e) { // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/InputXpathIllegalCatchTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/InputXpathIllegalCatchTwo.java new file mode 100644 index 00000000000..f31c6d844d0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/InputXpathIllegalCatchTwo.java @@ -0,0 +1,19 @@ +package org.checkstyle.suppressionxpathfilter.illegalcatch; + +public class InputXpathIllegalCatchTwo { + public void methodOne() { + try { + foo(); + } catch (java.sql.SQLException e) { + } + } + + private void foo() throws java.sql.SQLException { + } + + public void methodTwo() { + try { + } catch (java.lang.RuntimeException e) { // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/SuppressionXpathRegressionIllegalCatchOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/SuppressionXpathRegressionIllegalCatchOne.java deleted file mode 100644 index 7f39b3a5fac..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/SuppressionXpathRegressionIllegalCatchOne.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegalcatch; - -public class SuppressionXpathRegressionIllegalCatchOne { - public void fun() { - try { - } catch (RuntimeException e) { // warn - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/SuppressionXpathRegressionIllegalCatchTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/SuppressionXpathRegressionIllegalCatchTwo.java deleted file mode 100644 index 109e09b7dd7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalcatch/SuppressionXpathRegressionIllegalCatchTwo.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegalcatch; - -public class SuppressionXpathRegressionIllegalCatchTwo { - public void methodOne() { - try { - foo(); - } catch (java.sql.SQLException e) { - } - } - - private void foo() throws java.sql.SQLException { - } - - public void methodTwo() { - try { - } catch (java.lang.RuntimeException e) { // warn - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/InputXpathIllegalImportDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/InputXpathIllegalImportDefault.java new file mode 100644 index 00000000000..da8c6e2938a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/InputXpathIllegalImportDefault.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.illegalimport; + +import java.util.List; // warn + +public class InputXpathIllegalImportDefault { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/InputXpathIllegalImportStatic.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/InputXpathIllegalImportStatic.java new file mode 100644 index 00000000000..6846efe69d2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/InputXpathIllegalImportStatic.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.illegalimport; + +import static java.lang.Math.pow; // warn + +public class InputXpathIllegalImportStatic { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/SuppressionXpathRegressionIllegalImportOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/SuppressionXpathRegressionIllegalImportOne.java deleted file mode 100644 index 163fdbffc49..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/SuppressionXpathRegressionIllegalImportOne.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegalimport; - -import java.util.List; // warn - -public class SuppressionXpathRegressionIllegalImportOne { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/SuppressionXpathRegressionIllegalImportTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/SuppressionXpathRegressionIllegalImportTwo.java deleted file mode 100644 index 8f208c7d35d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalimport/SuppressionXpathRegressionIllegalImportTwo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegalimport; - -import static java.lang.Math.pow; // warn - -public class SuppressionXpathRegressionIllegalImportTwo { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/InputXpathIllegalThrowsError.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/InputXpathIllegalThrowsError.java new file mode 100644 index 00000000000..98c2979ed43 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/InputXpathIllegalThrowsError.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.illegalthrows; + +public class InputXpathIllegalThrowsError { + public void methodOne() throws NullPointerException + { + } + + public void methodTwo() throws java.lang.Error //warn + { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/InputXpathIllegalThrowsRuntimeException.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/InputXpathIllegalThrowsRuntimeException.java new file mode 100644 index 00000000000..e430da5a1cb --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/InputXpathIllegalThrowsRuntimeException.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.illegalthrows; + +public class InputXpathIllegalThrowsRuntimeException { + public void sayHello() throws RuntimeException //warn + { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/SuppressionXpathRegressionIllegalThrowsOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/SuppressionXpathRegressionIllegalThrowsOne.java deleted file mode 100644 index e755b26b8c9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/SuppressionXpathRegressionIllegalThrowsOne.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegalthrows; - -public class SuppressionXpathRegressionIllegalThrowsOne { - public void sayHello() throws RuntimeException //warn - { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/SuppressionXpathRegressionIllegalThrowsTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/SuppressionXpathRegressionIllegalThrowsTwo.java deleted file mode 100644 index f9e9728160a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegalthrows/SuppressionXpathRegressionIllegalThrowsTwo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegalthrows; - -public class SuppressionXpathRegressionIllegalThrowsTwo { - public void methodOne() throws NullPointerException - { - } - - public void methodTwo() throws java.lang.Error //warn - { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/InputXpathIllegalTokenLabel.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/InputXpathIllegalTokenLabel.java new file mode 100644 index 00000000000..2f223e483ac --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/InputXpathIllegalTokenLabel.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.illegaltoken; + +public class InputXpathIllegalTokenLabel { + public void myTest() { + outer: // warn + for (int i = 0; i < 5; i++) { + if (i == 1) { + break outer; + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/InputXpathIllegalTokenNative.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/InputXpathIllegalTokenNative.java new file mode 100644 index 00000000000..8498f354548 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/InputXpathIllegalTokenNative.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.illegaltoken; + +public class InputXpathIllegalTokenNative { + public native void myTest(); // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/SuppressionXpathRegressionIllegalToken1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/SuppressionXpathRegressionIllegalToken1.java deleted file mode 100644 index 438fa7cfa49..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/SuppressionXpathRegressionIllegalToken1.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegaltoken; - -public class SuppressionXpathRegressionIllegalToken1 { - public void myTest() { - outer: // warn - for (int i = 0; i < 5; i++) { - if (i == 1) { - break outer; - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/SuppressionXpathRegressionIllegalToken2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/SuppressionXpathRegressionIllegalToken2.java deleted file mode 100644 index a35dbc16ec8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltoken/SuppressionXpathRegressionIllegalToken2.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegaltoken; - -public class SuppressionXpathRegressionIllegalToken2 { - public native void myTest(); // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextField.java new file mode 100644 index 00000000000..bbaaf4e9cdd --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextField.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.illegaltokentext; + +public class InputXpathIllegalTokenTextField { + private int illegalNumber = 12345; //warn + + public void someMethod() { + // some code here + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextInterface.java new file mode 100644 index 00000000000..7e751ee733b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextInterface.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.illegaltokentext; + +public interface InputXpathIllegalTokenTextInterface { + void invalidIdentifier(); // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextMethod.java new file mode 100644 index 00000000000..1d9b994a209 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltokentext/InputXpathIllegalTokenTextMethod.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.illegaltokentext; + +public class InputXpathIllegalTokenTextMethod { + public void myMethod() { + String illegalString = "forbiddenText"; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/InputXpathIllegalTypeOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/InputXpathIllegalTypeOne.java new file mode 100644 index 00000000000..d2dbd2b0442 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/InputXpathIllegalTypeOne.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.illegaltype; + +public class InputXpathIllegalTypeOne { + public void typeParam(T t) {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/InputXpathIllegalTypeTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/InputXpathIllegalTypeTwo.java new file mode 100644 index 00000000000..9b1c95a9b5b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/InputXpathIllegalTypeTwo.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.illegaltype; + +import java.io.Serializable; + +public class InputXpathIllegalTypeTwo { + public void typeParam(T a) {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/SuppressionXpathRegressionIllegalTypeOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/SuppressionXpathRegressionIllegalTypeOne.java deleted file mode 100644 index 08238330e26..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/SuppressionXpathRegressionIllegalTypeOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegaltype; - -public class SuppressionXpathRegressionIllegalTypeOne { - public void typeParam(T t) {} // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/SuppressionXpathRegressionIllegalTypeTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/SuppressionXpathRegressionIllegalTypeTwo.java deleted file mode 100644 index ef0c166dff0..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/illegaltype/SuppressionXpathRegressionIllegalTypeTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.illegaltype; - -import java.io.Serializable; - -public class SuppressionXpathRegressionIllegalTypeTwo { - public void typeParam(T a) {} // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlFour.java new file mode 100644 index 00000000000..6cb2e14cc0f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlFour.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.importcontrol; + +import java.io.*; +import java.util.Scanner; //warn +import java.util.Arrays; + + +public class InputXpathImportControlFour { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlFour.xml b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlFour.xml similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlFour.xml rename to src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlFour.xml diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlOne.java new file mode 100644 index 00000000000..4e9d88566e7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlOne.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.importcontrol; + +import java.util.Scanner; //warn + +public class InputXpathImportControlOne { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlOne.xml b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlOne.xml similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlOne.xml rename to src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlOne.xml diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlThree.java new file mode 100644 index 00000000000..a5bf4169f07 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlThree.java @@ -0,0 +1,4 @@ +package org.checkstyle.suppressionxpathfilter.importcontrol; //warn + +public class InputXpathImportControlThree { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlTwo.java new file mode 100644 index 00000000000..d89e5768484 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlTwo.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.importcontrol; //warn + +import java.util.Scanner; + +public class InputXpathImportControlTwo { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlTwo.xml b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlTwo.xml similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlTwo.xml rename to src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/InputXpathImportControlTwo.xml diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlFour.java deleted file mode 100644 index 2081c94e500..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlFour.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importcontrol; - -import java.io.*; -import java.util.Scanner; //warn -import java.util.Arrays; - - -public class SuppressionXpathRegressionImportControlFour { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlOne.java deleted file mode 100644 index 7537508e57e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlOne.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importcontrol; - -import java.util.Scanner; //warn - -public class SuppressionXpathRegressionImportControlOne { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlThree.java deleted file mode 100644 index db7dcf2006c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlThree.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importcontrol; //warn - -public class SuppressionXpathRegressionImportControlThree { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlTwo.java deleted file mode 100644 index 8684e39e164..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importcontrol/SuppressionXpathRegressionImportControlTwo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importcontrol; //warn - -import java.util.Scanner; - -public class SuppressionXpathRegressionImportControlTwo { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderFive.java new file mode 100644 index 00000000000..e7936860360 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderFive.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.importorder; + +import java.util.List; +import static org.junit.After.*; +import java.util.Date; // warn + +public class InputXpathImportOrderFive { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderFour.java new file mode 100644 index 00000000000..6749a39e31d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderFour.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.importorder; + +import java.io.*; +import java.util.Set; +import static java.lang.Math.PI; // warn + +public class InputXpathImportOrderFour { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderOne.java new file mode 100644 index 00000000000..4ad72eb7567 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderOne.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.importorder; + +import static java.lang.Math.PI; +import java.util.Set; // warn + +public class InputXpathImportOrderOne { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderThree.java new file mode 100644 index 00000000000..2db8f80660d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderThree.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.importorder; + +import java.io.*; +import org.junit.*; // warn + +public class InputXpathImportOrderThree { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderTwo.java new file mode 100644 index 00000000000..4b0089e9ec3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/InputXpathImportOrderTwo.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.importorder; + +import java.util.List; + +import java.util.Set; // warn + +public class InputXpathImportOrderTwo { + // code +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderFive.java deleted file mode 100644 index 338c1a89897..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderFive.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importorder; - -import java.util.List; -import static org.junit.After.*; -import java.util.Date; // warn - -public class SuppressionXpathRegressionImportOrderFive { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderFour.java deleted file mode 100644 index e378ad0dcff..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderFour.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importorder; - -import java.io.*; -import java.util.Set; -import static java.lang.Math.PI; // warn - -public class SuppressionXpathRegressionImportOrderFour { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderOne.java deleted file mode 100644 index 5bdd7e4a5e7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderOne.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importorder; - -import static java.lang.Math.PI; -import java.util.Set; // warn - -public class SuppressionXpathRegressionImportOrderOne { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderThree.java deleted file mode 100644 index 7b802a66f66..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderThree.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importorder; - -import java.io.*; -import org.junit.*; // warn - -public class SuppressionXpathRegressionImportOrderThree { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderTwo.java deleted file mode 100644 index 688d26055bb..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/importorder/SuppressionXpathRegressionImportOrderTwo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.importorder; - -import java.util.List; - -import java.util.Set; // warn - -public class SuppressionXpathRegressionImportOrderTwo { - // code -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationBasicOffset.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationBasicOffset.java new file mode 100644 index 00000000000..3974eaefe3e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationBasicOffset.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +public class InputXpathIndentationBasicOffset { + void test() {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationDefault.java new file mode 100644 index 00000000000..f3158e5142a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationDefault.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +public class InputXpathIndentationDefault { +void wrongIntend() { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationElseWithoutCurly.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationElseWithoutCurly.java new file mode 100644 index 00000000000..a2a4c28d86b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationElseWithoutCurly.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +public class InputXpathIndentationElseWithoutCurly { + void test() { + if (true) + exp(); + else exp(); + + if (true) + exp(); + else + exp(); // warn + } + void exp() {} +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationIfWithoutCurly.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationIfWithoutCurly.java new file mode 100644 index 00000000000..1b55b1489c1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationIfWithoutCurly.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +public class InputXpathIndentationIfWithoutCurly { + void test() { + if (true) + e(); + if (true) + e(); // warn + } + void e() {}; +} + diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationLambdaOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationLambdaOne.java new file mode 100644 index 00000000000..536bbf08056 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationLambdaOne.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +public class InputXpathIndentationLambdaOne { + void test() { + MyLambda getA = + (a) -> a; // warn + } +} + +interface MyLambda { + int myMethod(int a); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationLambdaTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationLambdaTwo.java new file mode 100644 index 00000000000..68877ecfba7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationLambdaTwo.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +interface MyLambdaInterface { + int foo(int a, int b); +}; + +public class InputXpathIndentationLambdaTwo { + void test() { + MyLambdaInterface div = (a, b) + -> { + if(b != 0) { + return a/b; + } + return 0; // warn + }; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationSwitchCase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationSwitchCase.java new file mode 100644 index 00000000000..0a8a3fd97cc --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/InputXpathIndentationSwitchCase.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.indentation; + +public class InputXpathIndentationSwitchCase { + void test() { + int key = 5; + switch (key) { + case 1: // warn + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationElseWithoutCurly.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationElseWithoutCurly.java deleted file mode 100644 index ee89db624b5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationElseWithoutCurly.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -public class SuppressionXpathRegressionIndentationElseWithoutCurly { - void test() { - if (true) - exp(); - else exp(); - - if (true) - exp(); - else - exp(); // warn - } - void exp() {} -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationIfWithoutCurly.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationIfWithoutCurly.java deleted file mode 100644 index 7abb87187fd..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationIfWithoutCurly.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -public class SuppressionXpathRegressionIndentationIfWithoutCurly { - void test() { - if (true) - e(); - if (true) - e(); // warn - } - void e() {}; -} - diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationLambdaTest1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationLambdaTest1.java deleted file mode 100644 index e0344b87380..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationLambdaTest1.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -public class SuppressionXpathRegressionIndentationLambdaTest1 { - void test() { - MyLambda getA = - (a) -> a; // warn - } -} - -interface MyLambda { - int myMethod(int a); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationLambdaTest2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationLambdaTest2.java deleted file mode 100644 index e8adc875385..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationLambdaTest2.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -interface MyLambdaInterface { - int foo(int a, int b); -}; - -public class SuppressionXpathRegressionIndentationLambdaTest2 { - void test() { - MyLambdaInterface div = (a, b) - -> { - if(b != 0) { - return a/b; - } - return 0; // warn - }; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestOne.java deleted file mode 100644 index d60de1ccc71..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestOne.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -public class SuppressionXpathRegressionIndentationTestOne { -void wrongIntend() { // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestThree.java deleted file mode 100644 index eba8876cfe5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestThree.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -public class SuppressionXpathRegressionIndentationTestThree { - void test() { - int key = 5; - switch (key) { - case 1: // warn - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestTwo.java deleted file mode 100644 index e2dc66af019..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/indentation/SuppressionXpathRegressionIndentationTestTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.indentation; - -public class SuppressionXpathRegressionIndentationTestTwo { - void test() {} // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/innerassignment/InputXpathInnerAssignment.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/innerassignment/InputXpathInnerAssignment.java new file mode 100644 index 00000000000..e0ae9ba571a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/innerassignment/InputXpathInnerAssignment.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.innerassignment; + +public class InputXpathInnerAssignment { + + public void testMethod() { + int a, b; + a = b = 5; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/innerassignment/InputXpathInnerAssignmentArrays.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/innerassignment/InputXpathInnerAssignmentArrays.java new file mode 100644 index 00000000000..5da5022b68c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/innerassignment/InputXpathInnerAssignmentArrays.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.innerassignment; + +public class InputXpathInnerAssignmentArrays { + public void testMethod() { + double myDouble; + double[] doubleArray = new double[] {myDouble = 4.5, 15.5}; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastOne.java new file mode 100644 index 00000000000..41fd10810ee --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastOne.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.innertypelast; + +public class InputXpathInnerTypeLastOne { + + public class Inner { + } + + public InputXpathInnerTypeLastOne() { // warn + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastThree.java new file mode 100644 index 00000000000..16c2f9bf3ff --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastThree.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.innertypelast; + +public class InputXpathInnerTypeLastThree { + + static {} // OK + + interface Inner { + } + + public InputXpathInnerTypeLastThree() { // warn + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastTwo.java new file mode 100644 index 00000000000..78f8b1ec362 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/innertypelast/InputXpathInnerTypeLastTwo.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.innertypelast; + +public class InputXpathInnerTypeLastTwo { + + static {}; // OK + + public void innerMethod() {} // OK + + class Inner { + class InnerInInner {} + public void innerMethod() {} // warn + + }; + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/InputXpathInterfaceIsType.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/InputXpathInterfaceIsType.java new file mode 100644 index 00000000000..8f1fbf8a98c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/InputXpathInterfaceIsType.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.interfaceistype; + +public interface InputXpathInterfaceIsType { // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/InputXpathInterfaceIsTypeAllowMarker.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/InputXpathInterfaceIsTypeAllowMarker.java new file mode 100644 index 00000000000..d0dd03c9bf7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/InputXpathInterfaceIsTypeAllowMarker.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.interfaceistype; + +public interface InputXpathInterfaceIsTypeAllowMarker { // warn + int a = 3; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/SuppressionXpathRegressionInterfaceIsType1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/SuppressionXpathRegressionInterfaceIsType1.java deleted file mode 100644 index 030bf25f5cc..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/SuppressionXpathRegressionInterfaceIsType1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.interfaceistype; - -public interface SuppressionXpathRegressionInterfaceIsType1 { // warn - int a = 3; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/SuppressionXpathRegressionInterfaceIsType2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/SuppressionXpathRegressionInterfaceIsType2.java deleted file mode 100644 index fd9b930be36..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfaceistype/SuppressionXpathRegressionInterfaceIsType2.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.interfaceistype; - -public interface SuppressionXpathRegressionInterfaceIsType2 { // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierField.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierField.java new file mode 100644 index 00000000000..043d2095cc7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierField.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.interfacememberimpliedmodifier; + +public interface InputXpathInterfaceMemberImpliedModifierField { + public static String str = "random string"; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierInner.java new file mode 100644 index 00000000000..2cf4c78c72c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierInner.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.interfacememberimpliedmodifier; + +public interface InputXpathInterfaceMemberImpliedModifierInner { + public interface Data {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierMethod.java new file mode 100644 index 00000000000..bffb6af5808 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/InputXpathInterfaceMemberImpliedModifierMethod.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.interfacememberimpliedmodifier; + +public interface InputXpathInterfaceMemberImpliedModifierMethod { + abstract void setData(); // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier1.java deleted file mode 100644 index 74c81b11e8c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.interfacememberimpliedmodifier; - -public interface SuppressionXpathRegressionInterfaceMemberImpliedModifier1 { - public static String str = "random string"; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier2.java deleted file mode 100644 index d38d975fb3a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier2.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.interfacememberimpliedmodifier; - -public interface SuppressionXpathRegressionInterfaceMemberImpliedModifier2 { - abstract void setData(); // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier3.java deleted file mode 100644 index 18b982cbe19..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/interfacememberimpliedmodifier/SuppressionXpathRegressionInterfaceMemberImpliedModifier3.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.interfacememberimpliedmodifier; - -public interface SuppressionXpathRegressionInterfaceMemberImpliedModifier3 { - public interface Data {} // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionFive.java new file mode 100644 index 00000000000..6f050e510a0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionFive.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; + +public class InputXpathInvalidJavadocPositionFive { + public void foo() { + /** // warn + * Javadoc comment + */ + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionFour.java new file mode 100644 index 00000000000..04adbf2c2c9 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionFour.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; + +public class InputXpathInvalidJavadocPositionFour { + /** // warn + * Javadoc Comment + */ +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionOne.java new file mode 100644 index 00000000000..82b85797327 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionOne.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; + +@SuppressWarnings("serial") +/** // warn + * Javadoc Comment + */ +public class InputXpathInvalidJavadocPositionOne { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionSix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionSix.java new file mode 100644 index 00000000000..763e720c073 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionSix.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; + +public class InputXpathInvalidJavadocPositionSix { + int a; + /** // warn + * Javadoc Comment + */ +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionThree.java new file mode 100644 index 00000000000..98b397511ce --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionThree.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; + +public class InputXpathInvalidJavadocPositionThree { + public void foo(){ + } + /** // warn + * Javadoc comment + */ +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionTwo.java new file mode 100644 index 00000000000..7d6d961e37f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/InputXpathInvalidJavadocPositionTwo.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; + +public class InputXpathInvalidJavadocPositionTwo { +} +/** // warn + * Javadoc comment + */ diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionFive.java deleted file mode 100644 index 2cb5606536c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionFive.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; - -public class SuppressionXpathRegressionInvalidJavadocPositionFive { - public void foo() { - /** // warn - * Javadoc comment - */ - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionFour.java deleted file mode 100644 index 5d65ecc150a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionFour.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; - -public class SuppressionXpathRegressionInvalidJavadocPositionFour { - /** // warn - * Javadoc Comment - */ -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionOne.java deleted file mode 100644 index 89405e83077..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionOne.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; - -@SuppressWarnings("serial") -/** // warn - * Javadoc Comment - */ -public class SuppressionXpathRegressionInvalidJavadocPositionOne { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionSix.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionSix.java deleted file mode 100644 index 7f73f25e92e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionSix.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; - -public class SuppressionXpathRegressionInvalidJavadocPositionSix { - int a; - /** // warn - * Javadoc Comment - */ -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionThree.java deleted file mode 100644 index 6e64de7f644..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionThree.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; - -public class SuppressionXpathRegressionInvalidJavadocPositionThree { - public void foo(){ - } - /** // warn - * Javadoc comment - */ -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionTwo.java deleted file mode 100644 index bf9852b86af..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/invalidjavadocposition/SuppressionXpathRegressionInvalidJavadocPositionTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.invalidjavadocposition; - -public class SuppressionXpathRegressionInvalidJavadocPositionTwo { -} -/** // warn - * Javadoc comment - */ diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/InputXpathJavadocContentLocationOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/InputXpathJavadocContentLocationOne.java new file mode 100644 index 00000000000..d2a274c469f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/InputXpathJavadocContentLocationOne.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.javadoccontentlocation; + +public interface InputXpathJavadocContentLocationOne { + + /** Text. // warn + */ + void test(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/InputXpathJavadocContentLocationTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/InputXpathJavadocContentLocationTwo.java new file mode 100644 index 00000000000..e1ecc2f9505 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/InputXpathJavadocContentLocationTwo.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.javadoccontentlocation; + +public interface InputXpathJavadocContentLocationTwo { + + /* warn */ /** + * Text. + */ + void test(); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/SuppressionXpathRegressionJavadocContentLocationOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/SuppressionXpathRegressionJavadocContentLocationOne.java deleted file mode 100644 index 80a285ecd14..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/SuppressionXpathRegressionJavadocContentLocationOne.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadoccontentlocation; - -public interface SuppressionXpathRegressionJavadocContentLocationOne { - - /** Text. // warn - */ - void test(); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/SuppressionXpathRegressionJavadocContentLocationTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/SuppressionXpathRegressionJavadocContentLocationTwo.java deleted file mode 100644 index 6ddc0aaedfd..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoccontentlocation/SuppressionXpathRegressionJavadocContentLocationTwo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadoccontentlocation; - -public interface SuppressionXpathRegressionJavadocContentLocationTwo { - - /* warn */ /** - * Text. - */ - void test(); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodFive.java new file mode 100644 index 00000000000..3394b3fcb60 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodFive.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.javadocmethod; + +/** + * Config: + * validateThrows = true + */ +public class InputXpathJavadocMethodFive { + + /** + * Needs a throws tag. + */ + public void bar() { + throw new org.apache.tools.ant.BuildException(""); //warn + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodFour.java new file mode 100644 index 00000000000..272ac80d5cd --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodFour.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.javadocmethod; + +/** + * Config: + * validateThrows = true + */ +public class InputXpathJavadocMethodFour { + + /** + * Needs a throws tag. + */ + public void foo() throws Exception { //warn + + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodOne.java new file mode 100644 index 00000000000..4f915d594cf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodOne.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.javadocmethod; + +/** + * Config: + */ +public class InputXpathJavadocMethodOne { + + /** {@inheritDoc} */ + public void inheritableMethod() { + // may be inherited and overridden + } + + /** {@inheritDoc} */ + private void uninheritableMethod() { //warn + // not possible to be inherited + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodThree.java new file mode 100644 index 00000000000..42db3882c3e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodThree.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.javadocmethod; + +/** + * Config: + */ +public class InputXpathJavadocMethodThree { + + /** + * Needs a param tag for T. + * + * @param x the input + * @return hashcode of x + */ + public int checkTypeParam(T x) { //warn + return x.hashCode(); + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodTwo.java new file mode 100644 index 00000000000..94b0468b06c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/InputXpathJavadocMethodTwo.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.javadocmethod; + +/** + * Config: + */ +public class InputXpathJavadocMethodTwo { + + /** + * Needs a param tag for x. + * + * @return identity + */ + public int checkParam(int x) { //warn + return x; + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodFive.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodFive.java deleted file mode 100644 index 0a74583fb40..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodFive.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocmethod; - -/** - * Config: - * validateThrows = true - */ -public class SuppressionXpathRegressionJavadocMethodFive { - - /** - * Needs a throws tag. - */ - public void bar() { - throw new org.apache.tools.ant.BuildException(""); //warn - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodFour.java deleted file mode 100644 index 44224218b0d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodFour.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocmethod; - -/** - * Config: - * validateThrows = true - */ -public class SuppressionXpathRegressionJavadocMethodFour { - - /** - * Needs a throws tag. - */ - public void foo() throws Exception { //warn - - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodOne.java deleted file mode 100644 index 0308db07484..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodOne.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocmethod; - -/** - * Config: - */ -public class SuppressionXpathRegressionJavadocMethodOne { - - /** {@inheritDoc} */ - public void inheritableMethod() { - // may be inherited and overridden - } - - /** {@inheritDoc} */ - private void uninheritableMethod() { //warn - // not possible to be inherited - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodThree.java deleted file mode 100644 index 60461bd20f8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodThree.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocmethod; - -/** - * Config: - */ -public class SuppressionXpathRegressionJavadocMethodThree { - - /** - * Needs a param tag for T. - * - * @param x the input - * @return hashcode of x - */ - public int checkTypeParam(T x) { //warn - return x.hashCode(); - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodTwo.java deleted file mode 100644 index 569b02b44aa..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocmethod/SuppressionXpathRegressionJavadocMethodTwo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocmethod; - -/** - * Config: - */ -public class SuppressionXpathRegressionJavadocMethodTwo { - - /** - * Needs a param tag for x. - * - * @return identity - */ - public int checkParam(int x) { //warn - return x; - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeIncomplete.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeIncomplete.java new file mode 100644 index 00000000000..ffd74088d4c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeIncomplete.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.javadoctype; + +/** + * Need type param tags. + * @param + * @param + */ +public class InputXpathJavadocTypeIncomplete { //warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeMissingTag.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeMissingTag.java new file mode 100644 index 00000000000..dc80e9b7b5e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeMissingTag.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.javadoctype; + +/** + * Needs an author tag. + */ +public class InputXpathJavadocTypeMissingTag { //warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeWrongFormat.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeWrongFormat.java new file mode 100644 index 00000000000..9ae8ea05b0f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/InputXpathJavadocTypeWrongFormat.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.javadoctype; + +/** + * Has an author tag but wrong format. + * @author bar + */ +public class InputXpathJavadocTypeWrongFormat { //warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeOne.java deleted file mode 100644 index 02335e0f1e8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeOne.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadoctype; - -/** - * Needs an author tag. - */ -public class SuppressionXpathRegressionJavadocTypeOne { //warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeThree.java deleted file mode 100644 index 800e5e359ee..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeThree.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadoctype; - -/** - * Need type param tags. - * @param - * @param - */ -public class SuppressionXpathRegressionJavadocTypeThree { //warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeTwo.java deleted file mode 100644 index 4fe5cffd17f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadoctype/SuppressionXpathRegressionJavadocTypeTwo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadoctype; - -/** - * Has an author tag but wrong format. - * @author bar - */ -public class SuppressionXpathRegressionJavadocTypeTwo { //warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/InputXpathJavadocVariableInnerClassFields.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/InputXpathJavadocVariableInnerClassFields.java new file mode 100644 index 00000000000..1ec67e4111d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/InputXpathJavadocVariableInnerClassFields.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.javadocvariable; + +public class InputXpathJavadocVariableInnerClassFields { + class InnerInner2 + { + public int fData; //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/InputXpathJavadocVariablePrivateClassFields.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/InputXpathJavadocVariablePrivateClassFields.java new file mode 100644 index 00000000000..53d7148e507 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/InputXpathJavadocVariablePrivateClassFields.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.javadocvariable; + +public class InputXpathJavadocVariablePrivateClassFields { + + private int age; //warn + + public void helloWorld(String name) + { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/SuppressionXpathRegressionJavadocVariableOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/SuppressionXpathRegressionJavadocVariableOne.java deleted file mode 100644 index f7ba64bd6de..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/SuppressionXpathRegressionJavadocVariableOne.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocvariable; - -public class SuppressionXpathRegressionJavadocVariableOne { - - private int age; //warn - - public void helloWorld(String name) - { - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/SuppressionXpathRegressionJavadocVariableTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/SuppressionXpathRegressionJavadocVariableTwo.java deleted file mode 100644 index 57a3515893c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/javadocvariable/SuppressionXpathRegressionJavadocVariableTwo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.javadocvariable; - -public class SuppressionXpathRegressionJavadocVariableTwo { - class InnerInner2 - { - public int fData; //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSOne.java new file mode 100644 index 00000000000..cb5370ce6f5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSOne.java @@ -0,0 +1,63 @@ +package org.checkstyle.suppressionxpathfilter.javancss; + +public class InputXpathJavaNCSSOne { + + public void test() { // warn + int a1 = 1; + int a2 = 1; + int a3 = 1; + int a4 = 1; + int a5 = 1; + int a6 = 1; + int a7 = 1; + int a8 = 1; + int a9 = 1; + int a10 = 1; + int a11 = 1; + int a12 = 1; + int a13 = 1; + int a14 = 1; + int a15 = 1; + int a16 = 1; + int a17 = 1; + int a18 = 1; + int a19 = 1; + int a20 = 1; + int a21 = 1; + int a22 = 1; + int a23 = 1; + int a24 = 1; + int a25 = 1; + int a26 = 1; + int a27 = 1; + int a28 = 1; + int a29 = 1; + int a30 = 1; + int a31 = 1; + int a32 = 1; + int a33 = 1; + int a34 = 1; + int a35 = 1; + int a36 = 1; + int a37 = 1; + int a38 = 1; + int a39 = 1; + int a40 = 1; + int a41 = 1; + int a42 = 1; + int a43 = 1; + int a44 = 1; + int a45 = 1; + int a46 = 1; + int a47 = 1; + int a48 = 1; + int a49 = 1; + int a50 = 1; + } + + public void test2() { // ok, method does not exceed the 50 lines limit. + int a1 = 1; + int a2 = 1; + int a3 = 1; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSThree.java new file mode 100644 index 00000000000..151530f901e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSThree.java @@ -0,0 +1,58 @@ +package org.checkstyle.suppressionxpathfilter.javancss; // warn + +public class InputXpathJavaNCSSThree { + int a1 = 1; + int a2 = 1; + int a3 = 1; + int a4 = 1; + int a5 = 1; + int a6 = 1; + int a7 = 1; + int a8 = 1; + int a9 = 1; + int a10 = 1; + int a11 = 1; + int a12 = 1; + int a13 = 1; + int a14 = 1; + int a15 = 1; + int a16 = 1; + int a17 = 1; + int a18 = 1; + int a19 = 1; + int a20 = 1; + int a21 = 1; + int a22 = 1; + int a23 = 1; + int a24 = 1; + int a25 = 1; +} + + +class Test1 { + int a1 = 1; + int a2 = 1; + int a3 = 1; + int a4 = 1; + int a5 = 1; + int a6 = 1; + int a7 = 1; + int a8 = 1; + int a9 = 1; + int a10 = 1; + int a11 = 1; + int a12 = 1; +} + +class Test2 { + int a1 = 1; + int a2 = 1; + int a3 = 1; + int a4 = 1; + int a5 = 1; + int a6 = 1; + int a7 = 1; + int a8 = 1; + int a9 = 1; + int a10 = 1; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSTwo.java new file mode 100644 index 00000000000..9eb109cb487 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/javancss/InputXpathJavaNCSSTwo.java @@ -0,0 +1,61 @@ +package org.checkstyle.suppressionxpathfilter.javancss; + +public class InputXpathJavaNCSSTwo { // warn + + int a1 = 1; + int a2 = 1; + int a3 = 1; + int a4 = 1; + int a5 = 1; + int a6 = 1; + int a7 = 1; + int a8 = 1; + int a9 = 1; + int a10 = 1; + int a11 = 1; + int a12 = 1; + int a13 = 1; + int a14 = 1; + int a15 = 1; + int a16 = 1; + int a17 = 1; + int a18 = 1; + int a19 = 1; + int a20 = 1; + int a21 = 1; + int a22 = 1; + int a23 = 1; + int a24 = 1; + int a25 = 1; + int a26 = 1; + int a27 = 1; + int a28 = 1; + int a29 = 1; + int a30 = 1; + int a31 = 1; + int a32 = 1; + int a33 = 1; + int a34 = 1; + int a35 = 1; + int a36 = 1; + int a37 = 1; + int a38 = 1; + int a39 = 1; + int a40 = 1; + int a41 = 1; + int a42 = 1; + int a43 = 1; + int a44 = 1; + int a45 = 1; + int a46 = 1; + int a47 = 1; + int a48 = 1; + int a49 = 1; + int a50 = 1; +} + +class Test { // ok, class does not exceed the 50 lines limit. + int a1 = 1; + int a2 = 1; + int a3 = 1; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/InputXpathLambdaBodyLengthCustomMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/InputXpathLambdaBodyLengthCustomMax.java new file mode 100644 index 00000000000..a31622499c5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/InputXpathLambdaBodyLengthCustomMax.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.lambdabodylength; + +import java.util.function.Function; + +public class InputXpathLambdaBodyLengthCustomMax { + void test() { + Runnable r = () -> { // warn + method(2); + method(3); + method(4); + method(5); + }; + } + + void method(int i) {} +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/InputXpathLambdaBodyLengthDefaultMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/InputXpathLambdaBodyLengthDefaultMax.java new file mode 100644 index 00000000000..abe56dbe16b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/InputXpathLambdaBodyLengthDefaultMax.java @@ -0,0 +1,20 @@ +package org.checkstyle.suppressionxpathfilter.lambdabodylength; + +import java.util.function.Function; + +public class InputXpathLambdaBodyLengthDefaultMax { + void test() { + Function trimmer = (s) -> // warn + s.trim() + .trim() + .trim() + .trim() + .trim() + .trim() + .trim() + .trim() + .trim() + .trim() + .trim(); + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/SuppressionXpathRegressionLambdaBodyLength1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/SuppressionXpathRegressionLambdaBodyLength1.java deleted file mode 100644 index c0d12288038..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/SuppressionXpathRegressionLambdaBodyLength1.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.lambdabodylength; - -import java.util.function.Function; - -public class SuppressionXpathRegressionLambdaBodyLength1 { - void test() { - Function trimmer = (s) -> // warn - s.trim() - .trim() - .trim() - .trim() - .trim() - .trim() - .trim() - .trim() - .trim() - .trim() - .trim(); - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/SuppressionXpathRegressionLambdaBodyLength2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/SuppressionXpathRegressionLambdaBodyLength2.java deleted file mode 100644 index d552ae4fafb..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdabodylength/SuppressionXpathRegressionLambdaBodyLength2.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.lambdabodylength; - -import java.util.function.Function; - -public class SuppressionXpathRegressionLambdaBodyLength2 { - void test() { - Runnable r = () -> { // warn - method(2); - method(3); - method(4); - method(5); - }; - } - - void method(int i) {} -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/InputXpathLambdaParameterNameDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/InputXpathLambdaParameterNameDefault.java new file mode 100644 index 00000000000..94cb1ec502b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/InputXpathLambdaParameterNameDefault.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.lambdaparametername; + +import java.util.function.Function; + +public class InputXpathLambdaParameterNameDefault { + void test() { + Function trimmer = S -> S.trim(); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/InputXpathLambdaParameterNameNonDefaultPattern.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/InputXpathLambdaParameterNameNonDefaultPattern.java new file mode 100644 index 00000000000..cbb3c42980a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/InputXpathLambdaParameterNameNonDefaultPattern.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.lambdaparametername; + +import java.util.function.Function; + +public class InputXpathLambdaParameterNameNonDefaultPattern { + void test() { + Function trimmer = (s) -> s.trim(); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/SuppressionXpathRegressionLambdaParameterName1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/SuppressionXpathRegressionLambdaParameterName1.java deleted file mode 100644 index f720010fe9d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/SuppressionXpathRegressionLambdaParameterName1.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.lambdaparametername; - -import java.util.function.Function; - -public class SuppressionXpathRegressionLambdaParameterName1 { - void test() { - Function trimmer = S -> S.trim(); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/SuppressionXpathRegressionLambdaParameterName2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/SuppressionXpathRegressionLambdaParameterName2.java deleted file mode 100644 index 8b818ed11e0..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/lambdaparametername/SuppressionXpathRegressionLambdaParameterName2.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.lambdaparametername; - -import java.util.function.Function; - -public class SuppressionXpathRegressionLambdaParameterName2 { - void test() { - Function trimmer = (s) -> s.trim(); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyOne.java new file mode 100644 index 00000000000..5315bcdddf8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyOne.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.leftcurly; + +public class InputXpathLeftCurlyOne +{ //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyThree.java new file mode 100644 index 00000000000..3a840197762 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyThree.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.leftcurly; + +public class InputXpathLeftCurlyThree { + public void sample(boolean flag) { + if (flag) { String.CASE_INSENSITIVE_ORDER.equals("it is ok."); } //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyTwo.java new file mode 100644 index 00000000000..3cfc1b20c9b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/InputXpathLeftCurlyTwo.java @@ -0,0 +1,4 @@ +package org.checkstyle.suppressionxpathfilter.leftcurly; + +public class InputXpathLeftCurlyTwo { //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyOne.java deleted file mode 100644 index 3f95f5fef05..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.leftcurly; - -public class SuppressionXpathRegressionLeftCurlyOne -{ //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyThree.java deleted file mode 100644 index e130365a253..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyThree.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.leftcurly; - -public class SuppressionXpathRegressionLeftCurlyThree { - public void sample(boolean flag) { - if (flag) { String.CASE_INSENSITIVE_ORDER.equals("it is ok."); } //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyTwo.java deleted file mode 100644 index 7dca41d3c95..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/leftcurly/SuppressionXpathRegressionLeftCurlyTwo.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.leftcurly; - -public class SuppressionXpathRegressionLeftCurlyTwo { //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameInner.java new file mode 100644 index 00000000000..2645870893a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameInner.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.localfinalvariablename; + +import java.util.Scanner; + +public class InputXpathLocalFinalVariableNameInner { + class InnerClass { + void MyMethod() { + final int VAR1 = 10; // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameResource.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameResource.java new file mode 100644 index 00000000000..3a59a808674 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameResource.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.localfinalvariablename; + +import java.util.Scanner; + +public class InputXpathLocalFinalVariableNameResource { + void MyMethod() { + try(Scanner scanner = new Scanner("ABC")) { // warn + final int VAR1 = 5; + final int var1 = 10; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameVar.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameVar.java new file mode 100644 index 00000000000..96d6ac4dc05 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/localfinalvariablename/InputXpathLocalFinalVariableNameVar.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.localfinalvariablename; + +public class InputXpathLocalFinalVariableNameVar { + void MyMethod() { + final int VAR1 = 5; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberAnotherVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberAnotherVariable.java new file mode 100644 index 00000000000..f94a62b58f3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberAnotherVariable.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.magicnumber; + +public class InputXpathMagicNumberAnotherVariable { + public void performOperation() { + try { + int result = 0; + } catch(Exception e) { + int a = 0; + boolean someCondition = false; + if (someCondition) { + a = 1; // ok + } else { + a = 20; // warn + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberMethodDef.java new file mode 100644 index 00000000000..33f778e6342 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberMethodDef.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.magicnumber; + +public class InputXpathMagicNumberMethodDef { + public void methodWithMagicNumber() { + int x = 20; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberVariable.java new file mode 100644 index 00000000000..0e8854fa0e1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/magicnumber/InputXpathMagicNumberVariable.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.magicnumber; + +public class InputXpathMagicNumberVariable { + private int a = 1; // ok + int d = 5; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAmpChar.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAmpChar.java new file mode 100644 index 00000000000..4d0e9c55935 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAmpChar.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedAmpChar { + char ampChar = '&'; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAmpString.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAmpString.java new file mode 100644 index 00000000000..5cab2abd388 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAmpString.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedAmpString { + String ampersandChar = "&testThree"; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAposChar.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAposChar.java new file mode 100644 index 00000000000..67466b6b0ad --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAposChar.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedAposChar { + char aposChar = '\''; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAposString.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAposString.java new file mode 100644 index 00000000000..398ac8001ac --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedAposString.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedAposString { + String aposChar = "'SingleQuoteOnBothSide'"; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedCarriageString.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedCarriageString.java new file mode 100644 index 00000000000..32092a516cd --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedCarriageString.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedCarriageString { + String carriageChar = "carriageCharAtEnd\r"; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedGreaterChar.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedGreaterChar.java new file mode 100644 index 00000000000..8ce257cbd6f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedGreaterChar.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedGreaterChar { + char greaterChar = '>'; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedGreaterString.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedGreaterString.java new file mode 100644 index 00000000000..642e15b5a08 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedGreaterString.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedGreaterString { + String greaterChar = ">testFour"; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedLessChar.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedLessChar.java new file mode 100644 index 00000000000..51eda2ef634 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedLessChar.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedLessChar { + char lessChar = '<'; // warning +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedLessString.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedLessString.java new file mode 100644 index 00000000000..b1e2971ce52 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/matchxpath/InputXpathMatchXpathEncodedLessString.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.matchxpath; + +public class InputXpathMatchXpathEncodedLessString { + String lessChar = " void foo() { } // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/methodtypeparametername/InputXpathMethodTypeParameterNameInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/methodtypeparametername/InputXpathMethodTypeParameterNameInner.java new file mode 100644 index 00000000000..10d51c6fdac --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/methodtypeparametername/InputXpathMethodTypeParameterNameInner.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.methodtypeparametername; + +public class InputXpathMethodTypeParameterNameInner{ + + static class Junk { + void foo() { // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/methodtypeparametername/InputXpathMethodTypeParameterNameLowercase.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/methodtypeparametername/InputXpathMethodTypeParameterNameLowercase.java new file mode 100644 index 00000000000..20b3a9f24bf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/methodtypeparametername/InputXpathMethodTypeParameterNameLowercase.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.methodtypeparametername; + +import java.util.List; + +public class InputXpathMethodTypeParameterNameLowercase { + + a_a myMethod(List list) {return null;} // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/InputXpathMissingCtor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/InputXpathMissingCtor.java new file mode 100644 index 00000000000..d70ef35a124 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/InputXpathMissingCtor.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.missingctor; + +public class InputXpathMissingCtor { // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/InputXpathMissingCtorInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/InputXpathMissingCtorInner.java new file mode 100644 index 00000000000..ba5bc93a5e6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/InputXpathMissingCtorInner.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.missingctor; + +public class InputXpathMissingCtorInner { + + private InputXpathMissingCtorInner() { + + } + + class InnerClass { // warn + + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/SuppressionXpathRegressionMissingCtor1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/SuppressionXpathRegressionMissingCtor1.java deleted file mode 100644 index da17df52919..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/SuppressionXpathRegressionMissingCtor1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingctor; - -public class SuppressionXpathRegressionMissingCtor1 { // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/SuppressionXpathRegressionMissingCtor2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/SuppressionXpathRegressionMissingCtor2.java deleted file mode 100644 index b0e36ea3aa3..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingctor/SuppressionXpathRegressionMissingCtor2.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingctor; - -public class SuppressionXpathRegressionMissingCtor2 { - - private SuppressionXpathRegressionMissingCtor2() { - - } - - class InnerClass { // warn - - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/InputXpathMissingJavadocMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/InputXpathMissingJavadocMethod.java new file mode 100644 index 00000000000..4caf025cb63 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/InputXpathMissingJavadocMethod.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadocmethod; + +public class InputXpathMissingJavadocMethod { + public void foo() { // warn + // code + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/InputXpathMissingJavadocMethodCtor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/InputXpathMissingJavadocMethodCtor.java new file mode 100644 index 00000000000..b2661726d09 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/InputXpathMissingJavadocMethodCtor.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadocmethod; + +public class InputXpathMissingJavadocMethodCtor { + public InputXpathMissingJavadocMethodCtor() { // warn + // code + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/SuppressionXpathRegressionMissingJavadocMethod1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/SuppressionXpathRegressionMissingJavadocMethod1.java deleted file mode 100644 index 4d0803600c1..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/SuppressionXpathRegressionMissingJavadocMethod1.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadocmethod; - -public class SuppressionXpathRegressionMissingJavadocMethod1 { - public SuppressionXpathRegressionMissingJavadocMethod1() { // warn - // code - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/SuppressionXpathRegressionMissingJavadocMethod2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/SuppressionXpathRegressionMissingJavadocMethod2.java deleted file mode 100644 index f305328408f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadocmethod/SuppressionXpathRegressionMissingJavadocMethod2.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadocmethod; - -public class SuppressionXpathRegressionMissingJavadocMethod2 { - public void foo() { // warn - // code - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeAnnotation.java new file mode 100644 index 00000000000..6a19806a6d2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeAnnotation.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadoctype; + +@TestAnnotation +public class InputXpathMissingJavadocTypeAnnotation { + @TestAnnotation2 // warn + public class innerClass { + + } +} + +@interface TestAnnotation { + +} + +@interface TestAnnotation2 { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeClass.java new file mode 100644 index 00000000000..eec949f6236 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeClass.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadoctype; + +public class InputXpathMissingJavadocTypeClass { // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeExcluded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeExcluded.java new file mode 100644 index 00000000000..28e1249992d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeExcluded.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadoctype; + +public class InputXpathMissingJavadocTypeExcluded { + private class Test { // warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeScope.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeScope.java new file mode 100644 index 00000000000..ab4a6d21af4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeScope.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadoctype; + +/** + * ok + */ +public class InputXpathMissingJavadocTypeScope { + private class Test { // warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeToken.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeToken.java new file mode 100644 index 00000000000..f3422cdd487 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/InputXpathMissingJavadocTypeToken.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.missingjavadoctype; + +public interface InputXpathMissingJavadocTypeToken { // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeAnnotation.java deleted file mode 100644 index b5de3a8d6d7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeAnnotation.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadoctype; - -@TestAnnotation -public class SuppressionXpathRegressionMissingJavadocTypeAnnotation { - @TestAnnotation2 // warn - public class innerClass { - - } -} - -@interface TestAnnotation { - -} - -@interface TestAnnotation2 { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeClass.java deleted file mode 100644 index 0f684ba89f5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeClass.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadoctype; - -public class SuppressionXpathRegressionMissingJavadocTypeClass { // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeExcluded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeExcluded.java deleted file mode 100644 index 1732b0d55a9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeExcluded.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadoctype; - -public class SuppressionXpathRegressionMissingJavadocTypeExcluded { - private class Test { // warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeScope.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeScope.java deleted file mode 100644 index f7316a511ec..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeScope.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadoctype; - -/** - * ok - */ -public class SuppressionXpathRegressionMissingJavadocTypeScope { - private class Test { // warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeToken.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeToken.java deleted file mode 100644 index a32f9012128..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingjavadoctype/SuppressionXpathRegressionMissingJavadocTypeToken.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingjavadoctype; - -public interface SuppressionXpathRegressionMissingJavadocTypeToken { // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideAnonymous.java new file mode 100644 index 00000000000..3659d65da65 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideAnonymous.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.missingoverride; + +public class InputXpathMissingOverrideAnonymous { + Runnable r = new Runnable() { + /** + * {@inheritDoc} + */ + public void run() { // warn + + } + }; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideClass.java new file mode 100644 index 00000000000..f40149dcc14 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideClass.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.missingoverride; + +public class InputXpathMissingOverrideClass { + /** + * {@inheritDoc} + */ + public boolean equals(Object obj) { // warn + return false; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInheritDocInvalidPrivateMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInheritDocInvalidPrivateMethod.java new file mode 100644 index 00000000000..45727e88ec7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInheritDocInvalidPrivateMethod.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.missingoverride; + +public class InputXpathMissingOverrideInheritDocInvalidPrivateMethod { + /** + * {@inheritDoc} + */ + private void test() { // warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInheritDocInvalidPublicMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInheritDocInvalidPublicMethod.java new file mode 100644 index 00000000000..99cdbd3108d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInheritDocInvalidPublicMethod.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.missingoverride; + +public class InputXpathMissingOverrideInheritDocInvalidPublicMethod { + /** + * {@inheritDoc} + */ + public static void test() { // warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInterface.java new file mode 100644 index 00000000000..7d04fec524b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/InputXpathMissingOverrideInterface.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.missingoverride; + +public interface InputXpathMissingOverrideInterface { + /** + * {@inheritDoc} + */ + boolean test(Object obj); // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideAnonymous.java deleted file mode 100644 index 8c9b8750975..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideAnonymous.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingoverride; - -public class SuppressionXpathRegressionMissingOverrideAnonymous { - Runnable r = new Runnable() { - /** - * {@inheritDoc} - */ - public void run() { // warn - - } - }; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideClass.java deleted file mode 100644 index 4105a6589d8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideClass.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingoverride; - -public class SuppressionXpathRegressionMissingOverrideClass { - /** - * {@inheritDoc} - */ - public boolean equals(Object obj) { // warn - return false; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInheritDocInvalid1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInheritDocInvalid1.java deleted file mode 100644 index f946a95f591..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInheritDocInvalid1.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingoverride; - -public class SuppressionXpathRegressionMissingOverrideInheritDocInvalid1 { - /** - * {@inheritDoc} - */ - private void test() { // warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInheritDocInvalid2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInheritDocInvalid2.java deleted file mode 100644 index 283ce5dff25..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInheritDocInvalid2.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingoverride; - -public class SuppressionXpathRegressionMissingOverrideInheritDocInvalid2 { - /** - * {@inheritDoc} - */ - public static void test() { // warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInterface.java deleted file mode 100644 index 6c449ebc57a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingoverride/SuppressionXpathRegressionMissingOverrideInterface.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingoverride; - -public interface SuppressionXpathRegressionMissingOverrideInterface { - /** - * {@inheritDoc} - */ - boolean test(Object obj); // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/InputXpathMissingSwitchDefaultNested.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/InputXpathMissingSwitchDefaultNested.java new file mode 100644 index 00000000000..a81e629b58d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/InputXpathMissingSwitchDefaultNested.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.missingswitchdefault; + +public class InputXpathMissingSwitchDefaultNested { + public static void test2() { + int key = 2; + switch (key) { + case 1: + break; + case 2: + break; + default: + switch (key) { // warn + case 2: + break; + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/InputXpathMissingSwitchDefaultSimple.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/InputXpathMissingSwitchDefaultSimple.java new file mode 100644 index 00000000000..50ddffcbcae --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/InputXpathMissingSwitchDefaultSimple.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.missingswitchdefault; + +public class InputXpathMissingSwitchDefaultSimple { + public static void test1() { + int key = 2; + switch (key) { // warn + case 1: + break; + case 2: + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/SuppressionXpathRegressionMissingSwitchDefaultOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/SuppressionXpathRegressionMissingSwitchDefaultOne.java deleted file mode 100644 index 17290bd306d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/SuppressionXpathRegressionMissingSwitchDefaultOne.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingswitchdefault; - -public class SuppressionXpathRegressionMissingSwitchDefaultOne { - public static void test1() { - int key = 2; - switch (key) { // warn - case 1: - break; - case 2: - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/SuppressionXpathRegressionMissingSwitchDefaultTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/SuppressionXpathRegressionMissingSwitchDefaultTwo.java deleted file mode 100644 index 0daa65cdf1f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/missingswitchdefault/SuppressionXpathRegressionMissingSwitchDefaultTwo.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.missingswitchdefault; - -public class SuppressionXpathRegressionMissingSwitchDefaultTwo { - public static void test2() { - int key = 2; - switch (key) { - case 1: - break; - case 2: - break; - default: - switch (key) { // warn - case 2: - break; - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderAnnotation.java new file mode 100644 index 00000000000..0069004e538 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderAnnotation.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.modifierorder; + +public @InterfaceAnnotation @interface InputXpathModifierOrderAnnotation { //warn + int foo(); +} + +@interface InterfaceAnnotation {} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderMethod.java new file mode 100644 index 00000000000..dff854b99ab --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderMethod.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.modifierorder; + +public class InputXpathModifierOrderMethod { + private @MethodAnnotation void foo() {} // warn +} + +@interface MethodAnnotation {} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderVariable.java new file mode 100644 index 00000000000..f6b3ae5d435 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/InputXpathModifierOrderVariable.java @@ -0,0 +1,4 @@ +package org.checkstyle.suppressionxpathfilter.modifierorder; +public class InputXpathModifierOrderVariable { + static private boolean var = false; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderAnnotation.java deleted file mode 100644 index 88b9ca8e8a4..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderAnnotation.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.modifierorder; - -public @InterfaceAnnotation @interface SuppressionXpathRegressionModifierOrderAnnotation { //warn - int foo(); -} - -@interface InterfaceAnnotation {} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderMethod.java deleted file mode 100644 index 074d67590c8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderMethod.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.modifierorder; - -public class SuppressionXpathRegressionModifierOrderMethod { - private @MethodAnnotation void foo() {} // warn -} - -@interface MethodAnnotation {} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderVariable.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderVariable.java deleted file mode 100644 index 54b5c6be4ff..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/modifierorder/SuppressionXpathRegressionModifierOrderVariable.java +++ /dev/null @@ -1,4 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.modifierorder; -public class SuppressionXpathRegressionModifierOrderVariable { - static private boolean var = false; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsAllowDuplicates.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsAllowDuplicates.java new file mode 100644 index 00000000000..59b5d599378 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsAllowDuplicates.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.multiplestringliterals; + +public class InputXpathMultipleStringLiteralsAllowDuplicates { + String a = "StringContents"; // ok + public void myTest() { + String a2 = "StringContents"; + String a3 = "DoubleString" + "DoubleString"; // ok + String a5 = ", " + ", " + ", "; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsDefault.java new file mode 100644 index 00000000000..84637f29d55 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsDefault.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.multiplestringliterals; + +public class InputXpathMultipleStringLiteralsDefault { + String a = "StringContents"; // warn + String a1 = "unchecked"; + + @SuppressWarnings("unchecked") // ok + public void myTest() { + String a2 = "StringContents"; + String a4 = "SingleString"; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsIgnoreOccurrenceContext.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsIgnoreOccurrenceContext.java new file mode 100644 index 00000000000..92335c4dc88 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsIgnoreOccurrenceContext.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.multiplestringliterals; + +public class InputXpathMultipleStringLiteralsIgnoreOccurrenceContext { + String a = "StringContents"; + String a1 = "unchecked"; // warn + + @SuppressWarnings("unchecked") + public void myTest() { + String a3 = "DoubleString"; // ok + String a5 = "unchecked"; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsIgnoreRegexp.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsIgnoreRegexp.java new file mode 100644 index 00000000000..8f3efbb657b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplestringliterals/InputXpathMultipleStringLiteralsIgnoreRegexp.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.multiplestringliterals; + +public class InputXpathMultipleStringLiteralsIgnoreRegexp { + + public void myTest() { + + String a3 = "DoubleString" + "DoubleString"; // warn + String a4 = "SingleString"; // ok + String a5 = ", " + ", " + ", "; // ok + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/InputXpathMultipleVariableDeclarations.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/InputXpathMultipleVariableDeclarations.java new file mode 100644 index 00000000000..96106d9c7ea --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/InputXpathMultipleVariableDeclarations.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.multiplevariabledeclarations; + +public class InputXpathMultipleVariableDeclarations { + int i1; int j1; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/InputXpathMultipleVariableDeclarationsCommaSeparator.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/InputXpathMultipleVariableDeclarationsCommaSeparator.java new file mode 100644 index 00000000000..844c8e07885 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/InputXpathMultipleVariableDeclarationsCommaSeparator.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.multiplevariabledeclarations; + +public class InputXpathMultipleVariableDeclarationsCommaSeparator { + int i, j; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/SuppressionXpathRegressionMultipleVariableDeclarationsOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/SuppressionXpathRegressionMultipleVariableDeclarationsOne.java deleted file mode 100644 index 47d4f34e090..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/SuppressionXpathRegressionMultipleVariableDeclarationsOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.multiplevariabledeclarations; - -public class SuppressionXpathRegressionMultipleVariableDeclarationsOne { - int i, j; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/SuppressionXpathRegressionMultipleVariableDeclarationsTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/SuppressionXpathRegressionMultipleVariableDeclarationsTwo.java deleted file mode 100644 index c0b83f3e330..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/multiplevariabledeclarations/SuppressionXpathRegressionMultipleVariableDeclarationsTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.multiplevariabledeclarations; - -public class SuppressionXpathRegressionMultipleVariableDeclarationsTwo { - int i1; int j1; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesDo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesDo.java new file mode 100644 index 00000000000..fd1d577d5f4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesDo.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.needbraces; + +public class InputXpathNeedBracesDo { + /** @return helper func **/ + boolean condition() + { + return false; + } + + /** Test do/while loops **/ + public void test() { + // Invalid + do test(); while (condition()); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesEmptyLoopBody.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesEmptyLoopBody.java new file mode 100644 index 00000000000..92a1f319adf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesEmptyLoopBody.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.needbraces; + +public class InputXpathNeedBracesEmptyLoopBody { + private int incrementValue() { + return 1; + } + + public void test() { + while(incrementValue() < 5);; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesSingleLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesSingleLine.java new file mode 100644 index 00000000000..9b701198375 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesSingleLine.java @@ -0,0 +1,20 @@ +package org.checkstyle.suppressionxpathfilter.needbraces; + +import com.puppycrawl.tools.checkstyle.checks.blocks.needbraces.InputNeedBracesSingleLineStatements; + +public class InputXpathNeedBracesSingleLine { + private static class SomeClass { + boolean flag = true; + private static boolean test(boolean k) { + return k; + } + } + + /** Test do/while loops **/ + public int test() { + // Invalid + if (SomeClass.test(true) == true) // warn + return 4; + return 0; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesSingleLineLambda.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesSingleLineLambda.java new file mode 100644 index 00000000000..7707fdaa6d6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/InputXpathNeedBracesSingleLineLambda.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.needbraces; + +public class InputXpathNeedBracesSingleLineLambda { + static Runnable r3 = () -> // warn + String.CASE_INSENSITIVE_ORDER.equals("Hello world two!"); +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesDo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesDo.java deleted file mode 100644 index c210f82cc86..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesDo.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.needbraces; - -public class SuppressionXpathRegressionNeedBracesDo { - /** @return helper func **/ - boolean condition() - { - return false; - } - - /** Test do/while loops **/ - public void test() { - // Invalid - do test(); while (condition()); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesEmptyLoopBody.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesEmptyLoopBody.java deleted file mode 100644 index 185130872fb..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesEmptyLoopBody.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.needbraces; - -public class SuppressionXpathRegressionNeedBracesEmptyLoopBody { - private int incrementValue() { - return 1; - } - - public void test() { - while(incrementValue() < 5);; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesSingleLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesSingleLine.java deleted file mode 100644 index ae011c01eb7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesSingleLine.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.needbraces; - -import com.puppycrawl.tools.checkstyle.checks.blocks.needbraces.InputNeedBracesSingleLineStatements; - -public class SuppressionXpathRegressionNeedBracesSingleLine { - private static class SomeClass { - boolean flag = true; - private static boolean test(boolean k) { - return k; - } - } - - /** Test do/while loops **/ - public int test() { - // Invalid - if (SomeClass.test(true) == true) // warn - return 4; - return 0; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesSingleLineLambda.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesSingleLineLambda.java deleted file mode 100644 index f81b3480f80..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/needbraces/SuppressionXpathRegressionNeedBracesSingleLineLambda.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.needbraces; - -public class SuppressionXpathRegressionNeedBracesSingleLineLambda { - static Runnable r3 = () -> // warn - String.CASE_INSENSITIVE_ORDER.equals("Hello world two!"); -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/InputXpathNestedForDepth.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/InputXpathNestedForDepth.java new file mode 100644 index 00000000000..3bfaae6b5e8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/InputXpathNestedForDepth.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.nestedfordepth; + +public class InputXpathNestedForDepth { + public void test() { + for (int i = 0; i < 100; i++) { + for (int j = 0; j < 100; j++) { + for (int k = 0; k < 100; k++) { //warn + + } + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/InputXpathNestedForDepthMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/InputXpathNestedForDepthMax.java new file mode 100644 index 00000000000..728e48d0bb6 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/InputXpathNestedForDepthMax.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.nestedfordepth; + +public class InputXpathNestedForDepthMax { + public void test() { + for (int i1 = 0; i1 < 10; i1++) { + for (int i2 = 0; i2 < 10; i2++) { + for (int i3 = 0; i3 < 10; i3++) { + for (int i4 = 0; i4 < 10; i4++) { // warn + } + } + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/SuppressionXpathRegressionNestedForDepth.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/SuppressionXpathRegressionNestedForDepth.java deleted file mode 100644 index c26f2962d4b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/SuppressionXpathRegressionNestedForDepth.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nestedfordepth; - -public class SuppressionXpathRegressionNestedForDepth { - public void test() { - for (int i = 0; i < 100; i++) { - for (int j = 0; j < 100; j++) { - for (int k = 0; k < 100; k++) { //warn - - } - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/SuppressionXpathRegressionNestedForDepthMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/SuppressionXpathRegressionNestedForDepthMax.java deleted file mode 100644 index 9e67551a24f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedfordepth/SuppressionXpathRegressionNestedForDepthMax.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nestedfordepth; - -public class SuppressionXpathRegressionNestedForDepthMax { - public void test() { - for (int i1 = 0; i1 < 10; i1++) { - for (int i2 = 0; i2 < 10; i2++) { - for (int i3 = 0; i3 < 10; i3++) { - for (int i4 = 0; i4 < 10; i4++) { // warn - } - } - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/InputXpathNestedIfDepth.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/InputXpathNestedIfDepth.java new file mode 100644 index 00000000000..f5a7076e73c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/InputXpathNestedIfDepth.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.nestedifdepth; + +public class InputXpathNestedIfDepth { + public void test() { + int a = 1; + int b = 2; + int c = 3; + if (a > b) { + if (c > b) { + if (c > a) { //warn + + } + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/InputXpathNestedIfDepthMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/InputXpathNestedIfDepthMax.java new file mode 100644 index 00000000000..98dc6be6cb4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/InputXpathNestedIfDepthMax.java @@ -0,0 +1,20 @@ +package org.checkstyle.suppressionxpathfilter.nestedifdepth; + +public class InputXpathNestedIfDepthMax { + public void test() { + int a = 1; + int b = 2; + int c = 3; + if (a > b) { + if (c > b) { + if (c > a) { + if (1 == 2) { + if (2 == 3) { // warn + + } + } + } + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/SuppressionXpathRegressionNestedIfDepth.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/SuppressionXpathRegressionNestedIfDepth.java deleted file mode 100644 index 1f58b2981ae..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/SuppressionXpathRegressionNestedIfDepth.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nestedifdepth; - -public class SuppressionXpathRegressionNestedIfDepth { - public void test() { - int a = 1; - int b = 2; - int c = 3; - if (a > b) { - if (c > b) { - if (c > a) { //warn - - } - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/SuppressionXpathRegressionNestedIfDepthMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/SuppressionXpathRegressionNestedIfDepthMax.java deleted file mode 100644 index 6bdd7fb3dce..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedifdepth/SuppressionXpathRegressionNestedIfDepthMax.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nestedifdepth; - -public class SuppressionXpathRegressionNestedIfDepthMax { - public void test() { - int a = 1; - int b = 2; - int c = 3; - if (a > b) { - if (c > b) { - if (c > a) { - if (1 == 2) { - if (2 == 3) { // warn - - } - } - } - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/InputXpathNestedTryDepth.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/InputXpathNestedTryDepth.java new file mode 100644 index 00000000000..a12d1c4d8a2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/InputXpathNestedTryDepth.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.nestedtrydepth; + +public class InputXpathNestedTryDepth { + public void test() { + try { + try { + try { //warn + + } catch (Exception e) {} + } catch (Exception e) {} + } catch (Exception e) {} + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/InputXpathNestedTryDepthMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/InputXpathNestedTryDepthMax.java new file mode 100644 index 00000000000..95a2f8cb2a2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/InputXpathNestedTryDepthMax.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.nestedtrydepth; + +public class InputXpathNestedTryDepthMax { + public void test() { + try { + try { + try { + try { + try { // warn + + } catch (Exception e) {} + } catch (Exception e) {} + } catch (Exception e) {} + } catch (Exception e) {} + } catch (Exception e) {} + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/SuppressionXpathRegressionNestedTryDepth.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/SuppressionXpathRegressionNestedTryDepth.java deleted file mode 100644 index 6f97898c0ef..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/SuppressionXpathRegressionNestedTryDepth.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nestedtrydepth; - -public class SuppressionXpathRegressionNestedTryDepth { - public void test() { - try { - try { - try { //warn - - } catch (Exception e) {} - } catch (Exception e) {} - } catch (Exception e) {} - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/SuppressionXpathRegressionNestedTryDepthMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/SuppressionXpathRegressionNestedTryDepthMax.java deleted file mode 100644 index 693e8fa6257..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nestedtrydepth/SuppressionXpathRegressionNestedTryDepthMax.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nestedtrydepth; - -public class SuppressionXpathRegressionNestedTryDepthMax { - public void test() { - try { - try { - try { - try { - try { // warn - - } catch (Exception e) {} - } catch (Exception e) {} - } catch (Exception e) {} - } catch (Exception e) {} - } catch (Exception e) {} - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/InputXpathNoArrayTrailingCommaOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/InputXpathNoArrayTrailingCommaOne.java new file mode 100644 index 00000000000..eb9713038d1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/InputXpathNoArrayTrailingCommaOne.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.noarraytrailingcomma; + +public class InputXpathNoArrayTrailingCommaOne { + + int[] t1 = new int[] {1, 2, 3, 4, }; //warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/InputXpathNoArrayTrailingCommaTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/InputXpathNoArrayTrailingCommaTwo.java new file mode 100644 index 00000000000..d1e635ca4d8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/InputXpathNoArrayTrailingCommaTwo.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.noarraytrailingcomma; + +public class InputXpathNoArrayTrailingCommaTwo { + int[] t4 = new int[] {1,}; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/SuppressionXpathRegressionNoArrayTrailingCommaOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/SuppressionXpathRegressionNoArrayTrailingCommaOne.java deleted file mode 100644 index 3f6f7baa40c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/SuppressionXpathRegressionNoArrayTrailingCommaOne.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.noarraytrailingcomma; - -public class SuppressionXpathRegressionNoArrayTrailingCommaOne { - - int[] t1 = new int[] {1, 2, 3, 4, }; //warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/SuppressionXpathRegressionNoArrayTrailingCommaTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/SuppressionXpathRegressionNoArrayTrailingCommaTwo.java deleted file mode 100644 index 5635678bfb3..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/noarraytrailingcomma/SuppressionXpathRegressionNoArrayTrailingCommaTwo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.noarraytrailingcomma; - -public class SuppressionXpathRegressionNoArrayTrailingCommaTwo { - int[] t4 = new int[] {1,}; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/InputXpathNoCloneInnerClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/InputXpathNoCloneInnerClass.java new file mode 100644 index 00000000000..13271f94854 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/InputXpathNoCloneInnerClass.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.noclone; + +public class InputXpathNoCloneInnerClass { + + class InnerClass { + public Object clone() { return null; } // warn + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/InputXpathNoCloneMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/InputXpathNoCloneMethod.java new file mode 100644 index 00000000000..b88c530eed1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/InputXpathNoCloneMethod.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.noclone; + +public class InputXpathNoCloneMethod { + + public Object clone() { return null; } // warn + + public T clone(T t) { return null; } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/SuppressionXpathRegressionNoCloneOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/SuppressionXpathRegressionNoCloneOne.java deleted file mode 100644 index 4b6a363cd60..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/SuppressionXpathRegressionNoCloneOne.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.noclone; - -public class SuppressionXpathRegressionNoCloneOne { - - public Object clone() { return null; } // warn - - public T clone(T t) { return null; } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/SuppressionXpathRegressionNoCloneTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/SuppressionXpathRegressionNoCloneTwo.java deleted file mode 100644 index 3fe3d1a445b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/noclone/SuppressionXpathRegressionNoCloneTwo.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.noclone; - -public class SuppressionXpathRegressionNoCloneTwo { - - class InnerClass { - public Object clone() { return null; } // warn - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/InputXpathNoEnumTrailingCommaOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/InputXpathNoEnumTrailingCommaOne.java new file mode 100644 index 00000000000..b81f8648f73 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/InputXpathNoEnumTrailingCommaOne.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.noenumtrailingcomma; + +public class InputXpathNoEnumTrailingCommaOne { + + enum Foo3 { + FOO, + BAR, //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/InputXpathNoEnumTrailingCommaTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/InputXpathNoEnumTrailingCommaTwo.java new file mode 100644 index 00000000000..2600db9db5f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/InputXpathNoEnumTrailingCommaTwo.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.noenumtrailingcomma; + +public class InputXpathNoEnumTrailingCommaTwo { + + enum Foo6 { FOO, BAR,; } //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/SuppressionXpathRegressionNoEnumTrailingCommaOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/SuppressionXpathRegressionNoEnumTrailingCommaOne.java deleted file mode 100644 index 349e2069176..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/SuppressionXpathRegressionNoEnumTrailingCommaOne.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.noenumtrailingcomma; - -public class SuppressionXpathRegressionNoEnumTrailingCommaOne { - - enum Foo3 { - FOO, - BAR, //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/SuppressionXpathRegressionNoEnumTrailingCommaTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/SuppressionXpathRegressionNoEnumTrailingCommaTwo.java deleted file mode 100644 index 2733921418b..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/noenumtrailingcomma/SuppressionXpathRegressionNoEnumTrailingCommaTwo.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.noenumtrailingcomma; - -public class SuppressionXpathRegressionNoEnumTrailingCommaTwo { - - enum Foo6 { FOO, BAR,; } //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/InputXpathNoFinalizerInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/InputXpathNoFinalizerInner.java new file mode 100644 index 00000000000..40a4d575686 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/InputXpathNoFinalizerInner.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.nofinalizer; + +public class InputXpathNoFinalizerInner { + public static void doStuff() { + // some code here + } + + class InnerClass { + + @Override // warn + @Deprecated + protected void finalize() throws Throwable { + + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/InputXpathNoFinalizerMain.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/InputXpathNoFinalizerMain.java new file mode 100644 index 00000000000..617d3c04f72 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/InputXpathNoFinalizerMain.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.nofinalizer; + +public class InputXpathNoFinalizerMain { + public static void main(String[] args) { + // some code here + } + + protected void finalize() throws Throwable { // warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/SuppressionXpathRegressionNoFinalizer1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/SuppressionXpathRegressionNoFinalizer1.java deleted file mode 100644 index fb137c2c600..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/SuppressionXpathRegressionNoFinalizer1.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nofinalizer; - -public class SuppressionXpathRegressionNoFinalizer1 { - public static void main(String[] args) { - // some code here - } - - protected void finalize() throws Throwable { // warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/SuppressionXpathRegressionNoFinalizer2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/SuppressionXpathRegressionNoFinalizer2.java deleted file mode 100644 index c4deb695894..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nofinalizer/SuppressionXpathRegressionNoFinalizer2.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nofinalizer; - -public class SuppressionXpathRegressionNoFinalizer2 { - public static void doStuff() { - // some code here - } - - class InnerClass { - - @Override // warn - @Deprecated - protected void finalize() throws Throwable { - - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapDefault.java new file mode 100644 index 00000000000..c6a3031ec30 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapDefault.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter // warn + .nolinewrap; + +public class InputXpathNoLineWrapDefault { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapTokensCtorDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapTokensCtorDef.java new file mode 100644 index 00000000000..59d554554eb --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapTokensCtorDef.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.nolinewrap; + +public class InputXpathNoLineWrapTokensCtorDef { + InputXpathNoLineWrapTokensCtorDef //warn + (String input1, String input2) { + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapTokensMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapTokensMethodDef.java new file mode 100644 index 00000000000..e1d608419a3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/InputXpathNoLineWrapTokensMethodDef.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.nolinewrap; + +public class InputXpathNoLineWrapTokensMethodDef { + public static // warn + void test2() { + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap1.java deleted file mode 100644 index bb9cefce7a7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter // warn - .nolinewrap; - -public class SuppressionXpathRegressionNoLineWrap1 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap2.java deleted file mode 100644 index 2595020ab6e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap2.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nolinewrap; - -public class SuppressionXpathRegressionNoLineWrap2 { - public static // warn - void test2() { - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap3.java deleted file mode 100644 index 986d6d952e4..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nolinewrap/SuppressionXpathRegressionNoLineWrap3.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nolinewrap; - -public class SuppressionXpathRegressionNoLineWrap3 { - SuppressionXpathRegressionNoLineWrap3 //warn - (String input1, String input2) { - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfter.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfter.java new file mode 100644 index 00000000000..7f9c9cef157 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfter.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespaceafter; + +public class InputXpathNoWhitespaceAfter { + int bad = - 1;//warn + int good = -1; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfterLineBreaks.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfterLineBreaks.java new file mode 100644 index 00000000000..2ca6cd75568 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfterLineBreaks.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespaceafter; + +public class InputXpathNoWhitespaceAfterLineBreaks { + public void test() { + java.lang + . String s = "Test"; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfterTokens.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfterTokens.java new file mode 100644 index 00000000000..d1f4d27d228 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/InputXpathNoWhitespaceAfterTokens.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespaceafter; + +public class InputXpathNoWhitespaceAfterTokens { + public java. lang.String test() { // warn + return ""; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfter.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfter.java deleted file mode 100644 index 141773369f8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfter.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespaceafter; - -public class SuppressionXpathRegressionNoWhitespaceAfter { - int bad = - 1;//warn - int good = -1; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfterLineBreaks.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfterLineBreaks.java deleted file mode 100644 index 2067e5d0635..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfterLineBreaks.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespaceafter; - -public class SuppressionXpathRegressionNoWhitespaceAfterLineBreaks { - public void test() { - java.lang - . String s = "Test"; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfterTokens.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfterTokens.java deleted file mode 100644 index 028dc7e4154..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespaceafter/SuppressionXpathRegressionNoWhitespaceAfterTokens.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespaceafter; - -public class SuppressionXpathRegressionNoWhitespaceAfterTokens { - public java. lang.String test() { // warn - return ""; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBefore.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBefore.java new file mode 100644 index 00000000000..62dd223c6a0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBefore.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebefore; + +public class InputXpathNoWhitespaceBefore { + int bad ;//warn + int good; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBeforeLineBreaks.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBeforeLineBreaks.java new file mode 100644 index 00000000000..d48b0db5d73 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBeforeLineBreaks.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebefore; + +public class InputXpathNoWhitespaceBeforeLineBreaks { + public void test() { + int[][] array = { { 1, 2 } + , { 3, 4 } }; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBeforeTokens.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBeforeTokens.java new file mode 100644 index 00000000000..5ec7cca9a8c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/InputXpathNoWhitespaceBeforeTokens.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebefore; + +public class InputXpathNoWhitespaceBeforeTokens { + public java .lang.String test() { // warn + return ""; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBefore.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBefore.java deleted file mode 100644 index ebeceb659df..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBefore.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebefore; - -public class SuppressionXpathRegressionNoWhitespaceBefore { - int bad ;//warn - int good; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks.java deleted file mode 100644 index f4134b2d3f5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebefore; - -public class SuppressionXpathRegressionNoWhitespaceBeforeLineBreaks { - public void test() { - int[][] array = { { 1, 2 } - , { 3, 4 } }; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBeforeTokens.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBeforeTokens.java deleted file mode 100644 index bc3a2c79796..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebefore/SuppressionXpathRegressionNoWhitespaceBeforeTokens.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebefore; - -public class SuppressionXpathRegressionNoWhitespaceBeforeTokens { - public java .lang.String test() { // warn - return ""; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonFour.java new file mode 100644 index 00000000000..e38b14a5571 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonFour.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; + +public class InputXpathNoWhitespaceBeforeCaseDefaultColonFour { + { + switch(1) { + case 1: + break; + case 2: + break; + default + : // warn + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonOne.java new file mode 100644 index 00000000000..2657856d2fc --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonOne.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; + +public class InputXpathNoWhitespaceBeforeCaseDefaultColonOne { + { + switch(1) { + case 1 : // warn + break; + case 2: + break; + default: + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonThree.java new file mode 100644 index 00000000000..e4d9c877655 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonThree.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; + +public class InputXpathNoWhitespaceBeforeCaseDefaultColonThree { + { + switch(1) { + case 1 + : // warn + break; + case 2: + break; + default: + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonTwo.java new file mode 100644 index 00000000000..e14bc60b92a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/InputXpathNoWhitespaceBeforeCaseDefaultColonTwo.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; + +public class InputXpathNoWhitespaceBeforeCaseDefaultColonTwo { + { + switch(1) { + case 1: + break; + case 2: + break; + default : // warn + break; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour.java deleted file mode 100644 index 3ba4b0d5412..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; - -public class SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonFour { - { - switch(1) { - case 1: - break; - case 2: - break; - default - : // warn - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne.java deleted file mode 100644 index 24c82569eb9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; - -public class SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonOne { - { - switch(1) { - case 1 : // warn - break; - case 2: - break; - default: - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree.java deleted file mode 100644 index b0c3287d227..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; - -public class SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonThree { - { - switch(1) { - case 1 - : // warn - break; - case 2: - break; - default: - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo.java deleted file mode 100644 index 8561a7c132a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/nowhitespacebeforecasedefaultcolon/SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.nowhitespacebeforecasedefaultcolon; - -public class SuppressionXpathRegressionNoWhitespaceBeforeCaseDefaultColonTwo { - { - switch(1) { - case 1: - break; - case 2: - break; - default : // warn - break; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/InputXpathNPathComplexityMethod.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/InputXpathNPathComplexityMethod.java new file mode 100644 index 00000000000..a6c6179b127 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/InputXpathNPathComplexityMethod.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.npathcomplexity; + +public class InputXpathNPathComplexityMethod { + public void test() { //warn + while (true) { + if (1 > 0) { + + } else { + + } + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/InputXpathNPathComplexityStaticBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/InputXpathNPathComplexityStaticBlock.java new file mode 100644 index 00000000000..a104b95c63b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/InputXpathNPathComplexityStaticBlock.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.npathcomplexity; + +public class InputXpathNPathComplexityStaticBlock { + static { //warn + int i = 1; + // NP = (if-range=1) + (else-range=2) + 0 = 3 + if (System.currentTimeMillis() == 0) { + // NP(else-range) = (if-range=1) + (else-range=1) + (expr=0) = 2 + } else if (System.currentTimeMillis() == 0) { + } else { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/SuppressionXpathRegressionNPathComplexityOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/SuppressionXpathRegressionNPathComplexityOne.java deleted file mode 100644 index b03267b6a65..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/SuppressionXpathRegressionNPathComplexityOne.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.npathcomplexity; - -public class SuppressionXpathRegressionNPathComplexityOne { - public void test() { //warn - while (true) { - if (1 > 0) { - - } else { - - } - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/SuppressionXpathRegressionNPathComplexityTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/SuppressionXpathRegressionNPathComplexityTwo.java deleted file mode 100644 index 00cbcc8f587..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/npathcomplexity/SuppressionXpathRegressionNPathComplexityTwo.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.npathcomplexity; - -public class SuppressionXpathRegressionNPathComplexityTwo { - static { //warn - int i = 1; - // NP = (if-range=1) + (else-range=2) + 0 = 3 - if (System.currentTimeMillis() == 0) { - // NP(else-range) = (if-range=1) + (else-range=1) + (expr=0) = 2 - } else if (System.currentTimeMillis() == 0) { - } else { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/InputXpathOneStatementPerLineClassFields.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/InputXpathOneStatementPerLineClassFields.java new file mode 100644 index 00000000000..c41fa31a92c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/InputXpathOneStatementPerLineClassFields.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.onestatementperline; + +public class InputXpathOneStatementPerLineClassFields { + int i; int j; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/InputXpathOneStatementPerLineForLoopBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/InputXpathOneStatementPerLineForLoopBlock.java new file mode 100644 index 00000000000..f9231a04b62 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/InputXpathOneStatementPerLineForLoopBlock.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.onestatementperline; + +public class InputXpathOneStatementPerLineForLoopBlock { + private void foo5(int var1, int var2) { + for(int n = 0, + k = 1 + ; n<5 + ; + n++, k--) { var1++; var2++; } //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/SuppressionXpathRegressionOneStatementPerLineOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/SuppressionXpathRegressionOneStatementPerLineOne.java deleted file mode 100644 index 60c5e687ffb..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/SuppressionXpathRegressionOneStatementPerLineOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.onestatementperline; - -public class SuppressionXpathRegressionOneStatementPerLineOne { - int i; int j; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/SuppressionXpathRegressionOneStatementPerLineTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/SuppressionXpathRegressionOneStatementPerLineTwo.java deleted file mode 100644 index 33b09a0156a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/onestatementperline/SuppressionXpathRegressionOneStatementPerLineTwo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.onestatementperline; - -public class SuppressionXpathRegressionOneStatementPerLineTwo { - private void foo5(int var1, int var2) { - for(int n = 0, - k = 1 - ; n<5 - ; - n++, k--) { var1++; var2++; } //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/InputXpathOneTopLevelClassFirst.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/InputXpathOneTopLevelClassFirst.java new file mode 100644 index 00000000000..70e67a3b01a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/InputXpathOneTopLevelClassFirst.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.onetoplevelclass; + +public class InputXpathOneTopLevelClassFirst { + // methods +} + +class ViolatingSecondClass { //warn + // methods +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/InputXpathOneTopLevelClassSecond.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/InputXpathOneTopLevelClassSecond.java new file mode 100644 index 00000000000..456a4374283 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/InputXpathOneTopLevelClassSecond.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.onetoplevelclass; + +public class InputXpathOneTopLevelClassSecond { + // methods +} + +enum ViolationClass { // warn + // methods +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/SuppressionXpathRegressionOneTopLevelClassFirst.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/SuppressionXpathRegressionOneTopLevelClassFirst.java deleted file mode 100644 index 7165ca9f7d9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/SuppressionXpathRegressionOneTopLevelClassFirst.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.onetoplevelclass; - -public class SuppressionXpathRegressionOneTopLevelClassFirst { - // methods -} - -class ViolatingSecondClass { //warn - // methods -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/SuppressionXpathRegressionOneTopLevelClassSecond.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/SuppressionXpathRegressionOneTopLevelClassSecond.java deleted file mode 100644 index 4c304fe7d45..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/onetoplevelclass/SuppressionXpathRegressionOneTopLevelClassSecond.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.onetoplevelclass; - -public class SuppressionXpathRegressionOneTopLevelClassSecond { - // methods -} - -enum ViolationClass { // warn - // methods -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/InputXpathOperatorWrapNewLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/InputXpathOperatorWrapNewLine.java new file mode 100644 index 00000000000..81a58400df5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/InputXpathOperatorWrapNewLine.java @@ -0,0 +1,27 @@ +package org.checkstyle.suppressionxpathfilter.operatorwrap; + +public class InputXpathOperatorWrapNewLine { + + void test() { + int x = 1 + // warn + 2 + - + 3 + - + 4; + x = x + 2; + + } + + void test2() { + int x = 1 + + + 2 + - + 3 + - + 4; + x = x + 2; + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/InputXpathOperatorWrapPreviousLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/InputXpathOperatorWrapPreviousLine.java new file mode 100644 index 00000000000..495fda44ae4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/InputXpathOperatorWrapPreviousLine.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.operatorwrap; + +public class InputXpathOperatorWrapPreviousLine { + int b + = 10; // warn + int c = + 10; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/SuppressionXpathRegressionOperatorWrapNewLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/SuppressionXpathRegressionOperatorWrapNewLine.java deleted file mode 100644 index cf2114921c9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/SuppressionXpathRegressionOperatorWrapNewLine.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.operatorwrap; - -public class SuppressionXpathRegressionOperatorWrapNewLine { - - void test() { - int x = 1 + // warn - 2 - - - 3 - - - 4; - x = x + 2; - - } - - void test2() { - int x = 1 - + - 2 - - - 3 - - - 4; - x = x + 2; - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/SuppressionXpathRegressionOperatorWrapPreviousLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/SuppressionXpathRegressionOperatorWrapPreviousLine.java deleted file mode 100644 index a00623cf2b6..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/operatorwrap/SuppressionXpathRegressionOperatorWrapPreviousLine.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.operatorwrap; - -public class SuppressionXpathRegressionOperatorWrapPreviousLine { - int b - = 10; // warn - int c = - 10; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/SuppressionXpathRegressionOuterTypeFilename1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/InputXpathOuterTypeFilenameOne.java similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/SuppressionXpathRegressionOuterTypeFilename1.java rename to src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/InputXpathOuterTypeFilenameOne.java diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/SuppressionXpathRegressionOuterTypeFilename2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/InputXpathOuterTypeFilenameTwo.java similarity index 100% rename from src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/SuppressionXpathRegressionOuterTypeFilename2.java rename to src/it/resources/org/checkstyle/suppressionxpathfilter/outertypefilename/InputXpathOuterTypeFilenameTwo.java diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/InputXpathOuterTypeNumber.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/InputXpathOuterTypeNumber.java new file mode 100644 index 00000000000..101251efb09 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/InputXpathOuterTypeNumber.java @@ -0,0 +1,30 @@ +package org.checkstyle.suppressionxpathfilter.outertypenumber; //warn + +public class InputXpathOuterTypeNumber { + int i; int j; +} +class InputOuterTypeNumberSimple2 +{ + /** Some more Javadoc. */ + public void doSomething() + { + //"O" should be named "o" + for (Object O : new java.util.ArrayList()) + { + + } + } +} + +/** Test enum for member naming check */ +enum MyEnum1 +{ + /** ABC constant */ + ABC, + + /** XYZ constant */ + XYZ; + + /** Should be mSomeMember */ + private int someMember; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/InputXpathOuterTypeNumberDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/InputXpathOuterTypeNumberDefault.java new file mode 100644 index 00000000000..06d85533fcf --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/InputXpathOuterTypeNumberDefault.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.outertypenumber; // warn + +public class InputXpathOuterTypeNumberDefault { + public void test() {} +} + +interface Constants { + int X = 10; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/SuppressionXpathRegressionOuterTypeNumber.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/SuppressionXpathRegressionOuterTypeNumber.java deleted file mode 100644 index 167f05aa701..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/SuppressionXpathRegressionOuterTypeNumber.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.outertypenumber; //warn - -public class SuppressionXpathRegressionOuterTypeNumber { - int i; int j; -} -class InputOuterTypeNumberSimple2 -{ - /** Some more Javadoc. */ - public void doSomething() - { - //"O" should be named "o" - for (Object O : new java.util.ArrayList()) - { - - } - } -} - -/** Test enum for member naming check */ -enum MyEnum1 -{ - /** ABC constant */ - ABC, - - /** XYZ constant */ - XYZ; - - /** Should be mSomeMember */ - private int someMember; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/SuppressionXpathRegressionOuterTypeNumberDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/SuppressionXpathRegressionOuterTypeNumberDefault.java deleted file mode 100644 index 13ec9062daa..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/outertypenumber/SuppressionXpathRegressionOuterTypeNumberDefault.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.outertypenumber; // warn - -public class SuppressionXpathRegressionOuterTypeNumberDefault { - public void test() {} -} - -interface Constants { - int X = 10; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/InputXpathOverloadMethodsDeclarationOrderAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/InputXpathOverloadMethodsDeclarationOrderAnonymous.java new file mode 100644 index 00000000000..9025224f211 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/InputXpathOverloadMethodsDeclarationOrderAnonymous.java @@ -0,0 +1,34 @@ +package org.checkstyle.suppressionxpathfilter.overloadmethodsdeclarationorder; + +public class InputXpathOverloadMethodsDeclarationOrderAnonymous { + private InputXpathOverloadMethodsDeclarationOrderAnonymous anonymous + = new MyInputXpathOverloadMethodsDeclarationOrderAnonymous(); + + public InputXpathOverloadMethodsDeclarationOrderAnonymous getAnonymous() { + return anonymous; + } + + public void setAnonymous(InputXpathOverloadMethodsDeclarationOrderAnonymous anonymous) { + this.anonymous = anonymous; + } + + private static class MyInputXpathOverloadMethodsDeclarationOrderAnonymous + extends InputXpathOverloadMethodsDeclarationOrderAnonymous { + public void overloadMethod(int i) { + //do stuff + } + + public void overloadMethod(String s) { + //do more stuff + } + + public void separatorMethod() { + //do other stuff + } + + //violation because overloads shouldn't be separated + public void overloadMethod(String s, Boolean b, int i) { //warn + //do stuff + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/InputXpathOverloadMethodsDeclarationOrderDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/InputXpathOverloadMethodsDeclarationOrderDefault.java new file mode 100644 index 00000000000..2884ebff7f5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/InputXpathOverloadMethodsDeclarationOrderDefault.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.overloadmethodsdeclarationorder; + +public class InputXpathOverloadMethodsDeclarationOrderDefault { + + public void overloadMethod(String s) { + //do stuff + } + + public void separatorMethod() { + //do stuff + } + + //violation because overloads shouldn't be separated + public void overloadMethod(String s, Boolean b, int i) { //warn + //do stuff + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/SuppressionXpathRegressionOverloadMethodsDeclarationOrder1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/SuppressionXpathRegressionOverloadMethodsDeclarationOrder1.java deleted file mode 100644 index 84091a090cc..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/SuppressionXpathRegressionOverloadMethodsDeclarationOrder1.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.overloadmethodsdeclarationorder; - -public class SuppressionXpathRegressionOverloadMethodsDeclarationOrder1 { - - public void overloadMethod(String s) { - //do stuff - } - - public void separatorMethod() { - //do stuff - } - - //violation because overloads shouldn't be separated - public void overloadMethod(String s, Boolean b, int i) { //warn - //do stuff - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/SuppressionXpathRegressionOverloadMethodsDeclarationOrder2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/SuppressionXpathRegressionOverloadMethodsDeclarationOrder2.java deleted file mode 100644 index 1ec1212cc55..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/overloadmethodsdeclarationorder/SuppressionXpathRegressionOverloadMethodsDeclarationOrder2.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.overloadmethodsdeclarationorder; - -public class SuppressionXpathRegressionOverloadMethodsDeclarationOrder2 { - private SuppressionXpathRegressionOverloadMethodsDeclarationOrder2 anonymous - = new MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2(); - - public SuppressionXpathRegressionOverloadMethodsDeclarationOrder2 getAnonymous() { - return anonymous; - } - - public void setAnonymous(SuppressionXpathRegressionOverloadMethodsDeclarationOrder2 anonymous) { - this.anonymous = anonymous; - } - - private static class MySuppressionXpathRegressionOverloadMethodsDeclarationOrder2 - extends SuppressionXpathRegressionOverloadMethodsDeclarationOrder2 { - public void overloadMethod(int i) { - //do stuff - } - - public void overloadMethod(String s) { - //do more stuff - } - - public void separatorMethod() { - //do other stuff - } - - //violation because overloads shouldn't be separated - public void overloadMethod(String s, Boolean b, int i) { //warn - //do stuff - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameOne.java new file mode 100644 index 00000000000..832d8899737 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameOne.java @@ -0,0 +1,4 @@ +package org.checkstyle.suppressionxpathfilter.packagename; // warn + +public class InputXpathPackageNameOne { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameTwo.java new file mode 100644 index 00000000000..22bf8aa0a12 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/packagename/InputXpathPackageNameTwo.java @@ -0,0 +1,7 @@ +/* test comment */ package + org.checkstyle. // warn + suppressionxpathfilter. + packagename; + +public interface InputXpathPackageNameTwo { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentCtor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentCtor.java new file mode 100644 index 00000000000..7e22c64126b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentCtor.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.parameterassignment; + +public class InputXpathParameterAssignmentCtor { + int field; + InputXpathParameterAssignmentCtor(int field) { + int i = field; + this.field = field; + i++; + field += 1; // warn + this.field++; + } + // without parameters + InputXpathParameterAssignmentCtor() { + field = 0; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentLambdas.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentLambdas.java new file mode 100644 index 00000000000..16c84804a7e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentLambdas.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.parameterassignment; + +public class InputXpathParameterAssignmentLambdas { + + public interface SomeInterface { + void method(int a); + } + + SomeInterface obj1 = q -> q++; // warn + void method() { + int q = 12; + SomeInterface obj = (d) -> { + SomeInterface b = (c) -> obj1.equals(this); // ok + int c = 12; + c++; + }; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentMethods.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentMethods.java new file mode 100644 index 00000000000..ef9132890ca --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameterassignment/InputXpathParameterAssignmentMethods.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.parameterassignment; + +public class InputXpathParameterAssignmentMethods { + int field; + void Test1(int field) { + int i = field; + this.field = field; + i++; + field += 1; // warn + this.field++; + } + // without parameters + void Test2() { + field = 0; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameAccessModifier.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameAccessModifier.java new file mode 100644 index 00000000000..db8191c9b5e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameAccessModifier.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.parametername; + +class InputXpathParameterNameAccessModifier { + + private void method1(int a) { // ok + } + + public void method2(int b) { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameDefaultPattern.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameDefaultPattern.java new file mode 100644 index 00000000000..a992146e5ed --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameDefaultPattern.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.parametername; + +class InputXpathParameterNameDefaultPattern { + + void method1(int v_1) { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameDifferentPattern.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameDifferentPattern.java new file mode 100644 index 00000000000..d53bb33a709 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameDifferentPattern.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.parametername; + +class InputXpathParameterNameDifferentPattern { + + void method2(int V2) { // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameIgnoreOverridden.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameIgnoreOverridden.java new file mode 100644 index 00000000000..9615a078850 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/InputXpathParameterNameIgnoreOverridden.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.parametername; + +class InputXpathParameterNameIgnoreOverridden { + + void method2(int V2) { // warn + } + + @Override + public boolean equals(Object V3) { // ok + return true; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameAccessModifier.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameAccessModifier.java deleted file mode 100644 index 73e3ae929fa..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameAccessModifier.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parametername; - -class SuppressionXpathRegressionParameterNameAccessModifier { - - private void method1(int a) { // ok - } - - public void method2(int b) { // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameDefaultPattern.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameDefaultPattern.java deleted file mode 100644 index b4a3d4b3245..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameDefaultPattern.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parametername; - -class SuppressionXpathRegressionParameterNameDefaultPattern { - - void method1(int v_1) { // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameDifferentPattern.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameDifferentPattern.java deleted file mode 100644 index 4e798765568..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameDifferentPattern.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parametername; - -class SuppressionXpathRegressionParameterNameDifferentPattern { - - void method2(int V2) { // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameIgnoreOverridden.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameIgnoreOverridden.java deleted file mode 100644 index b8f3af489b8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parametername/SuppressionXpathRegressionParameterNameIgnoreOverridden.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parametername; - -class SuppressionXpathRegressionParameterNameIgnoreOverridden { - - void method2(int V2) { // warn - } - - @Override - public boolean equals(Object V3) { // ok - return true; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberDefault.java new file mode 100644 index 00000000000..94f790ce682 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberDefault.java @@ -0,0 +1,15 @@ +package org.checkstyle.suppressionxpathfilter.parameternumber; + +public class InputXpathParameterNumberDefault { + + void myMethod(int a, int b, int c, int d, int e, int f, int g, int h, // warn + int i, int j, int k) { + } + + public InputXpathParameterNumberDefault() { // ok + } + + void myMethod2(int a, int b, int c, int d) { // ok + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberIgnoreAnnotatedBy.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberIgnoreAnnotatedBy.java new file mode 100644 index 00000000000..b1a43262c49 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberIgnoreAnnotatedBy.java @@ -0,0 +1,26 @@ +package org.checkstyle.suppressionxpathfilter.parameternumber; + +public class InputXpathParameterNumberIgnoreAnnotatedBy { + static class InnerClass { + static { + new Object() { + void method() { + if (true) { + new Object() { + @MyAnno + void ignoredMethod(int a, @MyAnno int b, int c) { + + } + + void checkedMethod(int a, @MyAnno int b, int c) { // warn + + } + }; + } + } + }; + } + } + + @interface MyAnno {} +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberIgnoreOverriddenMethods.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberIgnoreOverriddenMethods.java new file mode 100644 index 00000000000..dc88724641c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberIgnoreOverriddenMethods.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.parameternumber; + +public class InputXpathParameterNumberIgnoreOverriddenMethods + extends InputXpathParameterNumberDefault { + + public InputXpathParameterNumberIgnoreOverriddenMethods(int a, // warn + int b, int c, int d, int e, int f, int g, int h) + { + } + @Override + void myMethod(int a, int b, int c, int d, int e, int f, int g, int h, // ok + int k, int l, int m) { + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberMethods.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberMethods.java new file mode 100644 index 00000000000..b24fe82a7a7 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parameternumber/InputXpathParameterNumberMethods.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.parameternumber; + +public class InputXpathParameterNumberMethods + extends InputXpathParameterNumberDefault { + + @Override + void myMethod(int a, int b, int c, int d, int e, int f, int g, int h, // warn + int k, int l, int m) { + } + public InputXpathParameterNumberMethods(int a, int b, int c, // ok + int d, int e, int f, int g, int h, int k, int l, int m) + { + } + void myMethod3(int a, int b, int c, int d, int e, int f, int g, int h) { // ok + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadLeftFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadLeftFollowed.java new file mode 100644 index 00000000000..4c8d3478ea4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadLeftFollowed.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.parenpad; + +public class InputXpathParenPadLeftFollowed { + void method() { + if ( false) {//warn + } + if (true) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadLeftNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadLeftNotFollowed.java new file mode 100644 index 00000000000..93a41818131 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadLeftNotFollowed.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.parenpad; + +public class InputXpathParenPadLeftNotFollowed { + void method() { + if (false ) {//warn + } + if ( true ) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadRightNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadRightNotPreceded.java new file mode 100644 index 00000000000..05a881927e0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadRightNotPreceded.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.parenpad; + +public class InputXpathParenPadRightNotPreceded{ + void method() { + if ( false) {//warn + } + if ( true ) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadRightPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadRightPreceded.java new file mode 100644 index 00000000000..170fa6a93d0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/InputXpathParenPadRightPreceded.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.parenpad; + +public class InputXpathParenPadRightPreceded { + void method() { + if (false ) {//warn + } + if (true) { + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadLeftFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadLeftFollowed.java deleted file mode 100644 index 29d6a7fd958..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadLeftFollowed.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parenpad; - -public class SuppressionXpathRegressionParenPadLeftFollowed { - void method() { - if ( false) {//warn - } - if (true) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadLeftNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadLeftNotFollowed.java deleted file mode 100644 index 131d08e9803..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadLeftNotFollowed.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parenpad; - -public class SuppressionXpathRegressionParenPadLeftNotFollowed { - void method() { - if (false ) {//warn - } - if ( true ) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadRightNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadRightNotPreceded.java deleted file mode 100644 index 30ac92875da..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadRightNotPreceded.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parenpad; - -public class SuppressionXpathRegressionParenPadRightNotPreceded{ - void method() { - if ( false) {//warn - } - if ( true ) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadRightPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadRightPreceded.java deleted file mode 100644 index 9d3a6ac5b93..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/parenpad/SuppressionXpathRegressionParenPadRightPreceded.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.parenpad; - -public class SuppressionXpathRegressionParenPadRightPreceded { - void method() { - if (false ) {//warn - } - if (true) { - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportDuplicate.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportDuplicate.java new file mode 100644 index 00000000000..9ef530bb56d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportDuplicate.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.redundantimport; + +import java.util.Scanner; +import java.util.Scanner; // warn + +public class InputXpathRedundantImportDuplicate { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportInternal.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportInternal.java new file mode 100644 index 00000000000..c65d4989e6a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportInternal.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.redundantimport; + +import org.checkstyle.suppressionxpathfilter.redundantimport.InputXpathRedundantImportInternal; // warn + +public class InputXpathRedundantImportInternal { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportLibrary.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportLibrary.java new file mode 100644 index 00000000000..0f614ca137c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/InputXpathRedundantImportLibrary.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.redundantimport; + +import java.lang.String; // warn + +public class InputXpathRedundantImportLibrary { +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport1.java deleted file mode 100644 index 93be31e0b69..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport1.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.redundantimport; - -import org.checkstyle.suppressionxpathfilter.redundantimport.SuppressionXpathRegressionRedundantImport1; // warn - -public class SuppressionXpathRegressionRedundantImport1 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport2.java deleted file mode 100644 index 9f5d2b69629..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport2.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.redundantimport; - -import java.lang.String; // warn - -public class SuppressionXpathRegressionRedundantImport2 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport3.java deleted file mode 100644 index 6438f4286b2..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/redundantimport/SuppressionXpathRegressionRedundantImport3.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.redundantimport; - -import java.util.Scanner; -import java.util.Scanner; // warn - -public class SuppressionXpathRegressionRedundantImport3 { -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/InputXpathRequireThisOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/InputXpathRequireThisOne.java new file mode 100644 index 00000000000..75a22224d7d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/InputXpathRequireThisOne.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.requirethis; + +public class InputXpathRequireThisOne { + private int age = 23; + + public void changeAge() { + age = 24; //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/InputXpathRequireThisTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/InputXpathRequireThisTwo.java new file mode 100644 index 00000000000..f36c48cd094 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/InputXpathRequireThisTwo.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.requirethis; + +public class InputXpathRequireThisTwo { + void method1() { + int i = 3; + } + + void method2(int i) { + method1(); //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/SuppressionXpathRegressionRequireThisOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/SuppressionXpathRegressionRequireThisOne.java deleted file mode 100644 index ffa6fc9542c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/SuppressionXpathRegressionRequireThisOne.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.requirethis; - -public class SuppressionXpathRegressionRequireThisOne { - private int age = 23; - - public void changeAge() { - age = 24; //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/SuppressionXpathRegressionRequireThisTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/SuppressionXpathRegressionRequireThisTwo.java deleted file mode 100644 index 566a866653f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/requirethis/SuppressionXpathRegressionRequireThisTwo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.requirethis; - -public class SuppressionXpathRegressionRequireThisTwo { - void method1() { - int i = 3; - } - - void method2(int i) { - method1(); //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountCtor.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountCtor.java new file mode 100644 index 00000000000..835d5ea3ea2 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountCtor.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.returncount; + +public class InputXpathReturnCountCtor { + InputXpathReturnCountCtor() { // warn + int i = 1; + switch(i) { + case 1: return; + case 2: return; + case 3: return; + case 4: return; + } + return; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountLambda.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountLambda.java new file mode 100644 index 00000000000..172ef597785 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountLambda.java @@ -0,0 +1,16 @@ +package org.checkstyle.suppressionxpathfilter.returncount; + +import java.util.function.Function; + +public class InputXpathReturnCountLambda { + void testLambda() { + Function a = i -> { // warn + switch(i) { + case 1: return true; + case 2: return true; + case 3: return true; + } + return false; + }; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountNonVoid.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountNonVoid.java new file mode 100644 index 00000000000..c8d1e11e8d4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountNonVoid.java @@ -0,0 +1,26 @@ +package org.checkstyle.suppressionxpathfilter.returncount; + +public class InputXpathReturnCountNonVoid { + public boolean equals(Object obj) { // OK + int i = 1; + switch (i) { + case 1: return true; + case 2: return true; + case 3: return true; + case 4: return true; + case 5: return true; + case 6: return true; + } + return false; + } + boolean testNonVoid() { // warn + int i = 1; + switch(i) { + case 1: return true; + case 2: return true; + case 3: return true; + } + return false; + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountVoid.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountVoid.java new file mode 100644 index 00000000000..f0943f70294 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/InputXpathReturnCountVoid.java @@ -0,0 +1,26 @@ +package org.checkstyle.suppressionxpathfilter.returncount; + +class InputXpathReturnCountVoid { + public boolean equals(Object obj) { // OK + int i = 1; + switch (i) { + case 1: return true; + case 2: return true; + case 3: return true; + case 4: return true; + case 5: return true; + case 6: return true; + } + return false; + } + void testVoid() { // warn + int i = 1; + switch(i) { + case 1: return; + case 2: return; + case 3: return; + case 4: return; + } + return; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount1.java deleted file mode 100644 index b63032dfd91..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount1.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.returncount; - -class SuppressionXpathRegressionReturnCount1 { - public boolean equals(Object obj) { // OK - int i = 1; - switch (i) { - case 1: return true; - case 2: return true; - case 3: return true; - case 4: return true; - case 5: return true; - case 6: return true; - } - return false; - } - void testVoid() { // warn - int i = 1; - switch(i) { - case 1: return; - case 2: return; - case 3: return; - case 4: return; - } - return; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount2.java deleted file mode 100644 index 82def249827..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount2.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.returncount; - -public class SuppressionXpathRegressionReturnCount2 { - public boolean equals(Object obj) { // OK - int i = 1; - switch (i) { - case 1: return true; - case 2: return true; - case 3: return true; - case 4: return true; - case 5: return true; - case 6: return true; - } - return false; - } - boolean testNonVoid() { // warn - int i = 1; - switch(i) { - case 1: return true; - case 2: return true; - case 3: return true; - } - return false; - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount3.java deleted file mode 100644 index 73b4266b57a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount3.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.returncount; - -public class SuppressionXpathRegressionReturnCount3 { - SuppressionXpathRegressionReturnCount3() { // warn - int i = 1; - switch(i) { - case 1: return; - case 2: return; - case 3: return; - case 4: return; - } - return; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount4.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount4.java deleted file mode 100644 index 30862025ac1..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/returncount/SuppressionXpathRegressionReturnCount4.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.returncount; - -import java.util.function.Function; - -public class SuppressionXpathRegressionReturnCount4 { - void testLambda() { - Function a = i -> { // warn - switch(i) { - case 1: return true; - case 2: return true; - case 3: return true; - } - return false; - }; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyFour.java new file mode 100644 index 00000000000..6886432c9c5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyFour.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.rightcurly; + +public class InputXpathRightCurlyFour { + public void sample(boolean flag) { + if (flag) { + System.identityHashCode("heh"); + flag = !flag; } String.CASE_INSENSITIVE_ORDER. //warn + equals("Xe-xe"); + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyOne.java new file mode 100644 index 00000000000..891b452842c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyOne.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.rightcurly; + +public class InputXpathRightCurlyOne { + public void test(int x) { + if (x > 0) + { + return; + } //warn + else if (x < 0) { + ; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyThree.java new file mode 100644 index 00000000000..5a115e34702 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyThree.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.rightcurly; + +public class InputXpathRightCurlyThree { + public void sample(boolean flag) { + if (flag) { String.CASE_INSENSITIVE_ORDER.equals("it is ok."); } //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyTwo.java new file mode 100644 index 00000000000..c8169acfea1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/InputXpathRightCurlyTwo.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.rightcurly; + +import java.io.BufferedReader; +import java.io.IOException; + +public class InputXpathRightCurlyTwo { + public void fooMethod() throws IOException { + try (BufferedReader br1 = new BufferedReader(null)) { + ; } //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyFour.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyFour.java deleted file mode 100644 index 68fd53d5e2f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyFour.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.rightcurly; - -public class SuppressionXpathRegressionRightCurlyFour { - public void sample(boolean flag) { - if (flag) { - System.identityHashCode("heh"); - flag = !flag; } String.CASE_INSENSITIVE_ORDER. //warn - equals("Xe-xe"); - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyOne.java deleted file mode 100644 index 05cda1281cd..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyOne.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.rightcurly; - -public class SuppressionXpathRegressionRightCurlyOne { - public void test(int x) { - if (x > 0) - { - return; - } //warn - else if (x < 0) { - ; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyThree.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyThree.java deleted file mode 100644 index d034b07e05c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyThree.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.rightcurly; - -public class SuppressionXpathRegressionRightCurlyThree { - public void sample(boolean flag) { - if (flag) { String.CASE_INSENSITIVE_ORDER.equals("it is ok."); } //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyTwo.java deleted file mode 100644 index 0ae0cfa5cc2..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/rightcurly/SuppressionXpathRegressionRightCurlyTwo.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.rightcurly; - -import java.io.BufferedReader; -import java.io.IOException; - -public class SuppressionXpathRegressionRightCurlyTwo { - public void fooMethod() throws IOException { - try (BufferedReader br1 = new BufferedReader(null)) { - ; } //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionAnonymous.java new file mode 100644 index 00000000000..09c0683c3c8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionAnonymous.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.simplifybooleanexpression; + +public class InputXpathSimplifyBooleanExpressionAnonymous { + + class Inner{ + boolean a,b,c,d; + void test(){ + if (a == true) {}; // warn + boolean e = e = (a && b) ? c : d; // ok + if (a == b) {}; // ok + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionInterface.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionInterface.java new file mode 100644 index 00000000000..c84f4f96126 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionInterface.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.simplifybooleanexpression; + +public class InputXpathSimplifyBooleanExpressionInterface { + interface Inner { + default void test() { + boolean a = false, b = false, c = false, d = false; + if (!(b != true)) {}; // warn + boolean e = e = (a && b) ? c : d; // ok + if (a == b) {}; // ok + + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionSimple.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionSimple.java new file mode 100644 index 00000000000..2423915e215 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanexpression/InputXpathSimplifyBooleanExpressionSimple.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.simplifybooleanexpression; + +public class InputXpathSimplifyBooleanExpressionSimple { + private Object c,d,e; + boolean a,b; + public void test(){ + boolean f = c == null ? false : c.equals(d); // ok + if (!false) {} // warn + e = (a && b) ? c : d; // ok + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/InputXpathSimplifyBooleanReturnIfBooleanEqualsBoolean.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/InputXpathSimplifyBooleanReturnIfBooleanEqualsBoolean.java new file mode 100644 index 00000000000..242bd654086 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/InputXpathSimplifyBooleanReturnIfBooleanEqualsBoolean.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.simplifybooleanreturn; + +public class InputXpathSimplifyBooleanReturnIfBooleanEqualsBoolean { + public static boolean toTest() { + boolean even = false; + if (even == true) { // warn + return false; + } + else { + return true; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/InputXpathSimplifyBooleanReturnIfBooleanReturnBoolean.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/InputXpathSimplifyBooleanReturnIfBooleanReturnBoolean.java new file mode 100644 index 00000000000..d4bade16433 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/InputXpathSimplifyBooleanReturnIfBooleanReturnBoolean.java @@ -0,0 +1,19 @@ +package org.checkstyle.suppressionxpathfilter.simplifybooleanreturn; + +import java.util.ArrayList; +import java.util.Arrays; + +public class InputXpathSimplifyBooleanReturnIfBooleanReturnBoolean { + public static void toTest() { + ArrayList boolList + = new ArrayList(Arrays.asList(false, true, false, false)); + boolList.stream().filter(statement -> { + if (!statement) { // warn + return true; + } + else { + return false; + } + }); + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanEqualsBoolean.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanEqualsBoolean.java deleted file mode 100644 index a154459a2b9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanEqualsBoolean.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.simplifybooleanreturn; - -public class SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanEqualsBoolean { - public static boolean toTest() { - boolean even = false; - if (even == true) { // warn - return false; - } - else { - return true; - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanReturnBoolean.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanReturnBoolean.java deleted file mode 100644 index cd7e74f066e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/simplifybooleanreturn/SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanReturnBoolean.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.simplifybooleanreturn; - -import java.util.ArrayList; -import java.util.Arrays; - -public class SuppressionXpathRegressionSimplifyBooleanReturnIfBooleanReturnBoolean { - public static void toTest() { - ArrayList boolList - = new ArrayList(Arrays.asList(false, true, false, false)); - boolList.stream().filter(statement -> { - if (!statement) { // warn - return true; - } - else { - return false; - } - }); - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/InputXpathSingleSpaceSeparator.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/InputXpathSingleSpaceSeparator.java new file mode 100644 index 00000000000..4bab7813d5c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/InputXpathSingleSpaceSeparator.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.singlespaceseparator; + +public class InputXpathSingleSpaceSeparator { + long bad;//warn + long good; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/InputXpathSingleSpaceSeparatorValidateComments.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/InputXpathSingleSpaceSeparatorValidateComments.java new file mode 100644 index 00000000000..9f2404be9c8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/InputXpathSingleSpaceSeparatorValidateComments.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.singlespaceseparator; + +public class InputXpathSingleSpaceSeparatorValidateComments { + long y; // an invalid comment // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/SuppressionXpathRegressionSingleSpaceSeparator.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/SuppressionXpathRegressionSingleSpaceSeparator.java deleted file mode 100644 index 8003b653c48..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/SuppressionXpathRegressionSingleSpaceSeparator.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.singlespaceseparator; - -public class SuppressionXpathRegressionSingleSpaceSeparator { - long bad;//warn - long good; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/SuppressionXpathRegressionSingleSpaceSeparatorValidateComments.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/SuppressionXpathRegressionSingleSpaceSeparatorValidateComments.java deleted file mode 100644 index 8877f640736..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/singlespaceseparator/SuppressionXpathRegressionSingleSpaceSeparatorValidateComments.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.singlespaceseparator; - -public class SuppressionXpathRegressionSingleSpaceSeparatorValidateComments { - long y; // an invalid comment // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableName.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableName.java new file mode 100644 index 00000000000..051aaf1239c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/staticvariablename/InputXpathStaticVariableName.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.staticvariablename; + +public class InputXpathStaticVariableName { + + public int num1; // OK + public static int NUM2; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityExp.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityExp.java new file mode 100644 index 00000000000..20c7ba6433a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityExp.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.stringliteralequality; + +public class InputXpathStringLiteralEqualityExp { + public void myFunction(){ + String foo = "pending"; + boolean flag = (foo == "done"); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityFalse.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityFalse.java new file mode 100644 index 00000000000..c0991262cf0 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityFalse.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.stringliteralequality; + +public class InputXpathStringLiteralEqualityFalse { + public void myFunction(){ + String foo = "pending"; + while (foo != "done") {} // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityTrue.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityTrue.java new file mode 100644 index 00000000000..4ae1574134d --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/InputXpathStringLiteralEqualityTrue.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.stringliteralequality; + +public class InputXpathStringLiteralEqualityTrue { + public void myFunction(){ + String foo = "pending"; + if (foo == "done") {} // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality.java deleted file mode 100644 index 782999ba68f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.stringliteralequality; - -public class SuppressionXpathRegressionStringLiteralEquality { - public void myFunction(){ - String foo = "pending"; - if (foo == "done") {} // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality1.java deleted file mode 100644 index a85e4bbc369..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality1.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.stringliteralequality; - -public class SuppressionXpathRegressionStringLiteralEquality1 { - public void myFunction(){ - String foo = "pending"; - while (foo != "done") {} // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality2.java deleted file mode 100644 index 8b23c9208cf..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/stringliteralequality/SuppressionXpathRegressionStringLiteralEquality2.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.stringliteralequality; - -public class SuppressionXpathRegressionStringLiteralEquality2 { - public void myFunction(){ - String foo = "pending"; - boolean flag = (foo == "done"); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperCloneInnerClone.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperCloneInnerClone.java new file mode 100644 index 00000000000..1c316ded608 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperCloneInnerClone.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.superclone; + +public class InputXpathSuperCloneInnerClone { + class InnerClone + { + public Object clone() // warn + { + class Inner + { + public Object clone() throws CloneNotSupportedException + { + return super.clone(); + } + } + return null; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperCloneNoSuperClone.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperCloneNoSuperClone.java new file mode 100644 index 00000000000..005a070c4ce --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperCloneNoSuperClone.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.superclone; + +public class InputXpathSuperCloneNoSuperClone { + class NoSuperClone + { + public Object clone() // warn + { + return null; + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperClonePlainAndSubclasses.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperClonePlainAndSubclasses.java new file mode 100644 index 00000000000..87a63338f4c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/superclone/InputXpathSuperClonePlainAndSubclasses.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.superclone; + +class InputXpathSuperClonePlainAndSubclasses { + public Object clone() { // warn + return null; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountCustomMax.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountCustomMax.java new file mode 100644 index 00000000000..d7d81bd8fac --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountCustomMax.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.throwscount; + +interface InputXpathThrowsCountCustomMax { + public void myFunction() throws IllegalStateException, // warn, max allowed is 2 + ArrayIndexOutOfBoundsException, + NullPointerException; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountDefault.java new file mode 100644 index 00000000000..7f8949a0518 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountDefault.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.throwscount; + +public class InputXpathThrowsCountDefault { + public void myFunction() throws CloneNotSupportedException, // warn, max allowed is 4 + ArrayIndexOutOfBoundsException, + StringIndexOutOfBoundsException, + IllegalStateException, + NullPointerException { + //body + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountPrivateMethods.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountPrivateMethods.java new file mode 100644 index 00000000000..b266237d771 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/InputXpathThrowsCountPrivateMethods.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.throwscount; + +public class InputXpathThrowsCountPrivateMethods { + interface myClass{ + //body + } + public void myFunc() { + myClass foo = new myClass() { + private void privateFunc() throws CloneNotSupportedException, // warn, max allowed is 4 + ClassNotFoundException, + IllegalAccessException, + ArithmeticException, + ClassCastException { + // body + } + }; + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount1.java deleted file mode 100644 index 316544842fa..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount1.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.throwscount; - -public class SuppressionXpathRegressionThrowsCount1 { - public void myFunction() throws CloneNotSupportedException, // warn, max allowed is 4 - ArrayIndexOutOfBoundsException, - StringIndexOutOfBoundsException, - IllegalStateException, - NullPointerException { - //body - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount2.java deleted file mode 100644 index e7432e43514..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount2.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.throwscount; - -interface SuppressionXpathRegressionThrowsCount2 { - public void myFunction() throws IllegalStateException, // warn, max allowed is 2 - ArrayIndexOutOfBoundsException, - NullPointerException; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount3.java deleted file mode 100644 index 37c9b74d263..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/throwscount/SuppressionXpathRegressionThrowsCount3.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.throwscount; - -public class SuppressionXpathRegressionThrowsCount3 { - interface myClass{ - //body - } - public void myFunc() { - myClass foo = new myClass() { - private void privateFunc() throws CloneNotSupportedException, // warn, max allowed is 4 - ClassNotFoundException, - IllegalAccessException, - ArithmeticException, - ClassCastException { - // body - } - }; - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/InputXpathTodoCommentBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/InputXpathTodoCommentBlock.java new file mode 100644 index 00000000000..b064916a38f --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/InputXpathTodoCommentBlock.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.todocomment; + +public class InputXpathTodoCommentBlock { + /* // warn + * FIXME: + * TODO + */ +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/InputXpathTodoCommentSingleLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/InputXpathTodoCommentSingleLine.java new file mode 100644 index 00000000000..f2e63c0ee49 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/InputXpathTodoCommentSingleLine.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.todocomment; + +public class InputXpathTodoCommentSingleLine { + // warn FIXME: +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/SuppressionXpathRegressionTodoCommentOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/SuppressionXpathRegressionTodoCommentOne.java deleted file mode 100644 index 76595bc80df..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/SuppressionXpathRegressionTodoCommentOne.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.todocomment; - -public class SuppressionXpathRegressionTodoCommentOne { - // warn FIXME: -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/SuppressionXpathRegressionTodoCommentTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/SuppressionXpathRegressionTodoCommentTwo.java deleted file mode 100644 index 23e883ebade..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/todocomment/SuppressionXpathRegressionTodoCommentTwo.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.todocomment; - -public class SuppressionXpathRegressionTodoCommentTwo { - /* // warn - * FIXME: - * TODO - */ -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/InputXpathTrailingCommentBlock.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/InputXpathTrailingCommentBlock.java new file mode 100644 index 00000000000..9576d9f2a05 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/InputXpathTrailingCommentBlock.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.trailingcomment; + +public class InputXpathTrailingCommentBlock { + int j; /* bad c-style comment. */ // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/InputXpathTrailingCommentSingleLine.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/InputXpathTrailingCommentSingleLine.java new file mode 100644 index 00000000000..b28316a8e63 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/InputXpathTrailingCommentSingleLine.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.trailingcomment; + +public class InputXpathTrailingCommentSingleLine { + int i; // don't use trailing comments :) // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/SuppressionXpathRegressionTrailingComment1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/SuppressionXpathRegressionTrailingComment1.java deleted file mode 100644 index 503f40d9a7d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/SuppressionXpathRegressionTrailingComment1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.trailingcomment; - -public class SuppressionXpathRegressionTrailingComment1 { - int i; // don't use trailing comments :) // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/SuppressionXpathRegressionTrailingComment2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/SuppressionXpathRegressionTrailingComment2.java deleted file mode 100644 index cb5e9548557..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/trailingcomment/SuppressionXpathRegressionTrailingComment2.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.trailingcomment; - -public class SuppressionXpathRegressionTrailingComment2 { - int j; /* bad c-style comment. */ // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadLeftFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadLeftFollowed.java new file mode 100644 index 00000000000..9b3ef63130b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadLeftFollowed.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.typecastparenpad; + +public class InputXpathTypecastParenPadLeftFollowed { + Object bad = ( Object)null;//warn + Object good = (Object)null; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadLeftNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadLeftNotFollowed.java new file mode 100644 index 00000000000..1065c5fbded --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadLeftNotFollowed.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.typecastparenpad; + +public class InputXpathTypecastParenPadLeftNotFollowed { + Object bad = (Object )null;//warn + Object good = ( Object )null; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadRightNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadRightNotPreceded.java new file mode 100644 index 00000000000..bf88cf3a446 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadRightNotPreceded.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.typecastparenpad; + +public class InputXpathTypecastParenPadRightNotPreceded{ + Object bad = ( Object)null;//warn + Object good = ( Object )null; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadRightPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadRightPreceded.java new file mode 100644 index 00000000000..70da3a8f155 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/InputXpathTypecastParenPadRightPreceded.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.typecastparenpad; + +public class InputXpathTypecastParenPadRightPreceded { + Object bad = (Object )null;//warn + Object good = (Object)null; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadLeftFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadLeftFollowed.java deleted file mode 100644 index 8f5b559342f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadLeftFollowed.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.typecastparenpad; - -public class SuppressionXpathRegressionTypecastParenPadLeftFollowed { - Object bad = ( Object)null;//warn - Object good = (Object)null; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadLeftNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadLeftNotFollowed.java deleted file mode 100644 index eabf3524dc2..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadLeftNotFollowed.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.typecastparenpad; - -public class SuppressionXpathRegressionTypecastParenPadLeftNotFollowed { - Object bad = (Object )null;//warn - Object good = ( Object )null; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadRightNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadRightNotPreceded.java deleted file mode 100644 index ac755e4a69d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadRightNotPreceded.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.typecastparenpad; - -public class SuppressionXpathRegressionTypecastParenPadRightNotPreceded{ - Object bad = ( Object)null;//warn - Object good = ( Object )null; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadRightPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadRightPreceded.java deleted file mode 100644 index 9b79e9849d7..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/typecastparenpad/SuppressionXpathRegressionTypecastParenPadRightPreceded.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.typecastparenpad; - -public class SuppressionXpathRegressionTypecastParenPadRightPreceded { - Object bad = (Object )null;//warn - Object good = (Object)null; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/InputXpathTypeNameDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/InputXpathTypeNameDefault.java new file mode 100644 index 00000000000..b91721ea890 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/InputXpathTypeNameDefault.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.typename; + +public class InputXpathTypeNameDefault { + public interface FirstName {} // OK + private class SecondName_ {} // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/InputXpathTypeNameInterfaceDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/InputXpathTypeNameInterfaceDef.java new file mode 100644 index 00000000000..3228dc0e723 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/InputXpathTypeNameInterfaceDef.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.typename; + +public class InputXpathTypeNameInterfaceDef { + + public interface I_firstName {} // OK + interface SecondName {} // warn + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/SuppressionXpathRegressionTypeName1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/SuppressionXpathRegressionTypeName1.java deleted file mode 100644 index a896931d5bb..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/SuppressionXpathRegressionTypeName1.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.typename; - -public class SuppressionXpathRegressionTypeName1 { - public interface FirstName {} // OK - private class SecondName_ {} // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/SuppressionXpathRegressionTypeName2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/SuppressionXpathRegressionTypeName2.java deleted file mode 100644 index 3bd0bebfdca..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/typename/SuppressionXpathRegressionTypeName2.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.typename; - -public class SuppressionXpathRegressionTypeName2 { - - public interface I_firstName {} // OK - interface SecondName {} // warn - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/InputXpathUncommentedMainDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/InputXpathUncommentedMainDefault.java new file mode 100644 index 00000000000..8e9fcc53599 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/InputXpathUncommentedMainDefault.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.uncommentedmain; + +public class InputXpathUncommentedMainDefault { + public static void main(String... args) {} // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/InputXpathUncommentedMainInStaticClass.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/InputXpathUncommentedMainInStaticClass.java new file mode 100644 index 00000000000..474cd87a17b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/InputXpathUncommentedMainInStaticClass.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.uncommentedmain; + +public class InputXpathUncommentedMainInStaticClass { + public static class Launcher { + public static void main(String[] args) {} // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/SuppressionXpathRegressionUncommentedMain.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/SuppressionXpathRegressionUncommentedMain.java deleted file mode 100644 index 3af568f424d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/SuppressionXpathRegressionUncommentedMain.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.uncommentedmain; - -public class SuppressionXpathRegressionUncommentedMain { - public static void main(String... args) {} // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/SuppressionXpathRegressionUncommentedMainTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/SuppressionXpathRegressionUncommentedMainTwo.java deleted file mode 100644 index 4e2753e69fd..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/uncommentedmain/SuppressionXpathRegressionUncommentedMainTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.uncommentedmain; - -public class SuppressionXpathRegressionUncommentedMainTwo { - public static class Launcher { - public static void main(String[] args) {} // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesClassFields.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesClassFields.java new file mode 100644 index 00000000000..d56c7c3d087 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesClassFields.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesClassFields { + int a = (2*2); // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesConditionals.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesConditionals.java new file mode 100644 index 00000000000..5f5aa4cb3d8 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesConditionals.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesConditionals { + void foo(String a) { + if (('A' == a.charAt(0))) { // warn + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesExprWithMethodParam.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesExprWithMethodParam.java new file mode 100644 index 00000000000..3b3f1b57f3e --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesExprWithMethodParam.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesExprWithMethodParam { + void foo(int a, int b) { + int c = (a*b); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesLambdas.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesLambdas.java new file mode 100644 index 00000000000..0b1d71812e5 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesLambdas.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesLambdas { + public interface Predicate { + boolean test(Integer t); + } + Predicate predicate = (value) -> value != null; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesLocalVariables.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesLocalVariables.java new file mode 100644 index 00000000000..a697f7859ed --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesLocalVariables.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesLocalVariables { + void foo (int a) { + int b = (a) + 5; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesMethodDef.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesMethodDef.java new file mode 100644 index 00000000000..b1ab0dda609 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesMethodDef.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesMethodDef { + void foo () { + int a = (10) + 5; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesReturnExpr.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesReturnExpr.java new file mode 100644 index 00000000000..02d1065b427 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesReturnExpr.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesReturnExpr { + int foo (int a) { + return (a+6); // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesStringLiteral.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesStringLiteral.java new file mode 100644 index 00000000000..6ae7d1bc394 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/InputXpathUnnecessaryParenthesesStringLiteral.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; + +public class InputXpathUnnecessaryParenthesesStringLiteral { + void foo () { + String str = ("Checkstyle") + "is cool"; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses1.java deleted file mode 100644 index 020ecf74faf..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses1.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses1 { - int a = (2*2); // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses2.java deleted file mode 100644 index 880e0a8327a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses2.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses2 { - void foo(String a) { - if (('A' == a.charAt(0))) { // warn - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses3.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses3.java deleted file mode 100644 index b43a3527003..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses3.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses3 { - public interface Predicate { - boolean test(Integer t); - } - Predicate predicate = (value) -> value != null; // warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses4.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses4.java deleted file mode 100644 index 41a24f71355..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses4.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses4 { - void foo (int a) { - int b = (a) + 5; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses5.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses5.java deleted file mode 100644 index a7e15795ac8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses5.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses5 { - void foo () { - String str = ("Checkstyle") + "is cool"; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses6.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses6.java deleted file mode 100644 index 66b7ace1ad0..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses6.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses6 { - void foo () { - int a = (10) + 5; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses7.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses7.java deleted file mode 100644 index 47c89097457..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses7.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses7 { - int foo (int a) { - return (a+6); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses8.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses8.java deleted file mode 100644 index 5fe695b46c2..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessaryparentheses/SuppressionXpathRegressionUnnecessaryParentheses8.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessaryparentheses; - -public class SuppressionXpathRegressionUnnecessaryParentheses8 { - void foo(int a, int b) { - int c = (a*b); // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java new file mode 100644 index 00000000000..1e0fd4ab329 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java @@ -0,0 +1,25 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonafteroutertypedeclaration; + +interface InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes { + + class Inner1 { + + }; // OK + + enum Inner2 { + + }; // OK + + interface Inner3 { + + }; // OK + + @interface Inner4 { + + }; // OK + +}; //warn + +class NoSemicolonAfter { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationSimple.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationSimple.java new file mode 100644 index 00000000000..dd9916aa027 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationSimple.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonafteroutertypedeclaration; + +public class InputXpathUnnecessarySemicolonAfterOuterTypeDeclarationSimple { + +}; //warn diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration.java deleted file mode 100644 index d555ec085db..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonafteroutertypedeclaration; - -public class SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration { - -}; //warn diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java deleted file mode 100644 index cb9d19fff91..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonafteroutertypedeclaration; - -interface SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes { - - class Inner1 { - - }; // OK - - enum Inner2 { - - }; // OK - - interface Inner3 { - - }; // OK - - @interface Inner4 { - - }; // OK - -}; //warn - -class NoSemicolonAfter { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault.java new file mode 100644 index 00000000000..edba6c7c011 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonaftertypememberdeclaration; + +public class InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationDefault { + void method(){}; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java new file mode 100644 index 00000000000..665750cc4b4 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonaftertypememberdeclaration; + +public class InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens { + void method() {}; //warn + public InputXpathUnnecessarySemicolonAfterTypeMemberDeclarationTokens() {}; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration.java deleted file mode 100644 index 78e8f455f7a..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonaftertypememberdeclaration; - -public class SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration { - void method(){}; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java deleted file mode 100644 index 07f29b0f273..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonaftertypememberdeclaration; - -public class SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens { - void method() {}; //warn - public SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens() {}; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/InputXpathUnnecessarySemicolonInEnumerationAll.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/InputXpathUnnecessarySemicolonInEnumerationAll.java new file mode 100644 index 00000000000..122e520fc48 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/InputXpathUnnecessarySemicolonInEnumerationAll.java @@ -0,0 +1,5 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicoloninenumeration; + +enum InputXpathUnnecessarySemicolonInEnumerationAll { + A,B(){ public String toString() { return "";}},; /** warn */ +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/InputXpathUnnecessarySemicolonInEnumerationSimple.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/InputXpathUnnecessarySemicolonInEnumerationSimple.java new file mode 100644 index 00000000000..fe8e2d4e705 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/InputXpathUnnecessarySemicolonInEnumerationSimple.java @@ -0,0 +1,12 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicoloninenumeration; + +public class InputXpathUnnecessarySemicolonInEnumerationSimple { +} + +enum Good { + One, Two +} + +enum Bad { + Third; //warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/SuppressionXpathRegressionUnnecessarySemicolonInEnumeration.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/SuppressionXpathRegressionUnnecessarySemicolonInEnumeration.java deleted file mode 100644 index 1a2c3a146c5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/SuppressionXpathRegressionUnnecessarySemicolonInEnumeration.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicoloninenumeration; - -public class SuppressionXpathRegressionUnnecessarySemicolonInEnumeration { -} - -enum Good { - One, Two -} - -enum Bad { - Third; //warn -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll.java deleted file mode 100644 index 2d4e6ec23a9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicoloninenumeration/SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicoloninenumeration; - -enum SuppressionXpathRegressionUnnecessarySemicolonInEnumerationAll { - A,B(){ public String toString() { return "";}},; /** warn */ -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/InputXpathUnnecessarySemicolonInTryWithResourcesDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/InputXpathUnnecessarySemicolonInTryWithResourcesDefault.java new file mode 100644 index 00000000000..fb6508eb764 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/InputXpathUnnecessarySemicolonInTryWithResourcesDefault.java @@ -0,0 +1,14 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonintrywithresources; + +import java.io.PipedReader; +import java.io.Reader; + +public class InputXpathUnnecessarySemicolonInTryWithResourcesDefault { + void m() throws Exception { + try(Reader good = new PipedReader()){} + try(Reader good = new PipedReader();Reader better = new PipedReader()){} + + try(Reader bad = new PipedReader();Reader worse = new PipedReader();){} //warn + + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace.java new file mode 100644 index 00000000000..fbd2177d9b1 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace.java @@ -0,0 +1,10 @@ +package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonintrywithresources; + +import java.io.PipedReader; +import java.io.Reader; + +public class InputXpathUnnecessarySemicolonInTryWithResourcesNoBrace { + void test() throws Exception { + try(Reader good = new PipedReader();){} // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources.java deleted file mode 100644 index 7b3f9a70eb4..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonintrywithresources; - -import java.io.PipedReader; -import java.io.Reader; - -public class SuppressionXpathRegressionUnnecessarySemicolonInTryWithResources { - void m() throws Exception { - try(Reader good = new PipedReader()){} - try(Reader good = new PipedReader();Reader better = new PipedReader()){} - - try(Reader bad = new PipedReader();){} //warn - try(Reader bad = new PipedReader();Reader worse = new PipedReader();){} //warn - - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace.java deleted file mode 100644 index aa1bbd0715c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonintrywithresources/SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unnecessarysemicolonintrywithresources; - -import java.io.PipedReader; -import java.io.Reader; - -public class SuppressionXpathRegressionUnnecessarySemicolonInTryWithResourcesNoBrace { - void test() throws Exception { - try(Reader good = new PipedReader();){} // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/InputXpathUnusedImports.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/InputXpathUnusedImports.java new file mode 100644 index 00000000000..f8a90849c08 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/InputXpathUnusedImports.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unusedimports; + +import java.util.List; // warn + +public class InputXpathUnusedImports { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/InputXpathUnusedImportsStatic.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/InputXpathUnusedImportsStatic.java new file mode 100644 index 00000000000..8924e008c49 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/InputXpathUnusedImportsStatic.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.unusedimports; + +import static java.util.Map.Entry; // warn + +public class InputXpathUnusedImportsStatic { + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/SuppressionXpathRegressionUnusedImportsOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/SuppressionXpathRegressionUnusedImportsOne.java deleted file mode 100644 index 3c8000bc75d..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/SuppressionXpathRegressionUnusedImportsOne.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unusedimports; - -import java.util.List; // warn - -public class SuppressionXpathRegressionUnusedImportsOne { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/SuppressionXpathRegressionUnusedImportsTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/SuppressionXpathRegressionUnusedImportsTwo.java deleted file mode 100644 index bb0db0178f9..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedimports/SuppressionXpathRegressionUnusedImportsTwo.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unusedimports; - -import static java.util.Map.Entry; // warn - -public class SuppressionXpathRegressionUnusedImportsTwo { - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/InputXpathUnusedLocalVariableOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/InputXpathUnusedLocalVariableOne.java new file mode 100644 index 00000000000..43fd14d3e67 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/InputXpathUnusedLocalVariableOne.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.unusedlocalvariable; + +public class InputXpathUnusedLocalVariableOne { + + public void foo() { + int a = 20; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/InputXpathUnusedLocalVariableTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/InputXpathUnusedLocalVariableTwo.java new file mode 100644 index 00000000000..fa0821eba3c --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/InputXpathUnusedLocalVariableTwo.java @@ -0,0 +1,17 @@ +package org.checkstyle.suppressionxpathfilter.unusedlocalvariable; + +import java.util.function.Predicate; + +public class InputXpathUnusedLocalVariableTwo { + + int b = 21; + + void foo() { + int b = 12; // warn + a(this.b); + } + + static void a(int a) { + } + +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/SuppressionXpathRegressionUnusedLocalVariableOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/SuppressionXpathRegressionUnusedLocalVariableOne.java deleted file mode 100644 index d302a9b1234..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/SuppressionXpathRegressionUnusedLocalVariableOne.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unusedlocalvariable; - -public class SuppressionXpathRegressionUnusedLocalVariableOne { - - public void foo() { - int a = 20; // warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/SuppressionXpathRegressionUnusedLocalVariableTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/SuppressionXpathRegressionUnusedLocalVariableTwo.java deleted file mode 100644 index 94fde4787c1..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/unusedlocalvariable/SuppressionXpathRegressionUnusedLocalVariableTwo.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.unusedlocalvariable; - -import java.util.function.Predicate; - -public class SuppressionXpathRegressionUnusedLocalVariableTwo { - - int b = 21; - - void foo() { - int b = 12; // warn - a(this.b); - } - - static void a(int a) { - } - -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/InputXpathUpperEllOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/InputXpathUpperEllOne.java new file mode 100644 index 00000000000..7782be8b63a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/InputXpathUpperEllOne.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.upperell; + +public class InputXpathUpperEllOne { + long bad = 0l;//warn + long good = 0L; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/InputXpathUpperEllTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/InputXpathUpperEllTwo.java new file mode 100644 index 00000000000..4ed7cb0ff4a --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/InputXpathUpperEllTwo.java @@ -0,0 +1,8 @@ +package org.checkstyle.suppressionxpathfilter.upperell; + +public interface InputXpathUpperEllTwo { + public static void test() { + long var1 = 508987; + long var2 = 508987l; //warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/SuppressionXpathRegressionUpperEllFirst.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/SuppressionXpathRegressionUpperEllFirst.java deleted file mode 100644 index 1e458724f28..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/SuppressionXpathRegressionUpperEllFirst.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.upperell; - -public class SuppressionXpathRegressionUpperEllFirst { - long bad = 0l;//warn - long good = 0L; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/SuppressionXpathRegressionUpperEllSecond.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/SuppressionXpathRegressionUpperEllSecond.java deleted file mode 100644 index aa2dd37ab4f..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/upperell/SuppressionXpathRegressionUpperEllSecond.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.upperell; - -public interface SuppressionXpathRegressionUpperEllSecond { - public static void test() { - long var1 = 508987; - long var2 = 508987l; //warn - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/InputXpathVariableDeclarationUsageDistanceOne.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/InputXpathVariableDeclarationUsageDistanceOne.java new file mode 100644 index 00000000000..616fb41e341 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/InputXpathVariableDeclarationUsageDistanceOne.java @@ -0,0 +1,11 @@ +package org.checkstyle.suppressionxpathfilter.variabledeclarationusagedistance; + +public class InputXpathVariableDeclarationUsageDistanceOne { + private int test1; + + public void test(int test1) { + int temp = -1; // warn + this.test1 = test1; + temp = test1; // DECLARATION OF VARIABLE 'temp' SHOULD BE HERE (distance = 2) + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/InputXpathVariableDeclarationUsageDistanceTwo.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/InputXpathVariableDeclarationUsageDistanceTwo.java new file mode 100644 index 00000000000..ed696f3a29b --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/InputXpathVariableDeclarationUsageDistanceTwo.java @@ -0,0 +1,18 @@ +package org.checkstyle.suppressionxpathfilter.variabledeclarationusagedistance; + + +public class InputXpathVariableDeclarationUsageDistanceTwo { + public void testMethod2() { + int count; // warn + int a = 3; + int b = 2; + { + a = a + + b + - 5 + + 2 + * a; + count = b; // DECLARATION OF VARIABLE 'count' SHOULD BE HERE (distance = 2) + } + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/SuppressionXpathRegressionVariableDeclarationUsageDistance1.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/SuppressionXpathRegressionVariableDeclarationUsageDistance1.java deleted file mode 100644 index 24ace80d3a4..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/SuppressionXpathRegressionVariableDeclarationUsageDistance1.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.variabledeclarationusagedistance; - -public class SuppressionXpathRegressionVariableDeclarationUsageDistance1 { - private int test1; - - public void test(int test1) { - int temp = -1; // warn - this.test1 = test1; - temp = test1; // DECLARATION OF VARIABLE 'temp' SHOULD BE HERE (distance = 2) - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/SuppressionXpathRegressionVariableDeclarationUsageDistance2.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/SuppressionXpathRegressionVariableDeclarationUsageDistance2.java deleted file mode 100644 index f3d823977e5..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/variabledeclarationusagedistance/SuppressionXpathRegressionVariableDeclarationUsageDistance2.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.variabledeclarationusagedistance; - - -public class SuppressionXpathRegressionVariableDeclarationUsageDistance2 { - public void testMethod2() { - int count; // warn - int a = 3; - int b = 2; - { - a = a - + b - - 5 - + 2 - * a; - count = b; // DECLARATION OF VARIABLE 'count' SHOULD BE HERE (distance = 2) - } - } -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierAnnotation.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierAnnotation.java new file mode 100644 index 00000000000..8e4e54ffe97 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierAnnotation.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.visibilitymodifier; + +public class InputXpathVisibilityModifierAnnotation { + @java.lang.Deprecated + String annotatedString; // warn + + @Deprecated + String shortCustomAnnotated; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierAnonymous.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierAnonymous.java new file mode 100644 index 00000000000..fc46d090baa --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierAnonymous.java @@ -0,0 +1,13 @@ +package org.checkstyle.suppressionxpathfilter.visibilitymodifier; + +public class InputXpathVisibilityModifierAnonymous { + private Runnable runnable = new Runnable() { + + public String field1; // warn + + @Override + public void run() { + + } + }; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierDefault.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierDefault.java new file mode 100644 index 00000000000..f4d51703059 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierDefault.java @@ -0,0 +1,7 @@ +package org.checkstyle.suppressionxpathfilter.visibilitymodifier; + +public class InputXpathVisibilityModifierDefault { + private int myPrivateField; // ok, private class member is allowed + + int field; // warn +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierInner.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierInner.java new file mode 100644 index 00000000000..ddfaa00e028 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/visibilitymodifier/InputXpathVisibilityModifierInner.java @@ -0,0 +1,9 @@ +package org.checkstyle.suppressionxpathfilter.visibilitymodifier; + +public class InputXpathVisibilityModifierInner { + class InnerClass { + private int field1; + + public int field2; // warn + } +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/InputXpathWhitespaceAfterNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/InputXpathWhitespaceAfterNotFollowed.java new file mode 100644 index 00000000000..2b94bbfa793 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/InputXpathWhitespaceAfterNotFollowed.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.whitespaceafter; + +public class InputXpathWhitespaceAfterNotFollowed { + int[] bad = {1,2}; //warn + int[] good = {1, 2}; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/InputXpathWhitespaceAfterTypecast.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/InputXpathWhitespaceAfterTypecast.java new file mode 100644 index 00000000000..e49beb1e7f3 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/InputXpathWhitespaceAfterTypecast.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.whitespaceafter; + +public class InputXpathWhitespaceAfterTypecast { + Object bad = (Object)null; //warn + Object good = (Object) null; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/SuppressionXpathRegressionWhitespaceAfterNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/SuppressionXpathRegressionWhitespaceAfterNotFollowed.java deleted file mode 100644 index 318370eb37c..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/SuppressionXpathRegressionWhitespaceAfterNotFollowed.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.whitespaceafter; - -public class SuppressionXpathRegressionWhitespaceAfterNotFollowed { - int[] bad = {1,2}; //warn - int[] good = {1, 2}; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/SuppressionXpathRegressionWhitespaceAfterTypecast.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/SuppressionXpathRegressionWhitespaceAfterTypecast.java deleted file mode 100644 index c0c9c1f6ba3..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespaceafter/SuppressionXpathRegressionWhitespaceAfterTypecast.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.whitespaceafter; - -public class SuppressionXpathRegressionWhitespaceAfterTypecast { - Object bad = (Object)null; //warn - Object good = (Object) null; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/InputXpathWhitespaceAroundNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/InputXpathWhitespaceAroundNotFollowed.java new file mode 100644 index 00000000000..fce10267c88 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/InputXpathWhitespaceAroundNotFollowed.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.whitespacearound; + +public class InputXpathWhitespaceAroundNotFollowed { + int bad =0; //warn + int good = 0; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/InputXpathWhitespaceAroundNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/InputXpathWhitespaceAroundNotPreceded.java new file mode 100644 index 00000000000..118542f9633 --- /dev/null +++ b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/InputXpathWhitespaceAroundNotPreceded.java @@ -0,0 +1,6 @@ +package org.checkstyle.suppressionxpathfilter.whitespacearound; + +public class InputXpathWhitespaceAroundNotPreceded { + int bad= 0; //warn + int good = 0; +} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/SuppressionXpathRegressionWhitespaceAroundNotFollowed.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/SuppressionXpathRegressionWhitespaceAroundNotFollowed.java deleted file mode 100644 index fa04b7a906e..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/SuppressionXpathRegressionWhitespaceAroundNotFollowed.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.whitespacearound; - -public class SuppressionXpathRegressionWhitespaceAroundNotFollowed { - int bad =0; //warn - int good = 0; -} diff --git a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/SuppressionXpathRegressionWhitespaceAroundNotPreceded.java b/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/SuppressionXpathRegressionWhitespaceAroundNotPreceded.java deleted file mode 100644 index 358f5af48b8..00000000000 --- a/src/it/resources/org/checkstyle/suppressionxpathfilter/whitespacearound/SuppressionXpathRegressionWhitespaceAroundNotPreceded.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.checkstyle.suppressionxpathfilter.whitespacearound; - -public class SuppressionXpathRegressionWhitespaceAroundNotPreceded { - int bad= 0; //warn - int good = 0; -} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java b/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java index e7f95250bb0..3f5b4834ebc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/AbstractAutomaticBean.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,8 @@ import java.util.StringTokenizer; import java.util.regex.Pattern; +import javax.annotation.Nullable; + import org.apache.commons.beanutils.BeanUtilsBean; import org.apache.commons.beanutils.ConversionException; import org.apache.commons.beanutils.ConvertUtilsBean; @@ -168,6 +170,7 @@ private static void registerIntegralTypes(ConvertUtilsBean cub) { */ private static void registerCustomTypes(ConvertUtilsBean cub) { cub.register(new PatternConverter(), Pattern.class); + cub.register(new PatternArrayConverter(), Pattern[].class); cub.register(new SeverityLevelConverter(), SeverityLevel.class); cub.register(new ScopeConverter(), Scope.class); cub.register(new UriConverter(), URI.class); @@ -311,6 +314,25 @@ public Object convert(Class type, Object value) { } + /** A converter that converts a comma-separated string into an array of patterns. */ + private static final class PatternArrayConverter implements Converter { + + @SuppressWarnings("unchecked") + @Override + public Object convert(Class type, Object value) { + final StringTokenizer tokenizer = new StringTokenizer( + value.toString(), COMMA_SEPARATOR); + final List result = new ArrayList<>(); + + while (tokenizer.hasMoreTokens()) { + final String token = tokenizer.nextToken(); + result.add(CommonUtil.createPattern(token.trim())); + } + + return result.toArray(new Pattern[0]); + } + } + /** A converter that converts strings to severity level. */ private static final class SeverityLevelConverter implements Converter { @@ -338,6 +360,7 @@ private static final class UriConverter implements Converter { @SuppressWarnings("unchecked") @Override + @Nullable public Object convert(Class type, Object value) { final String url = value.toString(); URI result = null; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java b/src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java index 87758b356e2..d0d2da45b0e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/AstTreeStringPrinter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.java b/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.java index c138512d5ee..606311a189e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventDefaultFormatter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -55,9 +55,7 @@ public String format(AuditEvent event) { severityLevelName = severityLevel.getName().toUpperCase(Locale.US); } - // Avoid StringBuffer.expandCapacity - final int bufLen = calculateBufferLength(event, severityLevelName.length()); - final StringBuilder sb = new StringBuilder(bufLen); + final StringBuilder sb = initStringBuilderWithOptimalBuffer(event, severityLevelName); sb.append('[').append(severityLevelName).append("] ") .append(fileName).append(':').append(event.getLine()); @@ -78,18 +76,21 @@ public String format(AuditEvent event) { } /** - * Returns the length of the buffer for StringBuilder. + * Returns the StringBuilder that should avoid StringBuffer.expandCapacity. * bufferLength = fileNameLength + messageLength + lengthOfAllSeparators + * + severityNameLength + checkNameLength. + * Method is excluded from pitest validation. * * @param event audit event. - * @param severityLevelNameLength length of severity level name. - * @return the length of the buffer for StringBuilder. + * @param severityLevelName severity level name. + * @return optimal StringBuilder. */ - private static int calculateBufferLength(AuditEvent event, int severityLevelNameLength) { - return LENGTH_OF_ALL_SEPARATORS + event.getFileName().length() - + event.getMessage().length() + severityLevelNameLength + private static StringBuilder initStringBuilderWithOptimalBuffer(AuditEvent event, + String severityLevelName) { + final int bufLen = LENGTH_OF_ALL_SEPARATORS + event.getFileName().length() + + event.getMessage().length() + severityLevelName.length() + getCheckShortName(event).length(); + return new StringBuilder(bufLen); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventFormatter.java b/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventFormatter.java index 7526357536d..1dc2fbabfae 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventFormatter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/AuditEventFormatter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java index 6676f5c0952..6dd3473aee8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -108,7 +108,7 @@ public class Checker extends AbstractAutomaticBean implements MessageDispatcher, private Context childContext; /** The file extensions that are accepted. */ - private String[] fileExtensions = CommonUtil.EMPTY_STRING_ARRAY; + private String[] fileExtensions; /** * The severity level of any violations found by submodules. @@ -222,7 +222,7 @@ public int process(List files) throws CheckstyleException { final List targetFiles = files.stream() .filter(file -> CommonUtil.matchesFileExtension(file, fileExtensions)) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); processFiles(targetFiles); // Finish up @@ -247,9 +247,11 @@ public int process(List files) throws CheckstyleException { private Set getExternalResourceLocations() { return Stream.concat(fileSetChecks.stream(), filters.getFilters().stream()) .filter(ExternalResourceHolder.class::isInstance) - .map(ExternalResourceHolder.class::cast) - .flatMap(resource -> resource.getExternalResourceLocations().stream()) - .collect(Collectors.toSet()); + .flatMap(resource -> { + return ((ExternalResourceHolder) resource) + .getExternalResourceLocations().stream(); + }) + .collect(Collectors.toUnmodifiableSet()); } /** Notify all listeners about the audit start. */ @@ -282,6 +284,7 @@ private void fireAuditFinished() { private void processFiles(List files) throws CheckstyleException { for (final File file : files) { String fileName = null; + final String filePath = file.getPath(); try { fileName = file.getAbsolutePath(); final long timestamp = file.lastModified(); @@ -305,8 +308,8 @@ private void processFiles(List files) throws CheckstyleException { } // We need to catch all exceptions to put a reason failure (file name) in exception - throw new CheckstyleException("Exception was thrown while processing " - + file.getPath(), ex); + throw new CheckstyleException( + getLocalizedMessage("Checker.processFilesException", filePath), ex); } catch (Error error) { if (fileName != null && cacheFile != null) { @@ -314,7 +317,7 @@ private void processFiles(List files) throws CheckstyleException { } // We need to catch all errors to put a reason failure (file name) in error - throw new Error("Error was thrown while processing " + file.getPath(), error); + throw new Error("Error was thrown while processing " + filePath, error); } } } @@ -372,7 +375,7 @@ private SortedSet processFile(File file) throws CheckstyleException { * @return {@code true} if the file is accepted. */ private boolean acceptFileStarted(String fileName) { - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); + final String stripped = CommonUtil.relativizePath(basedir, fileName); return beforeExecutionFileFilters.accept(stripped); } @@ -384,7 +387,7 @@ private boolean acceptFileStarted(String fileName) { */ @Override public void fireFileStarted(String fileName) { - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); + final String stripped = CommonUtil.relativizePath(basedir, fileName); final AuditEvent event = new AuditEvent(this, stripped); for (final AuditListener listener : listeners) { listener.fileStarted(event); @@ -399,7 +402,7 @@ public void fireFileStarted(String fileName) { */ @Override public void fireErrors(String fileName, SortedSet errors) { - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); + final String stripped = CommonUtil.relativizePath(basedir, fileName); boolean hasNonFilteredViolations = false; for (final Violation element : errors) { final AuditEvent event = new AuditEvent(this, stripped, element); @@ -423,7 +426,7 @@ public void fireErrors(String fileName, SortedSet errors) { */ @Override public void fireFileFinished(String fileName) { - final String stripped = CommonUtil.relativizeAndNormalizePath(basedir, fileName); + final String stripped = CommonUtil.relativizePath(basedir, fileName); final AuditEvent event = new AuditEvent(this, stripped); for (final AuditListener listener : listeners) { listener.fileFinished(event); @@ -437,9 +440,7 @@ protected void finishLocalSetup() throws CheckstyleException { if (moduleFactory == null) { if (moduleClassLoader == null) { - throw new CheckstyleException( - "if no custom moduleFactory is set, " - + "moduleClassLoader must be specified"); + throw new CheckstyleException(getLocalizedMessage("Checker.finishLocalSetup")); } final Set packageNames = PackageNamesLoader @@ -479,8 +480,8 @@ protected void setupChild(Configuration childConf) } } catch (final CheckstyleException ex) { - throw new CheckstyleException("cannot initialize module " + name - + " - " + ex.getMessage(), ex); + throw new CheckstyleException( + getLocalizedMessage("Checker.setupChildModule", name, ex.getMessage()), ex); } if (child instanceof FileSetCheck) { final FileSetCheck fsc = (FileSetCheck) child; @@ -500,8 +501,8 @@ else if (child instanceof AuditListener) { addListener(listener); } else { - throw new CheckstyleException(name - + " is not allowed as a child in Checker"); + throw new CheckstyleException( + getLocalizedMessage("Checker.setupChildNotAllowed", name)); } } @@ -547,10 +548,7 @@ public final void addListener(AuditListener listener) { * initial '.' character of an extension is automatically added. */ public final void setFileExtensions(String... extensions) { - if (extensions == null) { - fileExtensions = null; - } - else { + if (extensions != null) { fileExtensions = new String[extensions.length]; for (int i = 0; i < extensions.length; i++) { final String extension = extensions[i]; @@ -616,8 +614,8 @@ public final void setModuleClassLoader(ClassLoader moduleClassLoader) { public void setCharset(String charset) throws UnsupportedEncodingException { if (!Charset.isSupported(charset)) { - final String message = "unsupported charset: '" + charset + "'"; - throw new UnsupportedEncodingException(message); + throw new UnsupportedEncodingException( + getLocalizedMessage("Checker.setCharset", charset)); } this.charset = charset; } @@ -649,4 +647,19 @@ public void clearCache() { } } + /** + * Extracts localized messages from properties files. + * + * @param messageKey the key pointing to localized message in respective properties file. + * @param args the arguments of message in respective properties file. + * @return a string containing extracted localized message + */ + private String getLocalizedMessage(String messageKey, Object... args) { + final LocalizedMessage localizedMessage = new LocalizedMessage( + Definitions.CHECKSTYLE_BUNDLE, getClass(), + messageKey, args); + + return localizedMessage.getMessage(); + } + } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java b/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java index d596b43a77d..075ba386b16 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/CheckstyleParserErrorStrategy.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java b/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java index d2fee5107c7..d274edf5c86 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ConfigurationLoader.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,6 @@ package com.puppycrawl.tools.checkstyle; import java.io.IOException; -import java.net.URI; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; @@ -260,10 +259,7 @@ public static Configuration loadConfiguration(String config, IgnoredModulesOptions ignoredModulesOptions, ThreadModeSettings threadModeSettings) throws CheckstyleException { - // figure out if this is a File or a URL - final URI uri = CommonUtil.getUriByFilename(config); - final InputSource source = new InputSource(uri.toString()); - return loadConfiguration(source, overridePropsResolver, + return loadConfiguration(CommonUtil.sourceFromFilename(config), overridePropsResolver, ignoredModulesOptions, threadModeSettings); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java index 514984b9b19..a68e2f46aa6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultConfiguration.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultContext.java b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultContext.java index c1e9242f36b..e5024929567 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultContext.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultContext.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java index a18ced254a0..041055ae298 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/DefaultLogger.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java b/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java index 28766aa0152..58f3c19dfd6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Definitions.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -32,7 +32,8 @@ public final class Definitions { /** Name of modules which are not checks, but are internal modules. */ public static final Set INTERNAL_MODULES = Set.of( - "com.puppycrawl.tools.checkstyle.meta.JavadocMetadataScraper"); + "com.puppycrawl.tools.checkstyle.meta.JavadocMetadataScraper", + "com.puppycrawl.tools.checkstyle.site.ClassAndPropertiesSettersJavadocScraper"); /** * Do no allow {@code Definitions} instances to be created. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/DetailAstImpl.java b/src/main/java/com/puppycrawl/tools/checkstyle/DetailAstImpl.java index 3064b9cc613..474e7380ce8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/DetailAstImpl.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/DetailAstImpl.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -47,7 +47,7 @@ public final class DetailAstImpl implements DetailAST { private int columnNo = NOT_INITIALIZED; /** Number of children. */ - private int childCount = NOT_INITIALIZED; + private int childCount; /** The parent token. */ private DetailAstImpl parent; /** Previous sibling. */ @@ -144,13 +144,8 @@ public void addNextSibling(DetailAST ast) { // parent is set in setNextSibling final DetailAstImpl sibling = nextSibling; final DetailAstImpl astImpl = (DetailAstImpl) ast; + astImpl.setNextSibling(sibling); - if (sibling != null) { - astImpl.setNextSibling(sibling); - sibling.previousSibling = astImpl; - } - - astImpl.previousSibling = this; setNextSibling(astImpl); } } @@ -166,7 +161,6 @@ public void addChild(DetailAST child) { if (child != null) { final DetailAstImpl astImpl = (DetailAstImpl) child; astImpl.setParent(this); - astImpl.previousSibling = (DetailAstImpl) getLastChild(); } DetailAST temp = firstChild; if (temp == null) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java b/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java index 61c59b61361..ccd5e5428a9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/DetailNodeTreeStringPrinter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/FileStatefulCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/FileStatefulCheck.java index e7fee377422..f64e45dc659 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/FileStatefulCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/FileStatefulCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/GlobalStatefulCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/GlobalStatefulCheck.java index 566cd385ca7..225549c7cc9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/GlobalStatefulCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/GlobalStatefulCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java index 7e39fd4caee..40d398a2c28 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaAstVisitor.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -419,7 +419,7 @@ public DetailAstImpl visitMethodDeclaration(JavaLanguageParser.MethodDeclaration // Process all children except C style array declarators processChildren(methodDef, ctx.children.stream() .filter(child -> !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) - .collect(Collectors.toList())); + .collect(Collectors.toUnmodifiableList())); // We add C style array declarator brackets to TYPE ast final DetailAstImpl typeAst = (DetailAstImpl) methodDef.findFirstToken(TokenTypes.TYPE); @@ -483,7 +483,7 @@ public DetailAstImpl visitInterfaceMethodDeclaration( final List children = ctx.children .stream() .filter(child -> !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); processChildren(methodDef, children); // We add C style array declarator brackets to TYPE ast @@ -834,7 +834,7 @@ public DetailAstImpl visitAnnotationMethodRest( // Process all children except C style array declarators processChildren(annotationFieldDef, ctx.children.stream() .filter(child -> !(child instanceof JavaLanguageParser.ArrayDeclaratorContext)) - .collect(Collectors.toList())); + .collect(Collectors.toUnmodifiableList())); // We add C style array declarator brackets to TYPE ast final DetailAstImpl typeAst = @@ -881,7 +881,7 @@ public DetailAstImpl visitPrimaryCtorCall(JavaLanguageParser.PrimaryCtorCallCont // filter 'LITERAL_SUPER' processChildren(primaryCtorCall, ctx.children.stream() .filter(child -> !child.equals(ctx.LITERAL_SUPER())) - .collect(Collectors.toList())); + .collect(Collectors.toUnmodifiableList())); return primaryCtorCall; } @@ -1119,7 +1119,7 @@ public DetailAstImpl visitCatchParameter(JavaLanguageParser.CatchParameterContex // filter mods processChildren(catchParameterDef, ctx.children.stream() .filter(child -> !(child instanceof JavaLanguageParser.VariableModifierContext)) - .collect(Collectors.toList())); + .collect(Collectors.toUnmodifiableList())); return catchParameterDef; } @@ -1552,7 +1552,7 @@ public DetailAstImpl visitMethodRef(JavaLanguageParser.MethodRefContext ctx) { (Token) ctx.DOUBLE_COLON().getPayload()); final List children = ctx.children.stream() .filter(child -> !child.equals(ctx.DOUBLE_COLON())) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); processChildren(doubleColon, children); return doubleColon; } @@ -1562,7 +1562,7 @@ public DetailAstImpl visitTernaryOp(JavaLanguageParser.TernaryOpContext ctx) { final DetailAstImpl root = create(ctx.QUESTION()); processChildren(root, ctx.children.stream() .filter(child -> !child.equals(ctx.QUESTION())) - .collect(Collectors.toList())); + .collect(Collectors.toUnmodifiableList())); return root; } @@ -1993,7 +1993,7 @@ public DetailAstImpl visitInnerPattern(JavaLanguageParser.InnerPatternContext ct public DetailAstImpl visitGuardedPattern(JavaLanguageParser.GuardedPatternContext ctx) { final DetailAstImpl guardAstNode = flattenedTree(ctx.guard()); guardAstNode.addChild(visit(ctx.primaryPattern())); - guardAstNode.addChild(visit(ctx.expr())); + guardAstNode.addChild(visit(ctx.expression())); return guardAstNode; } @@ -2012,8 +2012,8 @@ public DetailAstImpl visitRecordPatternDef(JavaLanguageParser.RecordPatternDefCo } @Override - public DetailAstImpl visitTypePattern( - JavaLanguageParser.TypePatternContext ctx) { + public DetailAstImpl visitTypePatternDef( + JavaLanguageParser.TypePatternDefContext ctx) { final DetailAstImpl type = visit(ctx.type); final DetailAstImpl patternVariableDef = createImaginary(TokenTypes.PATTERN_VARIABLE_DEF); patternVariableDef.addChild(createModifiers(ctx.mods)); @@ -2022,6 +2022,11 @@ public DetailAstImpl visitTypePattern( return patternVariableDef; } + @Override + public DetailAstImpl visitUnnamedPatternDef(JavaLanguageParser.UnnamedPatternDefContext ctx) { + return create(TokenTypes.UNNAMED_PATTERN_DEF, ctx.start); + } + @Override public DetailAstImpl visitRecordPattern(JavaLanguageParser.RecordPatternContext ctx) { final DetailAstImpl recordPattern = createImaginary(TokenTypes.RECORD_PATTERN_DEF); @@ -2094,7 +2099,7 @@ private void processChildren(DetailAstImpl parent, List chi * should be used for imaginary nodes only, i.e. 'OBJBLOCK -> OBJBLOCK', * where the text on the RHS matches the text on the LHS. * - * @param tokenType the token type of this DetailAstImpl + * @param tokenType the token type of this DetailAstImpl * @return new DetailAstImpl of given type */ private static DetailAstImpl createImaginary(int tokenType) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavaParser.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavaParser.java index adfdc335101..518db6a0c13 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/JavaParser.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavaParser.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -85,7 +85,6 @@ public static DetailAST parse(FileContents contents) final CharStream codePointCharStream = CharStreams.fromString(fullText); final JavaLanguageLexer lexer = new JavaLanguageLexer(codePointCharStream, true); lexer.setCommentListener(contents); - lexer.removeErrorListeners(); final CommonTokenStream tokenStream = new CommonTokenStream(lexer); final JavaLanguageParser parser = @@ -137,7 +136,7 @@ public static DetailAST parseFileText(FileText text, Options options) */ public static DetailAST parseFile(File file, Options options) throws IOException, CheckstyleException { - final FileText text = new FileText(file.getAbsoluteFile(), + final FileText text = new FileText(file, StandardCharsets.UTF_8.name()); return parseFileText(text, options); } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java index 3e42140870f..012cef704cc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocDetailNodeParser.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java index 4600bce9a4a..bda00e6f50d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/JavadocPropertiesGenerator.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -63,9 +63,6 @@ public final class JavadocPropertiesGenerator { private static final Pattern END_OF_SENTENCE_PATTERN = Pattern.compile( "(([^.?!]|[.?!](?!\\s|$))*+[.?!])(\\s|$)"); - /** Max width of the usage help message for this command. */ - private static final int USAGE_HELP_WIDTH = 100; - /** * Don't create instance of this class, use the {@link #main(String[])} method instead. */ @@ -80,7 +77,7 @@ private JavadocPropertiesGenerator() { **/ public static void main(String... args) throws CheckstyleException { final CliOptions cliOptions = new CliOptions(); - final CommandLine cmd = new CommandLine(cliOptions).setUsageHelpWidth(USAGE_HELP_WIDTH); + final CommandLine cmd = new CommandLine(cliOptions); try { final ParseResult parseResult = cmd.parseArgs(args); if (parseResult.isUsageHelpRequested()) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java b/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java index 926b1ffbc70..3a21e14be6f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/LocalizedMessage.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -26,13 +26,14 @@ import java.net.URLConnection; import java.nio.charset.StandardCharsets; import java.text.MessageFormat; -import java.util.Arrays; import java.util.Locale; import java.util.MissingResourceException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; import java.util.ResourceBundle.Control; +import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; + /** * Represents a message that can be localised. The translations come from * message.properties files. The underlying implementation uses @@ -80,7 +81,7 @@ public LocalizedMessage(String bundle, Class sourceClass, String key, this.args = null; } else { - this.args = Arrays.copyOf(args, args.length); + this.args = UnmodifiableCollectionUtil.copyOfArray(args, args.length); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java index ad8df04c69e..a6839e675a1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/Main.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/Main.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -503,7 +503,7 @@ private static AuditListener createListener(OutputFormat format, Path outputLoca } /** - * Create output stream or return System.out + * Create output stream or return System.out. * * @param outputPath output location * @return output stream @@ -680,7 +680,7 @@ private static final class CliOptions { + "Argument is the line and column number (separated by a : ) in the file " + "that the suppression should be generated for. The option cannot be used " + "with other options and requires exactly one file to run on to be " - + "specified. ATTENTION: generated result will have few queries, joined " + + "specified. Note that the generated result will have few queries, joined " + "by pipe(|). Together they will match all AST nodes on " + "specified line and column. You need to choose only one and recheck " + "that it works. Usage of all of them is also ok, but might result in " @@ -723,35 +723,32 @@ private static final class CliOptions { /** Option that controls whether to print the AST of the file. */ @Option(names = {"-t", "--tree"}, - description = "Prints Abstract Syntax Tree(AST) of the checked file. The option " - + "cannot be used other options and requires exactly one file to run on " - + "to be specified.") + description = "This option is used to display the Abstract Syntax Tree (AST) " + + "without any comments of the specified file. It can only be used on " + + "a single file and cannot be combined with other options.") private boolean printAst; /** Option that controls whether to print the AST of the file including comments. */ @Option(names = {"-T", "--treeWithComments"}, - description = "Prints Abstract Syntax Tree(AST) with comment nodes " - + "of the checked file. The option cannot be used with other options " - + "and requires exactly one file to run on to be specified.") + description = "This option is used to display the Abstract Syntax Tree (AST) " + + "with comment nodes excluding Javadoc of the specified file. It can only" + + " be used on a single file and cannot be combined with other options.") private boolean printAstWithComments; /** Option that controls whether to print the parse tree of the javadoc comment. */ @Option(names = {"-j", "--javadocTree"}, - description = "Prints Parse Tree of the Javadoc comment. " - + "The file have to contain only Javadoc comment content without " - + "including '/**' and '*/' at the beginning and at the end respectively. " - + "The option cannot be used other options and requires exactly one file " - + "to run on to be specified.") + description = "This option is used to print the Parse Tree of the Javadoc comment." + + " The file has to contain only Javadoc comment content " + + "excluding '/**' and '*/' at the beginning and at the end respectively. " + + "It can only be used on a single file and cannot be combined " + + "with other options.") private boolean printJavadocTree; /** Option that controls whether to print the full AST of the file. */ @Option(names = {"-J", "--treeWithJavadoc"}, - description = "Prints Abstract Syntax Tree(AST) with Javadoc nodes " - + "and comment nodes of the checked file. Attention that line number and " - + "columns will not be the same as it is a file due to the fact that each " - + "javadoc comment is parsed separately from java file. The option cannot " - + "be used with other options and requires exactly one file to run on to " - + "be specified.") + description = "This option is used to display the Abstract Syntax Tree (AST) " + + "with Javadoc nodes of the specified file. It can only be used on a " + + "single file and cannot be combined with other options.") private boolean printTreeWithJavadoc; /** Option that controls whether to print debug info. */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java b/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java index c5855f7ae70..04b1defd256 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/MetadataGeneratorLogger.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ModuleFactory.java b/src/main/java/com/puppycrawl/tools/checkstyle/ModuleFactory.java index c8aae3e2ab5..4681ee36364 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/ModuleFactory.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ModuleFactory.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java b/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java index 15d8f1ccf61..d0d13d6ad68 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PackageNamesLoader.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java b/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java index c46649e3dcf..4a8c1903c6e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PackageObjectFactory.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -28,6 +28,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -187,11 +188,7 @@ public Object createModule(String name) throws CheckstyleException { instance = createFromStandardCheckSet(name); // find the name in third party map if (instance == null) { - if (thirdPartyNameToFullModuleNames == null) { - thirdPartyNameToFullModuleNames = - generateThirdPartyNameToFullModuleName(moduleClassLoader); - } - instance = createObjectFromMap(name, thirdPartyNameToFullModuleNames); + instance = createObjectFromClassPath(name); } } if (instance == null) { @@ -241,19 +238,23 @@ private Object createFromStandardCheckSet(String name) throws CheckstyleExceptio } /** - * Create object with the help of the supplied map. + * Create object with the help of the classpath. * * @param name name of module. - * @param map the supplied map. * @return instance of module if it is found in modules map and no ambiguous classes exist. * @throws CheckstyleException if the class fails to instantiate or there are ambiguous classes. */ - private Object createObjectFromMap(String name, Map> map) + private Object createObjectFromClassPath(String name) throws CheckstyleException { - final Set fullModuleNames = map.get(name); + thirdPartyNameToFullModuleNames = lazyLoad( + thirdPartyNameToFullModuleNames, + () -> generateThirdPartyNameToFullModuleName(moduleClassLoader) + ); + final Set fullModuleNames = thirdPartyNameToFullModuleNames.get(name); Object instance = null; if (fullModuleNames == null) { - final Set fullCheckModuleNames = map.get(name + CHECK_SUFFIX); + final Set fullCheckModuleNames = + thirdPartyNameToFullModuleNames.get(name + CHECK_SUFFIX); if (fullCheckModuleNames != null) { instance = createObjectFromFullModuleNames(name, fullCheckModuleNames); } @@ -388,7 +389,7 @@ private Object createModuleByTryInEachPackage(String name) throws CheckstyleExce final List possibleNames = packages.stream() .map(packageName -> packageName + PACKAGE_SEPARATOR + name) .flatMap(className -> Stream.of(className, className + CHECK_SUFFIX)) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); Object instance = null; for (String possibleName : possibleNames) { instance = createObject(possibleName); @@ -399,6 +400,25 @@ private Object createModuleByTryInEachPackage(String name) throws CheckstyleExce return instance; } + /** + * Initialize object by supplier if object is null. + * + * @param type of object + * @param object object to initialize + * @param supplier function to initialize if object is null + * @return object as it was provided in method or initialized + */ + private static T lazyLoad(T object, Supplier supplier) { + final T result; + if (object == null) { + result = supplier.get(); + } + else { + result = object; + } + return result; + } + /** * Fill short-to-full module names map. */ @@ -475,6 +495,8 @@ private static void fillChecksFromCodingPackage() { BASE_PACKAGE + ".checks.coding.AvoidInlineConditionalsCheck"); NAME_TO_FULL_MODULE_NAME.put("AvoidNoArgumentSuperConstructorCallCheck", BASE_PACKAGE + ".checks.coding.AvoidNoArgumentSuperConstructorCallCheck"); + NAME_TO_FULL_MODULE_NAME.put("ConstructorsDeclarationGroupingCheck", + BASE_PACKAGE + ".checks.coding.ConstructorsDeclarationGroupingCheck"); NAME_TO_FULL_MODULE_NAME.put("CovariantEqualsCheck", BASE_PACKAGE + ".checks.coding.CovariantEqualsCheck"); NAME_TO_FULL_MODULE_NAME.put("DeclarationOrderCheck", @@ -513,6 +535,8 @@ private static void fillChecksFromCodingPackage() { BASE_PACKAGE + ".checks.coding.MagicNumberCheck"); NAME_TO_FULL_MODULE_NAME.put("MissingCtorCheck", BASE_PACKAGE + ".checks.coding.MissingCtorCheck"); + NAME_TO_FULL_MODULE_NAME.put("MissingNullCaseInSwitchCheck", + BASE_PACKAGE + ".checks.coding.MissingNullCaseInSwitchCheck"); NAME_TO_FULL_MODULE_NAME.put("MissingSwitchDefaultCheck", BASE_PACKAGE + ".checks.coding.MissingSwitchDefaultCheck"); NAME_TO_FULL_MODULE_NAME.put("ModifiedControlVariableCheck", @@ -569,12 +593,18 @@ private static void fillChecksFromCodingPackage() { BASE_PACKAGE + ".checks.coding.UnnecessarySemicolonInTryWithResourcesCheck"); NAME_TO_FULL_MODULE_NAME.put("VariableDeclarationUsageDistanceCheck", BASE_PACKAGE + ".checks.coding.VariableDeclarationUsageDistanceCheck"); + NAME_TO_FULL_MODULE_NAME.put("WhenShouldBeUsed", + BASE_PACKAGE + ".checks.coding.WhenShouldBeUsedCheck"); NAME_TO_FULL_MODULE_NAME.put("NoArrayTrailingCommaCheck", BASE_PACKAGE + ".checks.coding.NoArrayTrailingCommaCheck"); NAME_TO_FULL_MODULE_NAME.put("MatchXpathCheck", BASE_PACKAGE + ".checks.coding.MatchXpathCheck"); NAME_TO_FULL_MODULE_NAME.put("UnusedLocalVariableCheck", BASE_PACKAGE + ".checks.coding.UnusedLocalVariableCheck"); + NAME_TO_FULL_MODULE_NAME.put("UnusedCatchParameterShouldBeUnnamedCheck", + BASE_PACKAGE + ".checks.coding.UnusedCatchParameterShouldBeUnnamedCheck"); + NAME_TO_FULL_MODULE_NAME.put("UnusedLambdaParameterShouldBeUnnamedCheck", + BASE_PACKAGE + ".checks.coding.UnusedLambdaParameterShouldBeUnnamedCheck"); } /** @@ -595,6 +625,8 @@ private static void fillChecksFromDesignPackage() { BASE_PACKAGE + ".checks.design.MutableExceptionCheck"); NAME_TO_FULL_MODULE_NAME.put("OneTopLevelClassCheck", BASE_PACKAGE + ".checks.design.OneTopLevelClassCheck"); + NAME_TO_FULL_MODULE_NAME.put("SealedShouldHavePermitsListCheck", + BASE_PACKAGE + ".checks.design.SealedShouldHavePermitsListCheck"); NAME_TO_FULL_MODULE_NAME.put("ThrowsCountCheck", BASE_PACKAGE + ".checks.design.ThrowsCountCheck"); NAME_TO_FULL_MODULE_NAME.put("VisibilityModifierCheck", @@ -655,6 +687,8 @@ private static void fillChecksFromJavadocPackage() { BASE_PACKAGE + ".checks.javadoc.JavadocBlockTagLocationCheck"); NAME_TO_FULL_MODULE_NAME.put("JavadocContentLocationCheck", BASE_PACKAGE + ".checks.javadoc.JavadocContentLocationCheck"); + NAME_TO_FULL_MODULE_NAME.put("JavadocLeadingAsteriskAlignCheck", + BASE_PACKAGE + ".checks.javadoc.JavadocLeadingAsteriskAlignCheck"); NAME_TO_FULL_MODULE_NAME.put("JavadocMethodCheck", BASE_PACKAGE + ".checks.javadoc.JavadocMethodCheck"); NAME_TO_FULL_MODULE_NAME.put("JavadocMissingLeadingAsteriskCheck", diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java index 68828a538c1..331869e6b45 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertiesExpander.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -48,7 +48,8 @@ public PropertiesExpander(Properties properties) { } values = properties.stringPropertyNames() .stream() - .collect(Collectors.toMap(Function.identity(), properties::getProperty)); + .collect( + Collectors.toUnmodifiableMap(Function.identity(), properties::getProperty)); } @Override diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java index caf685eaaea..a8d8d570ae8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyCacheFile.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,6 +41,7 @@ import com.puppycrawl.tools.checkstyle.api.CheckstyleException; import com.puppycrawl.tools.checkstyle.api.Configuration; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +import com.puppycrawl.tools.checkstyle.utils.OsSpecificUtil; /** * This class maintains a persistent(on file-system) store of the files @@ -144,8 +145,9 @@ public void load() throws IOException { public void persist() throws IOException { final Path path = Paths.get(fileName); final Path directory = path.getParent(); + if (directory != null) { - Files.createDirectories(directory); + OsSpecificUtil.updateDirectory(directory); } try (OutputStream out = Files.newOutputStream(path)) { details.store(out, null); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyResolver.java b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyResolver.java index 0413e1a8175..eccec434e08 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyResolver.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyResolver.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyType.java b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyType.java index 6d54aa86f8f..d8ed6ffa1fa 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/PropertyType.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/PropertyType.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java b/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java index bfa2a879f70..82e848bd21d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/SarifLogger.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/StatelessCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/StatelessCheck.java index 77a9e5a45d7..6eefd501de6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/StatelessCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/StatelessCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java b/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java index 7114eb8aeae..dbec81d96cf 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/SuppressionsStringPrinter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java b/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java index ec63ddb38ca..7d55c091feb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ThreadModeSettings.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java index ae9a0e64648..02b453b59ad 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,6 +42,7 @@ import com.puppycrawl.tools.checkstyle.api.ExternalResourceHolder; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.FileText; +import com.puppycrawl.tools.checkstyle.api.SeverityLevel; import com.puppycrawl.tools.checkstyle.api.Violation; import com.puppycrawl.tools.checkstyle.utils.TokenUtil; @@ -53,6 +54,9 @@ @FileStatefulCheck public final class TreeWalker extends AbstractFileSetCheck implements ExternalResourceHolder { + /** Message to use when an exception occurs and should be printed as a violation. */ + public static final String PARSE_EXCEPTION_MSG = "parse.exception"; + /** Maps from token name to ordinary checks. */ private final Map> tokenToOrdinaryChecks = new HashMap<>(); @@ -79,6 +83,12 @@ public final class TreeWalker extends AbstractFileSetCheck implements ExternalRe /** A factory for creating submodules (i.e. the Checks) */ private ModuleFactory moduleFactory; + /** Control whether to skip files with Java parsing exceptions. */ + private boolean skipFileOnJavaParseException; + + /** Specify severity Level to log Java parsing exceptions when they are skipped. */ + private SeverityLevel javaParseExceptionSeverity = SeverityLevel.ERROR; + /** * Creates a new {@code TreeWalker} instance. */ @@ -95,6 +105,28 @@ public void setModuleFactory(ModuleFactory moduleFactory) { this.moduleFactory = moduleFactory; } + /** + * Setter to control whether to skip files with Java parsing exceptions. + * + * @param skipFileOnJavaParseException whether to skip files with Java parsing errors. + * @since 10.18.0 + */ + public void setSkipFileOnJavaParseException(boolean skipFileOnJavaParseException) { + this.skipFileOnJavaParseException = skipFileOnJavaParseException; + } + + /** + * Setter to specify the severity level + * to log Java parsing exceptions when they are skipped. + * + * @param javaParseExceptionSeverity severity level to log parsing exceptions + * when they are skipped. + * @since 10.18.0 + */ + public void setJavaParseExceptionSeverity(SeverityLevel javaParseExceptionSeverity) { + this.javaParseExceptionSeverity = javaParseExceptionSeverity; + } + @Override public void finishLocalSetup() { final DefaultContext checkContext = new DefaultContext(); @@ -144,26 +176,52 @@ else if (module instanceof TreeWalkerFilter) { } } + /** + * {@inheritDoc} Processes the file. + * + * @noinspection ProhibitedExceptionThrown + * @noinspectionreason ProhibitedExceptionThrown - there is no other way to obey + * skipFileOnJavaParseException field + */ @Override protected void processFiltered(File file, FileText fileText) throws CheckstyleException { // check if already checked and passed the file if (!ordinaryChecks.isEmpty() || !commentChecks.isEmpty()) { final FileContents contents = getFileContents(); - final DetailAST rootAST = JavaParser.parse(contents); - if (!ordinaryChecks.isEmpty()) { - walk(rootAST, contents, AstState.ORDINARY); - } - if (!commentChecks.isEmpty()) { - final DetailAST astWithComments = JavaParser.appendHiddenCommentNodes(rootAST); - walk(astWithComments, contents, AstState.WITH_COMMENTS); + DetailAST rootAST = null; + // whether skip the procedure after parsing Java files. + boolean skip = false; + try { + rootAST = JavaParser.parse(contents); } - if (filters.isEmpty()) { + // -@cs[IllegalCatch] There is no other way to obey skipFileOnJavaParseException field + catch (Exception ex) { + if (!skipFileOnJavaParseException) { + throw ex; + } + skip = true; + violations.add(new Violation(1, Definitions.CHECKSTYLE_BUNDLE, PARSE_EXCEPTION_MSG, + new Object[] {ex.getMessage()}, javaParseExceptionSeverity, null, + getClass(), null)); addViolations(violations); } - else { - final SortedSet filteredViolations = - getFilteredViolations(file.getAbsolutePath(), contents, rootAST); - addViolations(filteredViolations); + + if (!skip) { + if (!ordinaryChecks.isEmpty()) { + walk(rootAST, contents, AstState.ORDINARY); + } + if (!commentChecks.isEmpty()) { + final DetailAST astWithComments = JavaParser.appendHiddenCommentNodes(rootAST); + walk(astWithComments, contents, AstState.WITH_COMMENTS); + } + if (filters.isEmpty()) { + addViolations(violations); + } + else { + final SortedSet filteredViolations = + getFilteredViolations(file.getAbsolutePath(), contents, rootAST); + addViolations(filteredViolations); + } } violations.clear(); } @@ -388,9 +446,11 @@ public Set getExternalResourceLocations() { return Stream.concat(filters.stream(), Stream.concat(ordinaryChecks.stream(), commentChecks.stream())) .filter(ExternalResourceHolder.class::isInstance) - .map(ExternalResourceHolder.class::cast) - .flatMap(resource -> resource.getExternalResourceLocations().stream()) - .collect(Collectors.toSet()); + .flatMap(resource -> { + return ((ExternalResourceHolder) resource) + .getExternalResourceLocations().stream(); + }) + .collect(Collectors.toUnmodifiableSet()); } /** @@ -425,7 +485,7 @@ private static SortedSet createNewCheckSortedSet() { Comparator.comparing(check -> check.getClass().getName()) .thenComparing(AbstractCheck::getId, Comparator.nullsLast(Comparator.naturalOrder())) - .thenComparing(AbstractCheck::hashCode)); + .thenComparingInt(AbstractCheck::hashCode)); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerAuditEvent.java b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerAuditEvent.java index c8e1fd6736f..840a10c96e0 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerAuditEvent.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerAuditEvent.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerFilter.java b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerFilter.java index aa905ed034a..9d408aac788 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerFilter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/TreeWalkerFilter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java b/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java index 926e23e2072..c6b38751195 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/XMLLogger.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/XdocsPropertyType.java b/src/main/java/com/puppycrawl/tools/checkstyle/XdocsPropertyType.java index 73897710cfa..6871826b8e5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/XdocsPropertyType.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/XdocsPropertyType.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java b/src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java index 440bc165f51..e20ded04447 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/XmlLoader.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -32,6 +32,8 @@ import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; +import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; + /** * Contains the common implementation of a loader, for loading a configuration * from an XML file. @@ -65,7 +67,8 @@ public class XmlLoader */ protected XmlLoader(Map publicIdToResourceNameMap) throws SAXException, ParserConfigurationException { - this.publicIdToResourceNameMap = Map.copyOf(publicIdToResourceNameMap); + this.publicIdToResourceNameMap = + UnmodifiableCollectionUtil.copyOfMap(publicIdToResourceNameMap); parser = createXmlReader(this); } @@ -82,26 +85,16 @@ public void parseInputSource(InputSource inputSource) } @Override - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - final String dtdResourceName; - if (publicId == null) { - dtdResourceName = null; - } - else { - dtdResourceName = publicIdToResourceNameMap.get(publicId); - } - final InputSource inputSource; - if (dtdResourceName == null) { - inputSource = super.resolveEntity(publicId, systemId); - } - else { - final ClassLoader loader = - getClass().getClassLoader(); - final InputStream dtdIs = - loader.getResourceAsStream(dtdResourceName); - - inputSource = new InputSource(dtdIs); + public InputSource resolveEntity(String publicId, String systemId) { + InputSource inputSource = null; + if (publicId != null) { + final String dtdResourceName = publicIdToResourceNameMap.get(publicId); + + if (dtdResourceName != null) { + final ClassLoader loader = getClass().getClassLoader(); + final InputStream dtdIs = loader.getResourceAsStream(dtdResourceName); + inputSource = new InputSource(dtdIs); + } } return inputSource; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.java b/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.java index 6a9198d53e3..4b0fbae038a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAstFilter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java b/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java index aa14346dbac..43c11a51448 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/XpathFileGeneratorAuditListener.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java index 33d75e3d368..b7a95d0ea9e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/CheckstyleAntTask.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -445,9 +445,9 @@ private Properties createOverridingProperties() { } /** - * Return the list of listeners set in this task. + * Return the array of listeners set in this task. * - * @return the list of listeners. + * @return the array of listeners. * @throws BuildException if the listeners could not be created. */ private AuditListener[] getListeners() { @@ -587,7 +587,7 @@ private List retrieveAllScannedFiles(DirectoryScanner scanner, int logInde return Arrays.stream(fileNames) .map(name -> scanner.getBasedir() + File.separator + name) .map(File::new) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ant/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/ant/package-info.java index de5e2d6d771..49dc9bfc11a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/ant/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ant/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java index fc988630918..8d8aa657f3a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java index 4a36b036b4d..cd8a44f6014 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractFileSetCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -54,7 +54,7 @@ public abstract class AbstractFileSetCheck private MessageDispatcher messageDispatcher; /** - * Specify the file type extension of files to process. + * Specify the file extensions of the files to process. * Default is uninitialized as the value is inherited from the parent module. */ private String[] fileExtensions; @@ -163,7 +163,7 @@ public String[] getFileExtensions() { } /** - * Setter to specify the file type extension of files to process. + * Setter to specify the file extensions of the files to process. * * @param extensions the set of file extensions. A missing * initial '.' character of an extension is automatically added. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporter.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporter.java index 6d8efe749fb..816bf5b6236 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AbstractViolationReporter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java index ab02ab1ecfb..c5e0f2461b2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditEvent.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditListener.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditListener.java index 1a94c26d6f6..b9207d0aa98 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditListener.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AuditListener.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java index 82a340a84b7..20f34336c31 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AutomaticBean.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilter.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilter.java index 50f43b9241b..bdc08ce4777 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java index cbdb2e8c3b0..eef36ab215e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/BeforeExecutionFileFilterSet.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/CheckstyleException.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/CheckstyleException.java index efc1ee50578..bc878b01cef 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/CheckstyleException.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/CheckstyleException.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Comment.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Comment.java index fd9eae868f1..a4cfe7a9c96 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Comment.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Comment.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Configurable.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Configurable.java index 61f256ca3fd..a1ce8818d3e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Configurable.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Configurable.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Configuration.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Configuration.java index 5cb02308b52..83986662a62 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Configuration.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Configuration.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Context.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Context.java index 411139a00c1..44464210e02 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Context.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Context.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Contextualizable.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Contextualizable.java index ae3b8c586f6..a347889ff35 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Contextualizable.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Contextualizable.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java index f23bc546b35..e803762975f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailAST.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailNode.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailNode.java index f821383b23e..3e143c14c5b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailNode.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/DetailNode.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.java index 0c8281269fb..c742a28af86 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/ExternalResourceHolder.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java index c43277fb827..fdf5a57fa8e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileContents.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java index 4158f5ad58d..86ff8f345bd 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileSetCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java index 259da68789d..d1b76c64a05 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FileText.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Filter.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Filter.java index 749eba59915..3e00cda953a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Filter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Filter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java index 98214784433..947bee0f292 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FilterSet.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java index 0a4a57c0c26..0745f5c21e8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/FullIdent.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -74,6 +74,8 @@ public static FullIdent createFullIdent(DetailAST ast) { * * @param full the FullIdent to add to * @param ast the node to recurse from + * @noinspection TailRecursion + * @noinspectionreason TailRecursion - until issue #14814 */ private static void extractFullIdent(FullIdent full, DetailAST ast) { if (ast != null) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java index 60c992bdbb4..6c94c999558 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTokenTypes.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -43,11 +43,11 @@ public final class JavadocTokenTypes { *
{@code @return true if file exists}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[4x3] : [@return true if file exists]
-     *       |--RETURN_LITERAL[4x3] : [@return]
-     *       |--WS[4x10] : [ ]
-     *       |--DESCRIPTION[4x11] : [true if file exists]
-     *           |--TEXT[4x11] : [true if file exists]
+     * JAVADOC_TAG -> JAVADOC_TAG
+     *  |--RETURN_LITERAL -> @return
+     *  |--WS ->
+     *  `--DESCRIPTION -> DESCRIPTION
+     *      |--TEXT -> true if file exists
      * }
* * @see @@ -63,14 +63,14 @@ public final class JavadocTokenTypes { *

Such Javadoc tag can have one argument - {@link #DESCRIPTION}

* *

Example:

- *
{@code @deprecated it is deprecated method}
+ *
{@code @deprecated It is deprecated method}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@deprecated it is deprecated method]
-     *   |--DEPRECATED_LITERAL[3x0] : [@deprecated]
-     *   |--WS[3x11] : [ ]
-     *   |--DESCRIPTION[3x12] : [it is deprecated method]
-     *       |--TEXT[3x12] : [it is deprecated method]
+     * JAVADOC_TAG -> JAVADOC_TAG
+     *  |--DEPRECATED_LITERAL -> @deprecated
+     *  |--WS ->
+     *  `--DESCRIPTION -> DESCRIPTION
+     *      |--TEXT -> It is deprecated method
      * }
* * @see @@ -89,11 +89,11 @@ public final class JavadocTokenTypes { *
{@code @since 3.4 RELEASE}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@since 3.4 RELEASE]
-     *       |--SINCE_LITERAL[3x0] : [@since]
-     *       |--WS[3x6] : [ ]
-     *       |--DESCRIPTION[3x7] : [3.4 RELEASE]
-     *           |--TEXT[3x7] : [3.4 RELEASE]
+     * JAVADOC_TAG -> JAVADOC_TAG
+     *  |--SINCE_LITERAL -> @since
+     *  |--WS ->
+     *  `--DESCRIPTION -> DESCRIPTION
+     *      |--TEXT -> 3.4 RELEASE
      * }
* * @see @@ -109,14 +109,14 @@ public final class JavadocTokenTypes { *

Such Javadoc tag can have one argument - {@link #DESCRIPTION}

* *

Example:

- *
{@code @serialData two values of Integer type}
+ *
{@code @serialData Two values of Integer type}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@serialData two values of Integer type ]
-     *       |--SERIAL_DATA_LITERAL[3x0] : [@serialData]
-     *       |--WS[3x11] : [ ]
-     *       |--DESCRIPTION[3x12] : [two values of Integer type ]
-     *           |--TEXT[3x12] : [two values of Integer type ]
+     * JAVADOC_TAG -> JAVADOC_TAG
+     *  |--SERIAL_DATA_LITERAL -> @serialData
+     *  |--WS ->
+     *  `--DESCRIPTION -> DESCRIPTION
+     *      |--TEXT -> Two values of Integer type
      * }
      * 
* @@ -141,15 +141,15 @@ public final class JavadocTokenTypes { *
{@code @serialField counter Integer objects counter}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@serialField counter Integer objects counter]
-     *       |--SERIAL_FIELD_LITERAL[3x0] : [@serialField]
-     *       |--WS[3x12] : [ ]
-     *       |--FIELD_NAME[3x13] : [counter]
-     *       |--WS[3x20] : [ ]
-     *       |--FIELD_TYPE[3x21] : [Integer]
-     *       |--WS[3x28] : [ ]
-     *       |--DESCRIPTION[3x29] : [objects counter]
-     *           |--TEXT[3x29] : [objects counter]
+     * JAVADOC_TAG -> JAVADOC_TAG
+     *  |--SERIAL_FIELD_LITERAL -> @serialField
+     *  |--WS ->
+     *  |--FIELD_NAME -> counter
+     *  |--WS ->
+     *  |--FIELD_TYPE -> Integer
+     *  |--WS ->
+     *  `--DESCRIPTION -> DESCRIPTION
+     *      |--TEXT -> objects counter
      * }
* * @see @@ -169,16 +169,16 @@ public final class JavadocTokenTypes { * * *

Example:

- *
{@code @param T The bar.}
+ *
{@code @param value The parameter of method.}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[4x3] : [@param T The bar.]
-     *       |--PARAM_LITERAL[4x3] : [@param]
-     *       |--WS[4x9] : [ ]
-     *       |--PARAMETER_NAME[4x10] : [T]
-     *       |--WS[4x11] : [ ]
-     *       |--DESCRIPTION[4x12] : [The bar.]
-     *           |--TEXT[4x12] : [The bar.]
+     * JAVADOC_TAG -> JAVADOC_TAG
+     *  |--PARAM_LITERAL -> @param
+     *  |--WS ->
+     *  |--PARAMETER_NAME -> value
+     *  |--WS ->
+     *  `--DESCRIPTION -> DESCRIPTION
+     *      |--TEXT -> The parameter of method.
      * }
* * @see @@ -197,21 +197,17 @@ public final class JavadocTokenTypes { *
{@code @see org.apache.utils.Lists.Comparator#compare(Object)}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@see org.apache.utils.Lists.Comparator#compare(Object)]
-     *       |--SEE_LITERAL[3x0] : [@see]
-     *       |--WS[3x4] : [ ]
-     *       |--REFERENCE[3x5] : [org.apache.utils.Lists.Comparator#compare(Object)]
-     *           |--PACKAGE_CLASS[3x5] : [org.apache.utils]
-     *           |--DOT[3x21] : [.]
-     *           |--CLASS[3x22] : [Lists]
-     *           |--DOT[3x27] : [.]
-     *           |--CLASS[3x28] : [Comparator]
-     *           |--HASH[3x38] : [#]
-     *           |--MEMBER[3x39] : [compare]
-     *           |--PARAMETERS[3x46] : [(Object)]
-     *               |--LEFT_BRACE[3x46] : [(]
-     *               |--ARGUMENT[3x47] : [Object]
-     *               |--RIGHT_BRACE[3x53] : [)]
+     *   JAVADOC_TAG -> JAVADOC_TAG
+     *    |--SEE_LITERAL -> @see
+     *    |--WS ->
+     *    |--REFERENCE -> REFERENCE
+     *        |--PACKAGE_CLASS -> org.apache.utils.Lists.Comparator
+     *        |--HASH -> #
+     *        |--MEMBER -> compare
+     *        `--PARAMETERS -> PARAMETERS
+     *            |--LEFT_BRACE -> (
+     *            |--ARGUMENT -> Object
+     *            `--RIGHT_BRACE -> )
      * }
* * @see @@ -264,11 +260,11 @@ public final class JavadocTokenTypes { *
{@code @version 1.3}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@version 1.3]
-     *       |--VERSION_LITERAL[3x0] : [@version]
-     *       |--WS[3x8] : [ ]
-     *       |--DESCRIPTION[3x9] : [1.3]
-     *           |--TEXT[3x9] : [1.3]
+     *   JAVADOC_TAG -> JAVADOC_TAG
+     *    |--VERSION_LITERAL -> @version
+     *    |--WS ->
+     *    `--DESCRIPTION -> DESCRIPTION
+     *        |--TEXT -> 1.3
      * }
* * @see @@ -287,13 +283,13 @@ public final class JavadocTokenTypes { *
{@code @exception SQLException if query is not correct}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@exception SQLException if query is not correct]
-     *       |--EXCEPTION_LITERAL[3x0] : [@exception]
-     *       |--WS[3x10] : [ ]
-     *       |--CLASS_NAME[3x11] : [SQLException]
-     *       |--WS[3x23] : [ ]
-     *       |--DESCRIPTION[3x24] : [if query is not correct]
-     *           |--TEXT[3x24] : [if query is not correct]
+     *   JAVADOC_TAG -> JAVADOC_TAG
+     *    |--EXCEPTION_LITERAL -> @exception
+     *    |--WS ->
+     *    |--CLASS_NAME -> SQLException
+     *    |--WS ->
+     *    `--DESCRIPTION -> DESCRIPTION
+     *        `--TEXT -> if query is not correct
      * }
* * @see @@ -337,11 +333,12 @@ public final class JavadocTokenTypes { *
{@code @author Baratali Izmailov}
* Tree: *
{@code
-     *   |--JAVADOC_TAG[3x0] : [@author Baratali Izmailov]
-     *       |--AUTHOR_LITERAL[3x0] : [@author]
-     *       |--WS[3x7] : [ ]
-     *       |--DESCRIPTION[3x8] : [Baratali Izmailov]
-     *           |--TEXT[3x8] : [Baratali Izmailov]
+     *   --JAVADOC_TAG -> JAVADOC_TAG
+     *      |--AUTHOR_LITERAL -> @author
+     *      |--WS ->
+     *      `--DESCRIPTION -> DESCRIPTION
+     *          |--TEXT -> Baratali Izmailov
+     *          |--NEWLINE -> \r\n
      * }
* * @see @@ -540,13 +537,12 @@ public final class JavadocTokenTypes { *

Example:

*
{@inheritDoc}
* Tree: - *
-     *   |--JAVADOC_INLINE_TAG[1x0] : [{@inheritDoc}]
-     *            |--JAVADOC_INLINE_TAG_START[1x0] : [{]
-     *            |--INHERIT_DOC_LITERAL[1x1] : [@inheritDoc]
-     *            |--JAVADOC_INLINE_TAG_END[1x12] : [}]
-     * 
-     * 
+ *
{@code
+     *   JAVADOC_INLINE_TAG -> JAVADOC_INLINE_TAG
+     *    |--JAVADOC_INLINE_TAG_START -> {
+     *    |--INHERIT_DOC_LITERAL -> @inheritDoc
+     *    |--JAVADOC_INLINE_TAG_END -> }
+     * }
* * @see *
@@ -567,29 +563,27 @@ public final class JavadocTokenTypes { *
{@linkplain org.apache.utils.Lists.Comparator#compare(Object) compare}
      * 
* Tree: - *
-     *  |--JAVADOC_INLINE_TAG[1x0] :
-     *               [{@linkplain org.apache.utils.Lists.Comparator#compare(Object) compare}]
-     *        |--JAVADOC_INLINE_TAG_START[1x0] : [{]
-     *        |--LINKPLAIN_LITERAL[1x1] : [@linkplain]
-     *        |--WS[1x11] : [ ]
-     *        |--REFERENCE[1x12] : [org.apache.utils.Lists.Comparator#compare(Object)]
-     *            |--PACKAGE_CLASS[1x12] : [org.apache.utils]
-     *            |--DOT[1x28] : [.]
-     *            |--CLASS[1x29] : [Lists]
-     *            |--DOT[1x34] : [.]
-     *            |--CLASS[1x35] : [Comparator]
-     *            |--HASH[1x45] : [#]
-     *            |--MEMBER[1x46] : [compare]
-     *            |--PARAMETERS[1x53] : [(Object)]
-     *                |--LEFT_BRACE[1x53] : [(]
-     *                |--ARGUMENT[1x54] : [Object]
-     *                |--RIGHT_BRACE[1x60] : [)]
-     *        |--DESCRIPTION[1x61] : [ compare]
-     *            |--TEXT[1x61] : [ compare]
-     *        |--JAVADOC_INLINE_TAG_END[1x69] : [}]
-     * 
-     * 
+ *
{@code
+     *   JAVADOC_INLINE_TAG -> JAVADOC_INLINE_TAG
+     *    |--JAVADOC_INLINE_TAG_START -> {
+     *    |--LINKPLAIN_LITERAL -> @linkplain
+     *    |--WS ->
+     *    |--REFERENCE -> org.apache.utils.Lists.Comparator#compare(Object)
+     *        |--PACKAGE_CLASS -> org.apache.utils
+     *        |--DOT -> .
+     *        |--CLASS -> Lists
+     *        |--DOT -> .
+     *        |--CLASS -> Comparator
+     *        |--HASH -> #
+     *        |--MEMBER -> compare
+     *        |--PARAMETERS -> (Object)
+     *            |--LEFT_BRACE -> (
+     *            |--ARGUMENT -> Object
+     *            |--RIGHT_BRACE -> )
+     *     |--DESCRIPTION -> compare
+     *         |--TEXT -> compare
+     *     |--JAVADOC_INLINE_TAG_END -> }
+     * }
* * @see *
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/LineColumn.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/LineColumn.java index e46eeca9d47..7ef76b50c80 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/LineColumn.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/LineColumn.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/MessageDispatcher.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/MessageDispatcher.java index f9ae36ef395..07ef0a7c32c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/MessageDispatcher.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/MessageDispatcher.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/RootModule.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/RootModule.java index fa992a4d716..a9453d1b716 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/RootModule.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/RootModule.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Scope.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Scope.java index 9d2125ccdb1..9f6a432f05c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Scope.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Scope.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java index 80e10cd12e6..e91f521e8c5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevel.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java index bc3e9e5c358..790cb013573 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/SeverityLevelCounter.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java index 2a28a409af9..95fbf2c071e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/TextBlock.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java index e91c987eb74..07cfe481350 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/TokenTypes.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -37,7 +37,7 @@ public final class TokenTypes { * This is the root node for the source file. It's children * are an optional package definition, zero or more import statements, * and zero or more type declarations. - *

For example:

+ *

For example:

*
      * import java.util.List;
      *
@@ -681,23 +681,18 @@ public final class TokenTypes {
      * 
*

parses as:

*
-     * +--PARAMETERS
-     *     |
-     *     +--PARAMETER_DEF
-     *         |
-     *         +--MODIFIERS
-     *         +--TYPE
-     *             |
-     *             +--LITERAL_INT (int)
-     *         +--IDENT (start)
-     *     +--COMMA (,)
-     *     +--PARAMETER_DEF
-     *         |
-     *         +--MODIFIERS
-     *         +--TYPE
-     *             |
-     *             +--LITERAL_INT (int)
-     *         +--IDENT (end)
+     * PARAMETERS -> PARAMETERS
+     *  |--PARAMETER_DEF -> PARAMETER_DEF
+     *  |   |--MODIFIERS -> MODIFIERS
+     *  |   |--TYPE -> TYPE
+     *  |   |   `--LITERAL_INT -> int
+     *  |   `--IDENT -> start
+     *  |--COMMA -> ,
+     *  `--PARAMETER_DEF -> PARAMETER_DEF
+     *      |--MODIFIERS -> MODIFIERS
+     *      |--TYPE -> TYPE
+     *      |   `--LITERAL_INT -> int
+     *      `--IDENT -> end
      * 
* * @see #PARAMETER_DEF @@ -4288,119 +4283,115 @@ public final class TokenTypes { *

For example:

* *
-     * new ArrayList(50)
+     * List<String> l = new ArrayList<String>();
      * 
* *

parses as:

*
-     * LITERAL_NEW -> new
-     *  |--IDENT -> ArrayList
-     *  |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
-     *  |   |--GENERIC_START -> <
-     *  |   `--GENERIC_END -> >
-     *  |--LPAREN -> (
-     *  |--ELIST -> ELIST
+     * VARIABLE_DEF -> VARIABLE_DEF
+     *  |--MODIFIERS -> MODIFIERS
+     *  |--TYPE -> TYPE
+     *  |   |--IDENT -> List
+     *  |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
+     *  |       |--GENERIC_START -> <
+     *  |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
+     *  |       |   `--IDENT -> String
+     *  |       `--GENERIC_END -> >
+     *  |--IDENT -> l
+     *  |--ASSIGN -> =
      *  |   `--EXPR -> EXPR
-     *  |       `--NUM_INT -> 50
-     *  `--RPAREN -> )
+     *  |       `--LITERAL_NEW -> new
+     *  |           |--IDENT -> ArrayList
+     *  |           |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
+     *  |           |   |--GENERIC_START -> <
+     *  |           |   |--TYPE_ARGUMENT -> TYPE_ARGUMENT
+     *  |           |   |   `--IDENT -> String
+     *  |           |   `--GENERIC_END -> >
+     *  |           |--LPAREN -> (
+     *  |           |--ELIST -> ELIST
+     *  |           `--RPAREN -> )
+     *  `--SEMI -> ;
      * 
* *

For example:

*
-     * new float[]
-     *   {
-     *     3.0f,
-     *     4.0f
-     *   };
+     * String[] strings = new String[3];
      * 
* *

parses as:

*
-     * +--LITERAL_NEW (new)
-     *     |
-     *     +--LITERAL_FLOAT (float)
-     *     +--ARRAY_DECLARATOR ([)
-     *     +--ARRAY_INIT ({)
-     *         |
-     *         +--EXPR
-     *             |
-     *             +--NUM_FLOAT (3.0f)
-     *         +--COMMA (,)
-     *         +--EXPR
-     *             |
-     *             +--NUM_FLOAT (4.0f)
-     *         +--RCURLY (})
+     * VARIABLE_DEF -> VARIABLE_DEF
+     *  |--MODIFIERS -> MODIFIERS
+     *  |--TYPE -> TYPE
+     *  |   |--IDENT -> String
+     *  |   `--ARRAY_DECLARATOR -> [
+     *  |       `--RBRACK -> ]
+     *  |--IDENT -> strings
+     *  |--ASSIGN -> =
+     *  |   `--EXPR -> EXPR
+     *  |       `--LITERAL_NEW -> new
+     *  |           |--IDENT -> String
+     *  |           `--ARRAY_DECLARATOR -> [
+     *  |               |--EXPR -> EXPR
+     *  |               |   `--NUM_INT -> 3
+     *  |               `--RBRACK -> ]
+     *  `--SEMI -> ;
      * 
* *

For example:

*
-     * new FilenameFilter()
-     * {
-     *   public boolean accept(File dir, String name)
-     *   {
-     *     return name.endsWith(".java");
-     *   }
-     * }
+     * Supplier<Integer> s = new Supplier<>() {
+     *     @Override
+     *     public Integer get() {
+     *         return 42;
+     *     }
+     * };
      * 
* *

parses as:

*
-     * +--LITERAL_NEW (new)
-     *     |
-     *     +--IDENT (FilenameFilter)
-     *     +--LPAREN (()
-     *     +--ELIST
-     *     +--RPAREN ())
-     *     +--OBJBLOCK
-     *         |
-     *         +--LCURLY ({)
-     *         +--METHOD_DEF
-     *             |
-     *             +--MODIFIERS
-     *                 |
-     *                 +--LITERAL_PUBLIC (public)
-     *             +--TYPE
-     *                 |
-     *                 +--LITERAL_BOOLEAN (boolean)
-     *             +--IDENT (accept)
-     *             +--PARAMETERS
-     *                 |
-     *                 +--PARAMETER_DEF
-     *                     |
-     *                     +--MODIFIERS
-     *                     +--TYPE
-     *                         |
-     *                         +--IDENT (File)
-     *                     +--IDENT (dir)
-     *                 +--COMMA (,)
-     *                 +--PARAMETER_DEF
-     *                     |
-     *                     +--MODIFIERS
-     *                     +--TYPE
-     *                         |
-     *                         +--IDENT (String)
-     *                     +--IDENT (name)
-     *             +--SLIST ({)
-     *                 |
-     *                 +--LITERAL_RETURN (return)
-     *                     |
-     *                     +--EXPR
-     *                         |
-     *                         +--METHOD_CALL (()
-     *                             |
-     *                             +--DOT (.)
-     *                                 |
-     *                                 +--IDENT (name)
-     *                                 +--IDENT (endsWith)
-     *                             +--ELIST
-     *                                 |
-     *                                 +--EXPR
-     *                                     |
-     *                                     +--STRING_LITERAL (".java")
-     *                             +--RPAREN ())
-     *                     +--SEMI (;)
-     *                 +--RCURLY (})
-     *         +--RCURLY (})
+     * VARIABLE_DEF -> VARIABLE_DEF
+     *  |--MODIFIERS -> MODIFIERS
+     *  |--TYPE -> TYPE
+     *  |   |--IDENT -> Supplier
+     *  |   `--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
+     *  |       |--GENERIC_START -> <
+     *  |       |--TYPE_ARGUMENT -> TYPE_ARGUMENT
+     *  |       |   `--IDENT -> Integer
+     *  |       `--GENERIC_END -> >
+     *  |--IDENT -> s
+     *  |--ASSIGN -> =
+     *  |   `--EXPR -> EXPR
+     *  |       `--LITERAL_NEW -> new
+     *  |           |--IDENT -> Supplier
+     *  |           |--TYPE_ARGUMENTS -> TYPE_ARGUMENTS
+     *  |           |   |--GENERIC_START -> <
+     *  |           |   `--GENERIC_END -> >
+     *  |           |--LPAREN -> (
+     *  |           |--ELIST -> ELIST
+     *  |           |--RPAREN -> )
+     *  |           `--OBJBLOCK -> OBJBLOCK
+     *  |               |--LCURLY -> {
+     *  |               |--METHOD_DEF -> METHOD_DEF
+     *  |               |   |--MODIFIERS -> MODIFIERS
+     *  |               |   |   |--ANNOTATION -> ANNOTATION
+     *  |               |   |   |   |--AT -> @
+     *  |               |   |   |   `--IDENT -> Override
+     *  |               |   |   `--LITERAL_PUBLIC -> public
+     *  |               |   |--TYPE -> TYPE
+     *  |               |   |   `--IDENT -> Integer
+     *  |               |   |--IDENT -> get
+     *  |               |   |--LPAREN -> (
+     *  |               |   |--PARAMETERS -> PARAMETERS
+     *  |               |   |--RPAREN -> )
+     *  |               |   `--SLIST -> {
+     *  |               |       |--LITERAL_RETURN -> return
+     *  |               |       |   |--EXPR -> EXPR
+     *  |               |       |   |   `--NUM_INT -> 42
+     *  |               |       |   `--SEMI -> ;
+     *  |               |       `--RCURLY -> }
+     *  |               `--RCURLY -> }
+     *  `--SEMI -> ;
      * 
* * @see #IDENT @@ -5508,9 +5499,8 @@ public final class TokenTypes { * Beginning of single-line comment: '//'. * *
-     * +--SINGLE_LINE_COMMENT
-     *         |
-     *         +--COMMENT_CONTENT
+     * SINGLE_LINE_COMMENT -> //
+     *  `--COMMENT_CONTENT -> \r\n
      * 
* *

For example:

@@ -5795,7 +5785,9 @@ public final class TokenTypes { JavaLanguageLexer.COMPACT_CTOR_DEF; /** - * Beginning of a Java 14 Text Block literal, + * Text blocks are a new feature added to to Java SE 15 and later + * that will make writing multi-line strings much easier and cleaner. + * Beginning of a Java 15 Text Block literal, * delimited by three double quotes. * *

For example:

@@ -5814,9 +5806,9 @@ public final class TokenTypes { * | `--ASSIGN -> = * | `--EXPR -> EXPR * | `--TEXT_BLOCK_LITERAL_BEGIN -> """ - * | |--TEXT_BLOCK_CONTENT -> \r\n Hello, world!\r\n + * | |--TEXT_BLOCK_CONTENT -> \n Hello, world!\n * | `--TEXT_BLOCK_LITERAL_END -> """ - * |--SEMI -> ; + * `--SEMI -> ; * * * @since 8.36 @@ -5825,7 +5817,7 @@ public final class TokenTypes { JavaLanguageLexer.TEXT_BLOCK_LITERAL_BEGIN; /** - * Content of a Java 14 text block. This is a + * Content of a Java 15 text block. This is a * sequence of characters, possibly escaped with '\'. Actual line terminators * are represented by '\n'. * @@ -5847,7 +5839,7 @@ public final class TokenTypes { * | `--TEXT_BLOCK_LITERAL_BEGIN -> """ * | |--TEXT_BLOCK_CONTENT -> \n Hello, world!\n * | `--TEXT_BLOCK_LITERAL_END -> """ - * |--SEMI -> ; + * `--SEMI -> ; * * * @since 8.36 @@ -5856,7 +5848,7 @@ public final class TokenTypes { JavaLanguageLexer.TEXT_BLOCK_CONTENT; /** - * End of a Java 14 text block literal, delimited by three + * End of a Java 15 text block literal, delimited by three * double quotes. * *

For example:

@@ -5867,17 +5859,17 @@ public final class TokenTypes { * *

parses as:

*
-     * |--VARIABLE_DEF
-     * |   |--MODIFIERS
-     * |   |--TYPE
-     * |   |   `--IDENT (String)
-     * |   |--IDENT (hello)
-     * |   |--ASSIGN (=)
-     * |   |   `--EXPR
-     * |   |       `--TEXT_BLOCK_LITERAL_BEGIN (""")
-     * |   |           |--TEXT_BLOCK_CONTENT (\n                Hello, world!\n                    )
-     * |   |           `--TEXT_BLOCK_LITERAL_END (""")
-     * |   `--SEMI (;)
+     * |--VARIABLE_DEF -> VARIABLE_DEF
+     * |   |--MODIFIERS -> MODIFIERS
+     * |   |--TYPE -> TYPE
+     * |   |   `--IDENT -> String
+     * |   |--IDENT -> hello
+     * |   `--ASSIGN -> =
+     * |       `--EXPR -> EXPR
+     * |           `--TEXT_BLOCK_LITERAL_BEGIN -> """
+     * |               |--TEXT_BLOCK_CONTENT -> \n                Hello, world!\n
+     * |               `--TEXT_BLOCK_LITERAL_END -> """
+     * `--SEMI -> ;
      * 
* * @since 8.36 @@ -6469,6 +6461,46 @@ public final class TokenTypes { public static final int RECORD_PATTERN_COMPONENTS = JavaLanguageLexer.RECORD_PATTERN_COMPONENTS; + /** + * An unnamed pattern variable definition. Appears as part of a pattern definition. + *

For example:

+ *
+     *    if (r instanceof R(_)) {}
+     * 
+ *

parses as:

+ *
+     * LITERAL_IF -> if
+     *  |--LPAREN -> (
+     *  |--EXPR -> EXPR
+     *  |   `--LITERAL_INSTANCEOF -> instanceof
+     *  |       |--IDENT -> r
+     *  |       `--RECORD_PATTERN_DEF -> RECORD_PATTERN_DEF
+     *  |           |--MODIFIERS -> MODIFIERS
+     *  |           |--TYPE -> TYPE
+     *  |           |   `--IDENT -> R
+     *  |           |--LPAREN -> (
+     *  |           |--RECORD_PATTERN_COMPONENTS -> RECORD_PATTERN_COMPONENTS
+     *  |           |   `--UNNAMED_PATTERN_DEF -> _
+     *  |           `--RPAREN -> )
+     *  |--RPAREN -> )
+     *  `--SLIST -> {
+     *      `--RCURLY -> }
+     * 
+ * + * @see #RECORD_PATTERN_COMPONENTS + * @see #RECORD_PATTERN_DEF + * @see #LITERAL_SWITCH + * @see #LITERAL_INSTANCEOF + * @see #SWITCH_RULE + * @see #LITERAL_WHEN + * @see #PATTERN_VARIABLE_DEF + * @see #PATTERN_DEF + * + * @since 10.14.0 + */ + public static final int UNNAMED_PATTERN_DEF = + JavaLanguageLexer.UNNAMED_PATTERN_DEF; + /** Prevent instantiation. */ private TokenTypes() { } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java index afa7f8e6b91..4c2cef418e4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/Violation.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -25,6 +25,7 @@ import java.util.Objects; import com.puppycrawl.tools.checkstyle.LocalizedMessage; +import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; /** * Represents a violation that can be localised. The translations come from @@ -111,7 +112,7 @@ public Violation(int lineNo, this.args = null; } else { - this.args = Arrays.copyOf(args, args.length); + this.args = UnmodifiableCollectionUtil.copyOfArray(args, args.length); } this.bundle = bundle; this.severityLevel = severityLevel; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/package-info.java index 17c1684107b..5d0135e3269 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java index a92c0bab878..9e0581429f0 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/ArrayTypeStyleCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java index 9cd5aee1bc4..7373c437a7c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/AvoidEscapedUnicodeCharactersCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -47,13 +47,13 @@ *

*
    *
  • - * Property {@code allowEscapesForControlCharacters} - Allow use escapes for - * non-printable, control characters. + * Property {@code allowByTailComment} - Allow use escapes if trail comment is present. * Type is {@code boolean}. * Default value is {@code false}. *
  • *
  • - * Property {@code allowByTailComment} - Allow use escapes if trail comment is present. + * Property {@code allowEscapesForControlCharacters} - Allow use escapes for + * non-printable, control characters. * Type is {@code boolean}. * Default value is {@code false}. *
  • diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java index 686a6f74f7d..7bc74547943 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DescendantTokenCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -49,19 +49,15 @@ * Default value is {@code ""}. * *
  • - * Property {@code minimumDepth} - Specify the minimum depth for descendant counts. - * Type is {@code int}. - * Default value is {@code 0}. - *
  • - *
  • * Property {@code maximumDepth} - Specify the maximum depth for descendant counts. * Type is {@code int}. * Default value is {@code 2147483647}. *
  • *
  • - * Property {@code minimumNumber} - Specify a minimum count for descendants. - * Type is {@code int}. - * Default value is {@code 0}. + * Property {@code maximumMessage} - Define the violation message + * when the maximum count is exceeded. + * Type is {@code java.lang.String}. + * Default value is {@code null}. *
  • *
  • * Property {@code maximumNumber} - Specify a maximum count for descendants. @@ -69,10 +65,9 @@ * Default value is {@code 2147483647}. *
  • *
  • - * Property {@code sumTokenCounts} - Control whether the number of tokens found - * should be calculated from the sum of the individual token counts. - * Type is {@code boolean}. - * Default value is {@code false}. + * Property {@code minimumDepth} - Specify the minimum depth for descendant counts. + * Type is {@code int}. + * Default value is {@code 0}. *
  • *
  • * Property {@code minimumMessage} - Define the violation message @@ -81,10 +76,15 @@ * Default value is {@code null}. *
  • *
  • - * Property {@code maximumMessage} - Define the violation message - * when the maximum count is exceeded. - * Type is {@code java.lang.String}. - * Default value is {@code null}. + * Property {@code minimumNumber} - Specify a minimum count for descendants. + * Type is {@code int}. + * Default value is {@code 0}. + *
  • + *
  • + * Property {@code sumTokenCounts} - Control whether the number of tokens found + * should be calculated from the sum of the individual token counts. + * Type is {@code boolean}. + * Default value is {@code false}. *
  • *
  • * Property {@code tokens} - tokens to check @@ -345,11 +345,11 @@ public void setMinimumNumber(int minimumNumber) { } /** - * Setter to specify a maximum count for descendants. - * - * @param maximumNumber the maximum count for descendants. - * @since 3.2 - */ + * Setter to specify a maximum count for descendants. + * + * @param maximumNumber the maximum count for descendants. + * @since 3.2 + */ public void setMaximumNumber(int maximumNumber) { this.maximumNumber = maximumNumber; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java index 922183d1ecf..cd96a0dd8a7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/FinalParametersCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -48,6 +48,13 @@ * Default value is {@code false}. *
  • *
  • + * Property {@code ignoreUnnamedParameters} - + * Ignore + * unnamed parameters. + * Type is {@code boolean}. + * Default value is {@code true}. + *
  • + *
  • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -102,6 +109,12 @@ public class FinalParametersCheck extends AbstractCheck { */ private boolean ignorePrimitiveTypes; + /** + * Ignore + * unnamed parameters. + */ + private boolean ignoreUnnamedParameters = true; + /** * Setter to ignore primitive types as parameters. * @@ -112,6 +125,18 @@ public void setIgnorePrimitiveTypes(boolean ignorePrimitiveTypes) { this.ignorePrimitiveTypes = ignorePrimitiveTypes; } + /** + * Setter to ignore + * + * unnamed parameters. + * + * @param ignoreUnnamedParameters true or false. + * @since 10.18.0 + */ + public void setIgnoreUnnamedParameters(boolean ignoreUnnamedParameters) { + this.ignoreUnnamedParameters = ignoreUnnamedParameters; + } + @Override public int[] getDefaultTokens() { return new int[] { @@ -195,7 +220,8 @@ private void visitForEachClause(final DetailAST forEachClause) { */ private void checkParam(final DetailAST param) { if (param.findFirstToken(TokenTypes.MODIFIERS).findFirstToken(TokenTypes.FINAL) == null - && !isIgnoredParam(param) + && !isIgnoredPrimitiveParam(param) + && !isIgnoredUnnamedParam(param) && !CheckUtil.isReceiverParameter(param)) { final DetailAST paramName = param.findFirstToken(TokenTypes.IDENT); final DetailAST firstNode = CheckUtil.getFirstNode(param); @@ -210,7 +236,7 @@ private void checkParam(final DetailAST param) { * @param paramDef {@link TokenTypes#PARAMETER_DEF PARAMETER_DEF} * @return true if param has to be skipped. */ - private boolean isIgnoredParam(DetailAST paramDef) { + private boolean isIgnoredPrimitiveParam(DetailAST paramDef) { boolean result = false; if (ignorePrimitiveTypes) { final DetailAST type = paramDef.findFirstToken(TokenTypes.TYPE); @@ -225,4 +251,15 @@ private boolean isIgnoredParam(DetailAST paramDef) { return result; } + /** + * Checks for skip current param due to ignoreUnnamedParameters option. + * + * @param paramDef parameter to check + * @return true if the parameter should be skipped due to the ignoreUnnamedParameters option. + */ + private boolean isIgnoredUnnamedParam(final DetailAST paramDef) { + final DetailAST paramName = paramDef.findFirstToken(TokenTypes.IDENT); + return ignoreUnnamedParameters && paramName != null && "_".equals(paramName.getText()); + } + } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java index 4150481829f..ae5d012475d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/LineSeparatorOption.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java index 9e9a34371c5..effcfa39f76 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/NewlineAtEndOfFileCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -74,15 +74,15 @@ *

    *
      *
    • + * Property {@code fileExtensions} - Specify the file extensions of the files to process. + * Type is {@code java.lang.String[]}. + * Default value is {@code ""}. + *
    • + *
    • * Property {@code lineSeparator} - Specify the type of line separator. * Type is {@code com.puppycrawl.tools.checkstyle.checks.LineSeparatorOption}. * Default value is {@code lf_cr_crlf}. *
    • - *
    • - * Property {@code fileExtensions} - Specify the file type extension of the files to check. - * Type is {@code java.lang.String[]}. - * Default value is {@code ""}. - *
    • *
    *

    * Parent is {@code com.puppycrawl.tools.checkstyle.Checker} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheck.java index 89ce91304e6..6c53948a134 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/NoCodeInFileCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -26,7 +26,9 @@ /** *

    - * Checks whether file contains code. Files which are considered to have no code: + * Checks whether file contains code. + * Java compiler is not raising errors on files with no code or all commented out. + * Files which are considered to have no code: *

    *
      *
    • diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java index 6d89071e5d8..642216ceca5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/OrderedPropertiesCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -54,7 +54,7 @@ *

      Known limitation: The key should not contain a newline. * The string compare will work, but not the line number reporting.

      *
      • - * Property {@code fileExtensions} - Specify file type extension of the files to check. + * Property {@code fileExtensions} - Specify the file extensions of the files to process. * Type is {@code java.lang.String[]}. * Default value is {@code .properties}. *
      diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheck.java index e88ecd3b51f..ba2f942f9a5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/OuterTypeFilenameCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java index 451e87f3fea..3cf258ce9fe 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/SuppressWarningsHolder.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -47,9 +47,10 @@ *
        *
      • * Property {@code aliasList} - Specify aliases for check names that can be used in code - * within {@code SuppressWarnings}. + * within {@code SuppressWarnings} in a format of comma separated attribute=value entries. + * The attribute is the fully qualified name of the Check and value is its alias. * Type is {@code java.lang.String[]}. - * Default value is {@code null}. + * Default value is {@code ""}. *
      • *
      *

      @@ -71,7 +72,7 @@ public class SuppressWarningsHolder */ private static final String CHECKSTYLE_PREFIX = "checkstyle:"; - /** Java.lang namespace prefix, which is stripped from SuppressWarnings */ + /** Java.lang namespace prefix, which is stripped from SuppressWarnings. */ private static final String JAVA_LANG_PREFIX = "java.lang."; /** Suffix to be removed from subclasses of Check. */ @@ -149,10 +150,12 @@ private static void registerAlias(String sourceName, String checkAlias) { /** * Setter to specify aliases for check names that can be used in code - * within {@code SuppressWarnings}. + * within {@code SuppressWarnings} in a format of comma separated attribute=value entries. + * The attribute is the fully qualified name of the Check and value is its alias. * * @param aliasList comma-separated alias assignments * @throws IllegalArgumentException when alias item does not have '=' + * @since 5.7 */ public void setAliasList(String... aliasList) { for (String sourceAlias : aliasList) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.java index 0a7fd519c10..dc5f9ad5545 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TodoCommentCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java index 490eacdba9d..d007b873e4d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TrailingCommentCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java index 27f62cb102e..b933c3bb2f5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,7 @@ import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.util.Arrays; +import java.util.Collections; import java.util.HashSet; import java.util.Locale; import java.util.Map; @@ -50,7 +51,6 @@ import com.puppycrawl.tools.checkstyle.api.MessageDispatcher; import com.puppycrawl.tools.checkstyle.api.Violation; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; -import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; /** *

      @@ -93,6 +93,11 @@ * of default translation files in project. *

      *

      + * Note: If your project uses preprocessed translation files and the original files do not have the + * {@code properties} extension, you can specify additional file extensions + * via the {@code fileExtensions} property. + *

      + *

      * Attention: the check will perform the validation of ISO codes if the option * is used. So, if you specify, for example, "mm" for language code, * TranslationCheck will rise violation that the language code is incorrect. @@ -105,14 +110,6 @@ *

      *
        *
      • - * Property {@code fileExtensions} - Specify file type extension to identify - * translation files. Setting this property is typically only required if your - * translation files are preprocessed and the original files do not have - * the extension {@code .properties} - * Type is {@code java.lang.String[]}. - * Default value is {@code .properties}. - *
      • - *
      • * Property {@code baseName} - Specify * * Base name of resource bundles which contain message resources. @@ -121,6 +118,11 @@ * Default value is {@code "^messages.*$"}. *
      • *
      • + * Property {@code fileExtensions} - Specify the file extensions of the files to process. + * Type is {@code java.lang.String[]}. + * Default value is {@code .properties}. + *
      • + *
      • * Property {@code requiredTranslations} - Specify language codes of required * translations which must exist in project. * Type is {@code java.lang.String[]}. @@ -254,7 +256,8 @@ public void setBaseName(Pattern baseName) { * @since 6.11 */ public void setRequiredTranslations(String... translationCodes) { - requiredTranslations = Arrays.stream(translationCodes).collect(Collectors.toSet()); + requiredTranslations = Arrays.stream(translationCodes) + .collect(Collectors.toUnmodifiableSet()); validateUserSpecifiedLanguageCodes(requiredTranslations); } @@ -411,7 +414,7 @@ private static Set groupFilesIntoBundles(Set files, final ResourceBundle newBundle = new ResourceBundle(baseName, path, extension); final Optional bundle = findBundle(resourceBundles, newBundle); if (bundle.isPresent()) { - bundle.get().addFile(currentFile); + bundle.orElseThrow().addFile(currentFile); } else { newBundle.addFile(currentFile); @@ -520,7 +523,8 @@ private void checkFilesForConsistencyRegardingTheirKeys(Map> f for (Entry> fileKey : fileKeys.entrySet()) { final Set currentFileKeys = fileKey.getValue(); final Set missingKeys = keysThatMustExist.stream() - .filter(key -> !currentFileKeys.contains(key)).collect(Collectors.toSet()); + .filter(key -> !currentFileKeys.contains(key)) + .collect(Collectors.toUnmodifiableSet()); if (!missingKeys.isEmpty()) { final MessageDispatcher dispatcher = getMessageDispatcher(); final String path = fileKey.getKey().getAbsolutePath(); @@ -645,7 +649,7 @@ public String getExtension() { * @return the set of files */ public Set getFiles() { - return UnmodifiableCollectionUtil.unmodifiableSet(files); + return Collections.unmodifiableSet(files); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java index dc475bead25..c3629186803 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UncommentedMainCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java index c84c51a52d0..ef4e792c308 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UniquePropertiesCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -46,7 +46,7 @@ *

        *
          *
        • - * Property {@code fileExtensions} - Specify file type extension of the files to check. + * Property {@code fileExtensions} - Specify the file extensions of the files to process. * Type is {@code java.lang.String[]}. * Default value is {@code .properties}. *
        • diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java index c0909064b6c..cb5a95fac1b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/UpperEllCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java index 2af106f5acf..a5337598ef8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationLocationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -65,16 +65,16 @@ * Default value is {@code false}. * *
        • - * Property {@code allowSamelineSingleParameterlessAnnotation} - Allow single parameterless + * Property {@code allowSamelineParameterizedAnnotation} - Allow one and only parameterized * annotation to be located on the same line as target element. * Type is {@code boolean}. - * Default value is {@code true}. + * Default value is {@code false}. *
        • *
        • - * Property {@code allowSamelineParameterizedAnnotation} - Allow one and only parameterized + * Property {@code allowSamelineSingleParameterlessAnnotation} - Allow single parameterless * annotation to be located on the same line as target element. * Type is {@code boolean}. - * Default value is {@code false}. + * Default value is {@code true}. *
        • *
        • * Property {@code tokens} - tokens to check diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheck.java index 77b424ffc16..8a9e3e458d1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationOnSameLineCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java index 6271032ecfe..b3816b11c1e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/AnnotationUseStyleCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -98,18 +98,18 @@ *

          *
            *
          • - * Property {@code elementStyle} - Define the annotation element styles. - * Type is {@code - * com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck$ElementStyleOption}. - * Default value is {@code compact_no_array}. - *
          • - *
          • * Property {@code closingParens} - Define the policy for ending parenthesis. * Type is {@code * com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck$ClosingParensOption}. * Default value is {@code never}. *
          • *
          • + * Property {@code elementStyle} - Define the annotation element styles. + * Type is {@code + * com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck$ElementStyleOption}. + * Default value is {@code compact_no_array}. + *
          • + *
          • * Property {@code trailingArrayComma} - Define the policy for trailing comma in arrays. * Type is {@code * com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck$TrailingArrayCommaOption}. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java index de54f398154..2ff7244187f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -97,6 +97,9 @@ * {@code javadoc.parse.rule.error} *
          • *
          • + * {@code javadoc.unclosedHtml} + *
          • + *
          • * {@code javadoc.wrong.singleton.html.tag} *
          • *
          diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java index 1d33543a837..05d11ed5c3d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -196,7 +196,7 @@ private static boolean containsInheritDocTag(DetailAST ast) { .filter(JavadocUtil::isJavadocComment) .findFirst(); return javadoc.isPresent() - && MATCH_INHERIT_DOC.matcher(javadoc.get()).find(); + && MATCH_INHERIT_DOC.matcher(javadoc.orElseThrow()).find(); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java index 17bf1cf209f..2df34bb34f8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java index f3d43eb8f95..1beb8ddd53f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -102,7 +102,9 @@ * * COMPACT_CTOR_DEF, * - * RECORD_DEF. + * RECORD_DEF, + * + * PATTERN_VARIABLE_DEF. *
        • *
        *

        @@ -176,6 +178,7 @@ public final int[] getAcceptableTokens() { TokenTypes.CTOR_DEF, TokenTypes.COMPACT_CTOR_DEF, TokenTypes.RECORD_DEF, + TokenTypes.PATTERN_VARIABLE_DEF, }; } @@ -309,6 +312,8 @@ private static String removeQuotes(final String warning) { * * @param cond a Conditional type * {@link TokenTypes#QUESTION QUESTION} + * @noinspection TailRecursion + * @noinspectionreason TailRecursion - until issue #14814 */ private void walkConditional(final DetailAST cond) { if (cond.getType() == TokenTypes.QUESTION) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/package-info.java index e7a79a95711..bee3311dd56 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheck.java index c0553458cf5..2179168f62e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/AvoidNestedBlocksCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -70,67 +70,6 @@ *

      • *
      *

      - * To configure the check: - *

      - *
      - * <module name="AvoidNestedBlocks"/>
      - * 
      - *

      - * Example: - *

      - *
      - * public void foo() {
      - *   int myInteger = 0;
      - *   {                      // violation
      - *     myInteger = 2;
      - *   }
      - *   System.out.println("myInteger = " + myInteger);
      - *
      - *   switch (a) {
      - *     case 1:
      - *       {                    // violation
      - *         System.out.println("Case 1");
      - *         break;
      - *       }
      - *     case 2:
      - *       System.out.println("Case 2");     // OK
      - *       break;
      - *   }
      - * }
      - * 
      - *

      - * To configure the check to allow nested blocks in switch case: - *

      - *
      - * <module name="AvoidNestedBlocks">
      - *   <property name="allowInSwitchCase" value="true"/>
      - * </module>
      - * 
      - *

      - * Example: - *

      - *
      - * public void foo() {
      - *   int myInteger = 0;
      - *   {                      // violation
      - *     myInteger = 2;
      - *   }
      - *   System.out.println("myInteger = " + myInteger);
      - *
      - *   switch (a)
      - *   {
      - *     case 1:
      - *       {                    // OK
      - *         System.out.println("Case 1");
      - *         break;
      - *       }
      - *     case 2:
      - *       System.out.println("Case 2");     // OK
      - *       break;
      - *   }
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/BlockOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/BlockOption.java index 4e44907b2be..288dd677b5c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/BlockOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/BlockOption.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java index 86783615b65..ef2c3c1b46a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyBlockCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Locale; +import java.util.Optional; import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; @@ -50,7 +51,7 @@ *

      *
        *
      • - * Property {@code option} - specify the policy on block contents. + * Property {@code option} - Specify the policy on block contents. * Type is {@code com.puppycrawl.tools.checkstyle.checks.blocks.BlockOption}. * Default value is {@code statement}. *
      • @@ -84,78 +85,6 @@ * *
      *

      - * To configure the check: - *

      - *
      - * <module name="EmptyBlock"/>
      - * 
      - *

      - * Example: - *

      - *
      - * public class Test {
      - *   private void emptyLoop() {
      - *     for (int i = 0; i < 10; i++) { // violation
      - *     }
      - *
      - *     try { // violation
      - *
      - *     } catch (Exception e) {
      - *       // ignored
      - *     }
      - *   }
      - * }
      - * 
      - *

      - * To configure the check for the {@code text} policy and only {@code try} blocks: - *

      - *
      - * <module name="EmptyBlock">
      - *   <property name="option" value="text"/>
      - *   <property name="tokens" value="LITERAL_TRY"/>
      - * </module>
      - * 
      - *

      Example:

      - *
      - * public class Test {
      - *   private void emptyLoop() {
      - *     for (int i = 0; i < 10; i++) {
      - *       // ignored
      - *     }
      - *
      - *     // violation on next line
      - *     try {
      - *
      - *     } catch (Exception e) {
      - *       // ignored
      - *     }
      - *   }
      - * }
      - * 
      - *

      - * To configure the check for default in switch block: - *

      - *
      - * <module name="EmptyBlock">
      - *   <property name="tokens" value="LITERAL_DEFAULT"/>
      - * </module>
      - * 
      - *

      Example:

      - *
      - * public class Test {
      - *   private void test(int a) {
      - *     switch (a) {
      - *       case 1: someMethod();
      - *       default: // OK, as there is no block
      - *     }
      - *     switch (a) {
      - *       case 1: someMethod();
      - *       default: {} // violation
      - *     }
      - *   }
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      @@ -247,25 +176,26 @@ public int[] getRequiredTokens() { @Override public void visitToken(DetailAST ast) { - final DetailAST leftCurly = findLeftCurly(ast); - if (leftCurly != null) { + final Optional leftCurly = getLeftCurly(ast); + if (leftCurly.isPresent()) { + final DetailAST leftCurlyAST = leftCurly.orElseThrow(); if (option == BlockOption.STATEMENT) { final boolean emptyBlock; - if (leftCurly.getType() == TokenTypes.LCURLY) { - final DetailAST nextSibling = leftCurly.getNextSibling(); + if (leftCurlyAST.getType() == TokenTypes.LCURLY) { + final DetailAST nextSibling = leftCurlyAST.getNextSibling(); emptyBlock = nextSibling.getType() != TokenTypes.CASE_GROUP && nextSibling.getType() != TokenTypes.SWITCH_RULE; } else { - emptyBlock = leftCurly.getChildCount() <= 1; + emptyBlock = leftCurlyAST.getChildCount() <= 1; } if (emptyBlock) { - log(leftCurly, + log(leftCurlyAST, MSG_KEY_BLOCK_NO_STATEMENT); } } - else if (!hasText(leftCurly)) { - log(leftCurly, + else if (!hasText(leftCurlyAST)) { + log(leftCurlyAST, MSG_KEY_BLOCK_EMPTY, ast.getText()); } @@ -342,21 +272,28 @@ private boolean checkIsAllLinesAreWhitespace(int lineFrom, int lineTo) { * @param ast a {@code DetailAST} value * @return the left curly corresponding to the block to be checked */ - private static DetailAST findLeftCurly(DetailAST ast) { - final DetailAST leftCurly; - final DetailAST slistAST = ast.findFirstToken(TokenTypes.SLIST); - if ((ast.getType() == TokenTypes.LITERAL_CASE - || ast.getType() == TokenTypes.LITERAL_DEFAULT) - && ast.getNextSibling() != null - && ast.getNextSibling().getFirstChild() != null - && ast.getNextSibling().getFirstChild().getType() == TokenTypes.SLIST) { - leftCurly = ast.getNextSibling().getFirstChild(); + private static Optional getLeftCurly(DetailAST ast) { + final DetailAST parent = ast.getParent(); + final int parentType = parent.getType(); + final Optional leftCurly; + + if (parentType == TokenTypes.SWITCH_RULE) { + // get left curly of a case or default that is in switch rule + leftCurly = Optional.ofNullable(parent.findFirstToken(TokenTypes.SLIST)); + } + else if (parentType == TokenTypes.CASE_GROUP) { + // get left curly of a case or default that is in switch statement + leftCurly = Optional.ofNullable(ast.getNextSibling()) + .map(DetailAST::getFirstChild) + .filter(node -> node.getType() == TokenTypes.SLIST); } - else if (slistAST == null) { - leftCurly = ast.findFirstToken(TokenTypes.LCURLY); + else if (ast.findFirstToken(TokenTypes.SLIST) != null) { + // we have a left curly that is part of a statement list, but not in a case or default + leftCurly = Optional.of(ast.findFirstToken(TokenTypes.SLIST)); } else { - leftCurly = slistAST; + // get the first left curly that we can find, if it is present + leftCurly = Optional.ofNullable(ast.findFirstToken(TokenTypes.LCURLY)); } return leftCurly; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java index 55c08d4db0e..54e29b6c50b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/EmptyCatchBlockCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,179 +38,21 @@ *

      *
        *
      • - * Property {@code exceptionVariableName} - Specify the RegExp for the name of the variable - * associated with exception. If check meets variable name matching specified value - empty - * block is suppressed. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code "^$"}. - *
      • - *
      • * Property {@code commentFormat} - Specify the RegExp for the first comment inside empty * catch block. If check meets comment inside empty catch block matching specified format * - empty block is suppressed. If it is multi-line comment - only its first line is analyzed. * Type is {@code java.util.regex.Pattern}. * Default value is {@code ".*"}. *
      • + *
      • + * Property {@code exceptionVariableName} - Specify the RegExp for the name of the variable + * associated with exception. If check meets variable name matching specified value - empty + * block is suppressed. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code "^$"}. + *
      • *
      *

      - * To configure the check: - *

      - *
      - * <module name="EmptyCatchBlock"/>
      - * 
      - *

      - * Example: - *

      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException expected) {
      - * } // violation
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException ignore) {
      - *   // no handling
      - * } // ok, catch block has comment
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException o) {
      - * } // violation
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException ex) {
      - *   // This is expected
      - * } // ok
      - * 
      - *

      - * To configure the check to suppress empty catch block if exception's variable name is - * {@code expected} or {@code ignore} or there's any comment inside: - *

      - *
      - * <module name="EmptyCatchBlock">
      - *   <property name="exceptionVariableName" value="expected|ignore"/>
      - * </module>
      - * 
      - *

      - * Such empty blocks would be both suppressed: - *

      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException expected) {
      - * } // ok
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException ignore) {
      - *   // no handling
      - * } // ok
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException o) {
      - * } // violation
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException ex) {
      - *   // This is expected
      - * } // ok
      - * 
      - *

      - * To configure the check to suppress empty catch block if single-line comment inside - * is "//This is expected": - *

      - *
      - * <module name="EmptyCatchBlock">
      - *   <property name="commentFormat" value="This is expected"/>
      - * </module>
      - * 
      - *

      - * Such empty block would be suppressed: - *

      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException expected) {
      - * } // violation
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException ignore) {
      - *   // no handling
      - * } // violation
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException o) {
      - * } // violation
      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException ex) {
      - *   // This is expected
      - * } // ok
      - * 
      - *

      - * To configure the check to suppress empty catch block if single-line comment inside - * is "//This is expected" or exception's - * variable name is "myException" (any option is matching): - *

      - *
      - * <module name="EmptyCatchBlock">
      - *   <property name="commentFormat" value="This is expected"/>
      - *   <property name="exceptionVariableName" value="myException"/>
      - * </module>
      - * 
      - *

      - * Such empty blocks would be suppressed: - *

      - *
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException e) {
      - *   //This is expected
      - * }
      - * ...
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException e) {
      - *   //   This is expected
      - * }
      - * ...
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException e) {
      - *   // This is expected
      - *   // some another comment
      - * }
      - * ...
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException e) {
      - *   /* This is expected */
      - * }
      - * ...
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException e) {
      - *   /*
      - *   *
      - *   * This is expected
      - *   * some another comment
      - *   */
      - * }
      - * ...
      - * try {
      - *   throw new RuntimeException();
      - * } catch (RuntimeException myException) {
      - *
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java index b8b3baa231c..f9a0c04f291 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,8 @@ import java.util.Locale; +import javax.annotation.Nullable; + import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; import com.puppycrawl.tools.checkstyle.api.DetailAST; @@ -34,17 +36,17 @@ *

      *
        *
      • + * Property {@code ignoreEnums} - Allow to ignore enums when left curly brace policy is EOL. + * Type is {@code boolean}. + * Default value is {@code true}. + *
      • + *
      • * Property {@code option} - Specify the policy on placement of a left curly brace * ('{'). * Type is {@code com.puppycrawl.tools.checkstyle.checks.blocks.LeftCurlyOption}. * Default value is {@code eol}. *
      • *
      • - * Property {@code ignoreEnums} - Allow to ignore enums when left curly brace policy is EOL. - * Type is {@code boolean}. - * Default value is {@code true}. - *
      • - *
      • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -100,109 +102,6 @@ *
      • *
      *

      - * To configure the check: - *

      - *
      - * <module name="LeftCurly"/>
      - * 
      - *
      - * class Test
      - * { // Violation - '{' should be on the previous line
      - *   private interface TestInterface
      - *   { // Violation - '{' should be on the previous line
      - *   }
      - *
      - *   private
      - *   class
      - *   MyClass { // OK
      - *   }
      - *
      - *   enum Colors {RED, // OK
      - *     BLUE,
      - *     GREEN;
      - *   }
      - * }
      - * 
      - *

      - * To configure the check to apply the {@code nl} policy to type blocks: - *

      - *
      - * <module name="LeftCurly">
      - *   <property name="option" value="nl"/>
      - *   <property name="tokens" value="CLASS_DEF,INTERFACE_DEF"/>
      - * </module>
      - * 
      - *
      - * class Test
      - * { // OK
      - *   private interface TestInterface
      - *   { // OK
      - *   }
      - *
      - *   private
      - *   class
      - *   MyClass { // Violation - '{' should be on a new line
      - *   }
      - *
      - *   enum Colors {RED, // OK
      - *     BLUE,
      - *     GREEN;
      - *   }
      - * }
      - * 
      - *

      - * To configure the check to apply the {@code nlow} policy to type blocks: - *

      - *
      - * <module name="LeftCurly">
      - *   <property name="option" value="nlow"/>
      - *   <property name="tokens" value="CLASS_DEF,INTERFACE_DEF"/>
      - * </module>
      - * 
      - *
      - * class Test
      - * { // Violation - '{' should be on the previous line
      - *   private interface TestInterface { // OK
      - *   }
      - *
      - *   private
      - *   class
      - *   MyClass { // Violation - '{' should be on a new line
      - *   }
      - *
      - *   enum Colors {RED, // OK
      - *     BLUE,
      - *     GREEN;
      - *   }
      - * }
      - * 
      - *

      - * An example of how to configure the check to validate enum definitions: - *

      - *
      - * <module name="LeftCurly">
      - *   <property name="ignoreEnums" value="false"/>
      - * </module>
      - * 
      - *
      - * class Test
      - * { // Violation - '{' should be on the previous line
      - *   private interface TestInterface
      - *   { // Violation - '{' should be on the previous line
      - *   }
      - *
      - *   private
      - *   class
      - *   MyClass { // OK
      - *   }
      - *
      - *   enum Colors {RED, // Violation - '{' should have line break after
      - *   BLUE,
      - *   GREEN;
      - *   }
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      @@ -252,7 +151,7 @@ public class LeftCurlyCheck /** * Specify the policy on placement of a left curly brace ('{'). - * */ + */ private LeftCurlyOption option = LeftCurlyOption.EOL; /** @@ -391,6 +290,7 @@ public void visitToken(DetailAST ast) { * @return {@code DetailAST} if the first child is {@code TokenTypes.SLIST}, * {@code null} otherwise. */ + @Nullable private static DetailAST getBraceFromSwitchMember(DetailAST ast) { final DetailAST brace; final DetailAST parent = ast.getParent(); @@ -410,6 +310,7 @@ private static DetailAST getBraceFromSwitchMember(DetailAST ast) { * @return {@code DetailAST} if the first child is {@code TokenTypes.SLIST}, * {@code null} otherwise. */ + @Nullable private static DetailAST getBraceAsFirstChild(DetailAST ast) { DetailAST brace = null; if (ast != null) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyOption.java index cd362519fa7..01eccfbe6b5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/LeftCurlyOption.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java index 42a6d2c507d..c14115e4cfc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/NeedBracesCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -34,12 +34,12 @@ *

      *
        *
      • - * Property {@code allowSingleLineStatement} - allow single-line statements without braces. + * Property {@code allowEmptyLoopBody} - Allow loops with empty bodies. * Type is {@code boolean}. * Default value is {@code false}. *
      • *
      • - * Property {@code allowEmptyLoopBody} - allow loops with empty bodies. + * Property {@code allowSingleLineStatement} - Allow single-line statements without braces. * Type is {@code boolean}. * Default value is {@code false}. *
      • @@ -61,193 +61,6 @@ * *
      *

      - * To configure the check: - *

      - *
      - * <module name="NeedBraces"/>
      - * 
      - *

      Example:

      - *
      - * if (obj.isValid()) return true; // violation, single-line statements not allowed without braces
      - * if (true) {                     // OK
      - *     return true;
      - * } else                          // violation, single-line statements not allowed without braces
      - *     return false;
      - * for (int i = 0; i < 5; i++) {   // OK
      - *      ++count;
      - * }
      - * do                              // violation, single-line statements not allowed without braces
      - *     ++count;
      - * while (false);
      - * for (int j = 0; j < 10; j++); // violation, empty loop body not allowed
      - * for(int i = 0; i < 10; value.incrementValue()); // violation, empty loop body not allowed
      - * while (counter < 10)          // violation, single-line statements not allowed without braces
      - *     ++count;
      - * while (value.incrementValue() < 5); // violation, empty loop body not allowed
      - * switch (num) {
      - *   case 1: counter++; break;         // OK
      - * }
      - * 
      - *

      - * To configure the check for {@code if} and {@code else} blocks: - *

      - *
      - * <module name="NeedBraces">
      - *   <property name="tokens" value="LITERAL_IF, LITERAL_ELSE"/>
      - * </module>
      - * 
      - *

      Example:

      - *
      - * if (obj.isValid()) return true; // violation, single-line statements not allowed without braces
      - * if (true) {                     // OK
      - *     return true;
      - * } else                          // violation, single-line statements not allowed without braces
      - *     return false;
      - * for (int i = 0; i < 5; i++) {   // OK
      - *      ++count;
      - * }
      - * do                              // OK
      - *     ++count;
      - * while (false);
      - * for (int j = 0; j < 10; j++);   // OK
      - * for(int i = 0; i < 10; value.incrementValue()); // OK
      - * while (counter < 10)                            // OK
      - *     ++count;
      - * while (value.incrementValue() < 5); // OK
      - * switch (num) {
      - *   case 1: counter++; break;         // OK
      - * }
      - * 
      - *

      - * To configure the check to allow single-line statements - * ({@code if, while, do-while, for}) without braces: - *

      - *
      - * <module name="NeedBraces">
      - *   <property name="allowSingleLineStatement" value="true"/>
      - *   <property name="tokens"
      - *          value="LITERAL_IF, LITERAL_WHILE, LITERAL_DO, LITERAL_FOR"/>
      - * </module>
      - * 
      - *

      - * Example: - *

      - *
      - * if (obj.isValid()) return true;  // OK
      - * if (true) {                      // OK
      - *     return true;
      - * } else                           // OK
      - *     return false;
      - * for (int i = 0; i < 5; i++) {    // OK
      - *     ++count;
      - * }
      - * do                               // OK
      - *    ++count;
      - * while (false);
      - * for (int j = 0; j < 10; j++);                   // violation, empty loop body not allowed
      - * for(int i = 0; i < 10; value.incrementValue()); // violation, empty loop body not allowed
      - * while (counter < 10)                 // OK
      - *    ++count;
      - * while (value.incrementValue() < 5);  // violation, empty loop body not allowed
      - * switch (num) {
      - *   case 1: counter++; break;          // OK
      - * }
      - * while (obj.isValid()) return true;   // OK
      - * do this.notify(); while (o != null); // OK
      - * for (int i = 0; ; ) this.notify();   // OK
      - * 
      - *

      - * To configure the check to allow {@code case, default} single-line statements without braces: - *

      - *
      - * <module name="NeedBraces">
      - *   <property name="tokens" value="LITERAL_CASE, LITERAL_DEFAULT"/>
      - *   <property name="allowSingleLineStatement" value="true"/>
      - * </module>
      - * 
      - *

      - * Next statements won't be violated by check: - *

      - *
      - * if (obj.isValid()) return true; // OK
      - * if (true) {                     // OK
      - *     return true;
      - * } else                          // OK
      - *     return false;
      - * for (int i = 0; i < 5; i++) {   // OK
      - *      ++count;
      - * }
      - * do                              // OK
      - *     ++count;
      - * while (false);
      - * for (int j = 0; j < 10; j++);   // OK
      - * for(int i = 0; i < 10; value.incrementValue()); // OK
      - * while (counter < 10)                            // OK
      - *    ++count;
      - * while (value.incrementValue() < 5); // OK
      - * switch (num) {
      - *   case 1: counter++; break;         // OK
      - *   case 6: counter += 10; break;     // OK
      - *   default: counter = 100; break;    // OK
      - * }
      - * 
      - *

      - * To configure the check to allow loops ({@code while, for}) with empty bodies: - *

      - *
      - * <module name="NeedBraces">
      - *   <property name="allowEmptyLoopBody" value="true"/>
      - *   <property name="tokens" value="LITERAL_WHILE, LITERAL_FOR"/>
      - * </module>
      - * 
      - *

      - * Example: - *

      - *
      - * if (obj.isValid()) return true; // OK
      - * if (true) {                     // OK
      - *     return true;
      - * } else                          // OK
      - *     return false;
      - * for (int i = 0; i < 5; i++) {   // OK
      - *      ++count;
      - * }
      - * do                              // OK
      - *     ++count;
      - * while (false);
      - * for (int j = 0; j < 10; j++);   // OK
      - * for(int i = 0; i < 10; value.incrementValue()); // OK
      - * while (counter < 10)           // violation, single-line statements not allowed without braces
      - *    ++count;
      - * while (value.incrementValue() < 5); // OK
      - * switch (num) {
      - * case 1: counter++; break;           // OK
      - * }
      - * 
      - *

      - * To configure the check to lambdas: - *

      - *
      - * <module name="NeedBraces">
      - *   <property name="tokens" value="LAMBDA"/>
      - *   <property name="allowSingleLineStatement" value="true"/>
      - * </module>
      - * 
      - *

      - * Results in following: - *

      - *
      - * allowedFuture.addCallback(result -> assertEquals("Invalid response",
      - *   EnumSet.of(HttpMethod.GET, HttpMethod.OPTIONS), result), // violation, lambda spans 2 lines
      - *   ex -> fail(ex.getMessage())); // OK
      - *
      - * allowedFuture.addCallback(result -> {
      - *   return assertEquals("Invalid response",
      - *     EnumSet.of(HttpMethod.GET, HttpMethod.OPTIONS), result);
      - *   }, // OK
      - *   ex -> fail(ex.getMessage()));
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      @@ -364,8 +177,7 @@ private boolean isBracesNeeded(DetailAST ast) { break; case TokenTypes.LITERAL_CASE: case TokenTypes.LITERAL_DEFAULT: - result = hasUnbracedStatements(ast) - && !isSwitchLabeledExpression(ast); + result = hasUnbracedStatements(ast); break; case TokenTypes.LITERAL_ELSE: result = ast.findFirstToken(TokenTypes.LITERAL_IF) == null; @@ -605,35 +417,6 @@ private static boolean isInSwitchRule(DetailAST ast) { return ast.getParent().getType() == TokenTypes.SWITCH_RULE; } - /** - * Checks if current expression is a switch labeled expression. If so, - * braces are not allowed e.g.: - *

      - * {@code - * case 1 -> 4; - * } - *

      - * - * @param ast the ast to check - * @return true if current expression is a switch labeled expression. - */ - private static boolean isSwitchLabeledExpression(DetailAST ast) { - final DetailAST parent = ast.getParent(); - return switchRuleHasSingleExpression(parent); - } - - /** - * Checks if current switch labeled expression contains only a single expression. - * - * @param switchRule {@link TokenTypes#SWITCH_RULE}. - * @return true if current switch rule has a single expression. - */ - private static boolean switchRuleHasSingleExpression(DetailAST switchRule) { - final DetailAST possibleExpression = switchRule.findFirstToken(TokenTypes.EXPR); - return possibleExpression != null - && possibleExpression.getFirstChild().getFirstChild() == null; - } - /** * Checks if switch member (case or default statement) in a switch rule or * case group is on a single-line. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java index 6d1eab620d7..b26f545014c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.Locale; +import java.util.Optional; import com.puppycrawl.tools.checkstyle.StatelessCheck; import com.puppycrawl.tools.checkstyle.api.AbstractCheck; @@ -32,8 +33,8 @@ /** *

      * Checks the placement of right curly braces ('}') for code blocks. This check - * supports if-else, try-catch-finally blocks, switch statements, while-loops, for-loops, - * method definitions, class definitions, constructor definitions, + * supports if-else, try-catch-finally blocks, switch statements, switch cases, while-loops, + * for-loops, method definitions, class definitions, constructor definitions, * instance, static initialization blocks, annotation definitions and enum definitions. * For right curly brace of expression blocks of arrays, lambdas and class instances * please follow issue @@ -66,223 +67,6 @@ *

    • *
    *

    - * To configure the check: - *

    - *
    - * <module name="RightCurly"/>
    - * 
    - *

    - * Example: - *

    - *
    - * public class Test {
    - *
    - *   public void test() {
    - *
    - *     if (foo) {
    - *       bar();
    - *     }           // violation, right curly must be in the same line as the 'else' keyword
    - *     else {
    - *       bar();
    - *     }
    - *
    - *     if (foo) {
    - *       bar();
    - *     } else {     // OK
    - *       bar();
    - *     }
    - *
    - *     if (foo) { bar(); } int i = 0; // violation
    - *                   // ^^^ statement is not allowed on same line after curly right brace
    - *
    - *     if (foo) { bar(); }            // OK
    - *     int i = 0;
    - *
    - *     try {
    - *       bar();
    - *     }           // violation, rightCurly must be in the same line as 'catch' keyword
    - *     catch (Exception e) {
    - *       bar();
    - *     }
    - *
    - *     try {
    - *       bar();
    - *     } catch (Exception e) { // OK
    - *       bar();
    - *     }
    - *
    - *   }                         // OK
    - *
    - *   public void testSingleLine() { bar(); } // OK, because singleline is allowed
    - * }
    - * 
    - *

    - * To configure the check with policy {@code alone} for {@code else} and - * - * METHOD_DEF tokens: - *

    - *
    - * <module name="RightCurly">
    - *   <property name="option" value="alone"/>
    - *   <property name="tokens" value="LITERAL_ELSE, METHOD_DEF"/>
    - * </module>
    - * 
    - *

    - * Example: - *

    - *
    - * public class Test {
    - *
    - *   public void test() {
    - *
    - *     if (foo) {
    - *       bar();
    - *     } else { bar(); }   // violation, right curly must be alone on line
    - *
    - *     if (foo) {
    - *       bar();
    - *     } else {
    - *       bar();
    - *     }                   // OK
    - *
    - *     try {
    - *       bar();
    - *     } catch (Exception e) { // OK because config is set to token METHOD_DEF and LITERAL_ELSE
    - *       bar();
    - *     }
    - *
    - *   }                         // OK
    - *
    - *   public void violate() { bar; } // violation, singleline is not allowed here
    - *
    - *   public void ok() {
    - *     bar();
    - *   }                              // OK
    - * }
    - * 
    - *

    - * To configure the check with policy {@code alone} for - * - * Switch Statements: - *

    - *
    - * <module name="RightCurly">
    - *  <property name="option" value="alone"/>
    - *  <property name="tokens" value="LITERAL_SWITCH"/>
    - * </module>
    - * 
    - *
    - * class Test {
    - *
    - *     public void method0() {
    - *         int mode = 0;
    - *         switch (mode) {
    - *             case 1:
    - *                 int x = 1;
    - *                 break;
    - *             default:
    - *                 x = 0;
    - *         } // ok, RightCurly is alone
    - *     }
    - *
    - *     public void method0() {
    - *         int mode = 0;
    - *         switch (mode) {
    - *             case 1:
    - *                 int x = 1;
    - *                 break;
    - *             default:
    - *                 x = 0; } // violation, RightCurly should be alone on a line
    - *     }
    - *
    - * }
    - * 
    - *

    - * To configure the check with policy {@code alone_or_singleline} for {@code if} and - * - * METHOD_DEF - * tokens: - *

    - *
    - * <module name="RightCurly">
    - *  <property name="option" value="alone_or_singleline"/>
    - *  <property name="tokens" value="LITERAL_IF, METHOD_DEF"/>
    - * </module>
    - * 
    - *

    - * Example: - *

    - *
    - * public class Test {
    - *
    - *   public void test() {
    - *
    - *     if (foo) {
    - *       bar();
    - *     } else {        // violation, right curly must be alone on line
    - *       bar();
    - *     }
    - *
    - *     if (foo) {
    - *       bar();
    - *     }               // OK
    - *     else {
    - *       bar();
    - *     }
    - *
    - *     try {
    - *       bar();
    - *     } catch (Exception e) {        // OK because config did not set token LITERAL_TRY
    - *       bar();
    - *     }
    - *
    - *   }                                // OK
    - *
    - *   public void violate() { bar(); } // OK , because singleline
    - * }
    - * 
    - *

    - * To configure the check with policy {@code alone_or_singleline} for - * - * Switch - * Statements: - *

    - *
    - * <module name="RightCurly">
    - *  <property name="option" value="alone_or_singleline"/>
    - *  <property name="tokens" value="LITERAL_SWITCH"/>
    - * </module>
    - * 
    - *
    - * class Test {
    - *
    - *     public void method0() {
    - *         int mode = 0;
    - *         switch (mode) {
    - *             case 1:
    - *                 int x = 1;
    - *                 break;
    - *             default:
    - *                 x = 0;
    - *         } // ok
    - *     }
    - *
    - *     public static void method7() {
    - *         int mode = 0;
    - *         int x;
    - *         switch (mode) { case 1: x = 5; } // ok, RightCurly is on the same line as LeftCurly
    - *     }
    - *
    - *     public void method() {
    - *         int mode = 0;
    - *         int x;
    - *         switch (mode) {
    - *             case 1:
    - *                 x = 1; } // violation, right curly should be alone on line
    - *         }
    - * }
    - * 
    - *

    * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

    *

    @@ -372,6 +156,7 @@ public int[] getAcceptableTokens() { TokenTypes.RECORD_DEF, TokenTypes.COMPACT_CTOR_DEF, TokenTypes.LITERAL_SWITCH, + TokenTypes.LITERAL_CASE, }; } @@ -545,9 +330,16 @@ private static boolean isBlockAloneOnSingleLine(Details details) { nextToken = Details.getNextToken(nextToken); } - if (nextToken != null && nextToken.getType() == TokenTypes.DO_WHILE) { - final DetailAST doWhileSemi = nextToken.getParent(); - nextToken = Details.getNextToken(doWhileSemi); + // sibling tokens should be allowed on a single line + final int[] tokensWithBlockSibling = { + TokenTypes.DO_WHILE, + TokenTypes.LITERAL_FINALLY, + TokenTypes.LITERAL_CATCH, + }; + + if (TokenUtil.isOfType(nextToken, tokensWithBlockSibling)) { + final DetailAST parent = nextToken.getParent(); + nextToken = Details.getNextToken(parent); } return TokenUtil.areOnSameLine(details.lcurly, details.rcurly) @@ -642,6 +434,9 @@ private static Details getDetails(DetailAST ast) { case TokenTypes.LITERAL_SWITCH: details = getDetailsForSwitch(ast); break; + case TokenTypes.LITERAL_CASE: + details = getDetailsForCase(ast); + break; default: details = getDetailsForOthers(ast); break; @@ -670,6 +465,38 @@ private static Details getDetailsForSwitch(DetailAST switchNode) { return new Details(lcurly, rcurly, nextToken, true); } + /** + * Collects details about case statements. + * + * @param caseNode case statement to gather details about + * @return new Details about given case statement + */ + private static Details getDetailsForCase(DetailAST caseNode) { + final DetailAST caseParent = caseNode.getParent(); + final int parentType = caseParent.getType(); + final Optional lcurly; + final DetailAST statementList; + + if (parentType == TokenTypes.SWITCH_RULE) { + statementList = caseParent.findFirstToken(TokenTypes.SLIST); + lcurly = Optional.ofNullable(statementList); + } + else { + statementList = caseNode.getNextSibling(); + lcurly = Optional.ofNullable(statementList) + .map(DetailAST::getFirstChild) + .filter(node -> node.getType() == TokenTypes.SLIST); + } + final DetailAST rcurly = lcurly.map(DetailAST::getLastChild) + .filter(child -> !isSwitchExpression(caseParent)) + .orElse(null); + final Optional nextToken = + Optional.ofNullable(lcurly.map(DetailAST::getNextSibling) + .orElseGet(() -> getNextToken(caseParent))); + + return new Details(lcurly.orElse(null), rcurly, nextToken.orElse(null), true); + } + /** * Check whether switch is expression or not. * diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java index b2261c6fadb..6f85680831d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/RightCurlyOption.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/package-info.java index 662bed9ccc1..cd91d42b442 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/blocks/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java index 3534b375de5..4300176245a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java index 3a312991841..227daacdf07 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ArrayTrailingCommaCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.java index 87c8baede27..a3cb0164480 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidDoubleBraceInitializationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java index 2f7eff5b50b..6ff9660bea9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidInlineConditionalsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheck.java index 10088b6b796..1bb9db39faa 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AvoidNoArgumentSuperConstructorCallCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ConstructorsDeclarationGroupingCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ConstructorsDeclarationGroupingCheck.java new file mode 100644 index 00000000000..f226d2de4f8 --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ConstructorsDeclarationGroupingCheck.java @@ -0,0 +1,161 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.coding; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +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; + +/** + *

    + * Checks that all constructors are grouped together. + * If there is any non-constructor code separating constructors, + * this check identifies and logs a violation for those ungrouped constructors. + * The violation message will specify the line number of the last grouped constructor. + * Comments between constructors are allowed. + *

    + *

    + * Rationale: Grouping constructors together in a class improves code readability + * and maintainability. It allows developers to easily understand + * the different ways an object can be instantiated + * and the tasks performed by each constructor. + *

    + *

    + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

    + *

    + * Violation Message Keys: + *

    + *
      + *
    • + * {@code constructors.declaration.grouping} + *
    • + *
    + * + * @since 10.17.0 + */ + +@StatelessCheck +public class ConstructorsDeclarationGroupingCheck extends AbstractCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_KEY = "constructors.declaration.grouping"; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.ENUM_DEF, + TokenTypes.RECORD_DEF, + }; + } + + @Override + public void visitToken(DetailAST ast) { + // list of all child ASTs + final List children = getChildList(ast); + + // find first constructor + final DetailAST firstConstructor = children.stream() + .filter(ConstructorsDeclarationGroupingCheck::isConstructor) + .findFirst() + .orElse(null); + + if (firstConstructor != null) { + + // get all children AST after the first constructor + final List childrenAfterFirstConstructor = + children.subList(children.indexOf(firstConstructor), children.size()); + + // find the first index of non-constructor AST after the first constructor, if present + final Optional indexOfFirstNonConstructor = childrenAfterFirstConstructor + .stream() + .filter(currAst -> !isConstructor(currAst)) + .findFirst() + .map(children::indexOf); + + // list of all children after first non-constructor AST + final List childrenAfterFirstNonConstructor = indexOfFirstNonConstructor + .map(index -> children.subList(index, children.size())) + .orElseGet(ArrayList::new); + + // create a list of all constructors that are not grouped to log + final List constructorsToLog = childrenAfterFirstNonConstructor.stream() + .filter(ConstructorsDeclarationGroupingCheck::isConstructor) + .collect(Collectors.toUnmodifiableList()); + + // find the last grouped constructor + final DetailAST lastGroupedConstructor = childrenAfterFirstConstructor.stream() + .takeWhile(ConstructorsDeclarationGroupingCheck::isConstructor) + .reduce((first, second) -> second) + .orElse(firstConstructor); + + // log all constructors that are not grouped + constructorsToLog + .forEach(ctor -> log(ctor, MSG_KEY, lastGroupedConstructor.getLineNo())); + } + } + + /** + * Get a list of all children of the given AST. + * + * @param ast the AST to get children of + * @return a list of all children of the given AST + */ + private static List getChildList(DetailAST ast) { + final List children = new ArrayList<>(); + DetailAST child = ast.findFirstToken(TokenTypes.OBJBLOCK).getFirstChild(); + while (child != null) { + children.add(child); + child = child.getNextSibling(); + } + return children; + } + + /** + * Check if the given AST is a constructor. + * + * @param ast the AST to check + * @return true if the given AST is a constructor, false otherwise + */ + private static boolean isConstructor(DetailAST ast) { + return ast.getType() == TokenTypes.CTOR_DEF + || ast.getType() == TokenTypes.COMPACT_CTOR_DEF; + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheck.java index 622a255e145..a953f4fa907 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/CovariantEqualsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java index 872f988eecb..a2bbca1fe2d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -73,12 +73,12 @@ * *
      *
    • - * Property {@code ignoreConstructors} - control whether to ignore constructors. + * Property {@code ignoreConstructors} - Control whether to ignore constructors. * Type is {@code boolean}. * Default value is {@code false}. *
    • *
    • - * Property {@code ignoreModifiers} - control whether to ignore modifiers (fields, ...). + * Property {@code ignoreModifiers} - Control whether to ignore modifiers (fields, ...). * Type is {@code boolean}. * Default value is {@code false}. *
    • diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java index 4d8f1724048..55fce6f6153 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DefaultComesLastCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java index 9ce05c09516..98c75a9861b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EmptyStatementCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.java index 9527358800f..2c49c401278 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsAvoidNullCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -29,7 +30,6 @@ 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.UnmodifiableCollectionUtil; /** *

      @@ -580,7 +580,7 @@ public FieldFrame getParent() { * @return children of this frame. */ public Set getChildren() { - return UnmodifiableCollectionUtil.unmodifiableSet(children); + return Collections.unmodifiableSet(children); } /** @@ -634,7 +634,7 @@ public void addMethodCall(DetailAST methodCall) { * Determines whether this FieldFrame contains the field. * * @param name name of the field to check. - * @return true if this FieldFrame contains instance field. + * @return DetailAST if this FieldFrame contains instance field. */ public DetailAST findField(String name) { return fieldNameToAst.get(name); @@ -646,7 +646,7 @@ public DetailAST findField(String name) { * @return method calls of this frame. */ public Set getMethodCalls() { - return UnmodifiableCollectionUtil.unmodifiableSet(methodCalls); + return Collections.unmodifiableSet(methodCalls); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheck.java index 03795f2a506..3447f01a2d7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/EqualsHashCodeCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java index aa98ceb7595..3cfb827ce97 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -43,7 +43,7 @@ *

      *
        *
      • - * Property {@code onlyObjectReferences} - control whether only explicit + * Property {@code onlyObjectReferences} - Control whether only explicit * initializations made to null for objects should be checked. * Type is {@code boolean}. * Default value is {@code false}. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java index 33d8567594e..5570a996c7a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FallThroughCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,14 +19,16 @@ package com.puppycrawl.tools.checkstyle.checks.coding; -import java.util.regex.Matcher; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; import java.util.regex.Pattern; 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.CodePointUtil; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; /** *

        @@ -116,6 +118,11 @@ public int[] getAcceptableTokens() { return getRequiredTokens(); } + @Override + public boolean isCommentNodesRequired() { + return true; + } + /** * Setter to define the RegExp to match the relief comment that suppresses * the warning about a fall through. @@ -145,8 +152,8 @@ public void visitToken(DetailAST ast) { if (!isLastGroup || checkLastCaseGroup) { final DetailAST slist = ast.findFirstToken(TokenTypes.SLIST); - if (slist != null && !isTerminated(slist, true, true) - && !hasFallThroughComment(ast, nextGroup)) { + if (slist != null && !isTerminated(slist, true, true, new HashSet<>()) + && !hasFallThroughComment(ast)) { if (isLastGroup) { log(ast, MSG_FALL_THROUGH_LAST); } @@ -160,14 +167,17 @@ public void visitToken(DetailAST ast) { /** * Checks if a given subtree terminated by return, throw or, * if allowed break, continue. + * When analyzing fall-through cases in switch statements, a Set of String labels + * is used to keep track of the labels encountered in the enclosing switch statements. * * @param ast root of given subtree * @param useBreak should we consider break as terminator * @param useContinue should we consider continue as terminator + * @param labelsForCurrentSwitchScope the Set labels for the current scope of the switch * @return true if the subtree is terminated. */ private boolean isTerminated(final DetailAST ast, boolean useBreak, - boolean useContinue) { + boolean useContinue, Set labelsForCurrentSwitchScope) { final boolean terminated; switch (ast.getType()) { @@ -177,30 +187,43 @@ private boolean isTerminated(final DetailAST ast, boolean useBreak, terminated = true; break; case TokenTypes.LITERAL_BREAK: - terminated = useBreak; + terminated = + useBreak || hasLabel(ast, labelsForCurrentSwitchScope); break; case TokenTypes.LITERAL_CONTINUE: - terminated = useContinue; + terminated = + useContinue || hasLabel(ast, labelsForCurrentSwitchScope); break; case TokenTypes.SLIST: - terminated = checkSlist(ast, useBreak, useContinue); + terminated = + checkSlist(ast, useBreak, useContinue, labelsForCurrentSwitchScope); break; case TokenTypes.LITERAL_IF: - terminated = checkIf(ast, useBreak, useContinue); + terminated = + checkIf(ast, useBreak, useContinue, labelsForCurrentSwitchScope); break; case TokenTypes.LITERAL_FOR: case TokenTypes.LITERAL_WHILE: case TokenTypes.LITERAL_DO: - terminated = checkLoop(ast); + terminated = checkLoop(ast, labelsForCurrentSwitchScope); break; case TokenTypes.LITERAL_TRY: - terminated = checkTry(ast, useBreak, useContinue); + terminated = + checkTry(ast, useBreak, useContinue, labelsForCurrentSwitchScope); break; case TokenTypes.LITERAL_SWITCH: - terminated = checkSwitch(ast, useContinue); + terminated = + checkSwitch(ast, useContinue, labelsForCurrentSwitchScope); break; case TokenTypes.LITERAL_SYNCHRONIZED: - terminated = checkSynchronized(ast, useBreak, useContinue); + terminated = + checkSynchronized(ast, useBreak, useContinue, labelsForCurrentSwitchScope); + break; + case TokenTypes.LABELED_STAT: + labelsForCurrentSwitchScope.add(ast.getFirstChild().getText()); + terminated = + isTerminated(ast.getLastChild(), useBreak, useContinue, + labelsForCurrentSwitchScope); break; default: terminated = false; @@ -208,6 +231,22 @@ private boolean isTerminated(final DetailAST ast, boolean useBreak, return terminated; } + /** + * Checks if given break or continue ast has outer label. + * + * @param statement break or continue node + * @param labelsForCurrentSwitchScope the Set labels for the current scope of the switch + * @return true if local label used + */ + private static boolean hasLabel(DetailAST statement, Set labelsForCurrentSwitchScope) { + return Optional.ofNullable(statement) + .map(DetailAST::getFirstChild) + .filter(child -> child.getType() == TokenTypes.IDENT) + .map(DetailAST::getText) + .filter(label -> !labelsForCurrentSwitchScope.contains(label)) + .isPresent(); + } + /** * Checks if a given SLIST terminated by return, throw or, * if allowed break, continue. @@ -215,18 +254,24 @@ private boolean isTerminated(final DetailAST ast, boolean useBreak, * @param slistAst SLIST to check * @param useBreak should we consider break as terminator * @param useContinue should we consider continue as terminator + * @param labels label names * @return true if SLIST is terminated. */ private boolean checkSlist(final DetailAST slistAst, boolean useBreak, - boolean useContinue) { + boolean useContinue, Set labels) { DetailAST lastStmt = slistAst.getLastChild(); if (lastStmt.getType() == TokenTypes.RCURLY) { lastStmt = lastStmt.getPreviousSibling(); } + while (TokenUtil.isOfType(lastStmt, TokenTypes.SINGLE_LINE_COMMENT, + TokenTypes.BLOCK_COMMENT_BEGIN)) { + lastStmt = lastStmt.getPreviousSibling(); + } + return lastStmt != null - && isTerminated(lastStmt, useBreak, useContinue); + && isTerminated(lastStmt, useBreak, useContinue, labels); } /** @@ -236,17 +281,33 @@ private boolean checkSlist(final DetailAST slistAst, boolean useBreak, * @param ast IF to check * @param useBreak should we consider break as terminator * @param useContinue should we consider continue as terminator + * @param labels label names * @return true if IF is terminated. */ private boolean checkIf(final DetailAST ast, boolean useBreak, - boolean useContinue) { - final DetailAST thenStmt = ast.findFirstToken(TokenTypes.RPAREN) - .getNextSibling(); - final DetailAST elseStmt = thenStmt.getNextSibling(); + boolean useContinue, Set labels) { + final DetailAST thenStmt = getNextNonCommentAst(ast.findFirstToken(TokenTypes.RPAREN)); + + final DetailAST elseStmt = getNextNonCommentAst(thenStmt); return elseStmt != null - && isTerminated(thenStmt, useBreak, useContinue) - && isTerminated(elseStmt.getFirstChild(), useBreak, useContinue); + && isTerminated(thenStmt, useBreak, useContinue, labels) + && isTerminated(elseStmt.getLastChild(), useBreak, useContinue, labels); + } + + /** + * This method will skip the comment content while finding the next ast of current ast. + * + * @param ast current ast + * @return next ast after skipping comment + */ + private static DetailAST getNextNonCommentAst(DetailAST ast) { + DetailAST nextSibling = ast.getNextSibling(); + while (TokenUtil.isOfType(nextSibling, TokenTypes.SINGLE_LINE_COMMENT, + TokenTypes.BLOCK_COMMENT_BEGIN)) { + nextSibling = nextSibling.getNextSibling(); + } + return nextSibling; } /** @@ -254,9 +315,10 @@ && isTerminated(thenStmt, useBreak, useContinue) * if allowed break, continue. * * @param ast loop to check + * @param labels label names * @return true if loop is terminated. */ - private boolean checkLoop(final DetailAST ast) { + private boolean checkLoop(final DetailAST ast, Set labels) { final DetailAST loopBody; if (ast.getType() == TokenTypes.LITERAL_DO) { final DetailAST lparen = ast.findFirstToken(TokenTypes.DO_WHILE); @@ -266,7 +328,7 @@ private boolean checkLoop(final DetailAST ast) { final DetailAST rparen = ast.findFirstToken(TokenTypes.RPAREN); loopBody = rparen.getNextSibling(); } - return isTerminated(loopBody, false, false); + return isTerminated(loopBody, false, false, labels); } /** @@ -276,13 +338,15 @@ private boolean checkLoop(final DetailAST ast) { * @param ast loop to check * @param useBreak should we consider break as terminator * @param useContinue should we consider continue as terminator + * @param labels label names * @return true if try/catch/finally block is terminated */ private boolean checkTry(final DetailAST ast, boolean useBreak, - boolean useContinue) { + boolean useContinue, Set labels) { final DetailAST finalStmt = ast.getLastChild(); boolean isTerminated = finalStmt.getType() == TokenTypes.LITERAL_FINALLY - && isTerminated(finalStmt.findFirstToken(TokenTypes.SLIST), useBreak, useContinue); + && isTerminated(finalStmt.findFirstToken(TokenTypes.SLIST), + useBreak, useContinue, labels); if (!isTerminated) { DetailAST firstChild = ast.getFirstChild(); @@ -292,7 +356,7 @@ private boolean checkTry(final DetailAST ast, boolean useBreak, } isTerminated = isTerminated(firstChild, - useBreak, useContinue); + useBreak, useContinue, labels); DetailAST catchStmt = ast.findFirstToken(TokenTypes.LITERAL_CATCH); while (catchStmt != null @@ -300,7 +364,7 @@ private boolean checkTry(final DetailAST ast, boolean useBreak, && catchStmt.getType() == TokenTypes.LITERAL_CATCH) { final DetailAST catchBody = catchStmt.findFirstToken(TokenTypes.SLIST); - isTerminated = isTerminated(catchBody, useBreak, useContinue); + isTerminated = isTerminated(catchBody, useBreak, useContinue, labels); catchStmt = catchStmt.getNextSibling(); } } @@ -313,15 +377,18 @@ private boolean checkTry(final DetailAST ast, boolean useBreak, * * @param literalSwitchAst loop to check * @param useContinue should we consider continue as terminator + * @param labels label names * @return true if switch is terminated */ - private boolean checkSwitch(final DetailAST literalSwitchAst, boolean useContinue) { + private boolean checkSwitch(DetailAST literalSwitchAst, + boolean useContinue, Set labels) { DetailAST caseGroup = literalSwitchAst.findFirstToken(TokenTypes.CASE_GROUP); boolean isTerminated = caseGroup != null; while (isTerminated && caseGroup.getType() != TokenTypes.RCURLY) { final DetailAST caseBody = caseGroup.findFirstToken(TokenTypes.SLIST); - isTerminated = caseBody != null && isTerminated(caseBody, false, useContinue); + isTerminated = caseBody != null + && isTerminated(caseBody, false, useContinue, labels); caseGroup = caseGroup.getNextSibling(); } return isTerminated; @@ -334,12 +401,13 @@ private boolean checkSwitch(final DetailAST literalSwitchAst, boolean useContinu * @param synchronizedAst synchronized block to check. * @param useBreak should we consider break as terminator * @param useContinue should we consider continue as terminator + * @param labels label names * @return true if synchronized block is terminated */ private boolean checkSynchronized(final DetailAST synchronizedAst, boolean useBreak, - boolean useContinue) { + boolean useContinue, Set labels) { return isTerminated( - synchronizedAst.findFirstToken(TokenTypes.SLIST), useBreak, useContinue); + synchronizedAst.findFirstToken(TokenTypes.SLIST), useBreak, useContinue, labels); } /** @@ -365,46 +433,32 @@ private boolean checkSynchronized(final DetailAST synchronizedAst, boolean useBr * * * @param currentCase AST of the case that falls through to the next case. - * @param nextCase AST of the next case. * @return True if a relief comment was found */ - private boolean hasFallThroughComment(DetailAST currentCase, DetailAST nextCase) { - boolean allThroughComment = false; - final int endLineNo = nextCase.getLineNo(); - - if (matchesComment(reliefPattern, endLineNo)) { - allThroughComment = true; + private boolean hasFallThroughComment(DetailAST currentCase) { + final DetailAST nextSibling = currentCase.getNextSibling(); + final DetailAST ast; + if (nextSibling.getType() == TokenTypes.CASE_GROUP) { + ast = nextSibling.getFirstChild(); } else { - final int startLineNo = currentCase.getLineNo(); - for (int i = endLineNo - 2; i > startLineNo - 1; i--) { - final int[] line = getLineCodePoints(i); - if (!CodePointUtil.isBlank(line)) { - allThroughComment = matchesComment(reliefPattern, i + 1); - break; - } - } + ast = currentCase; } - return allThroughComment; + return hasReliefComment(ast); } /** - * Does a regular expression match on the given line and checks that a - * possible match is within a comment. + * Check if there is any fall through comment. * - * @param pattern The regular expression pattern to use. - * @param lineNo The line number in the file. - * @return True if a match was found inside a comment. + * @param ast ast to check + * @return true if relief comment found */ - // suppress deprecation until https://github.com/checkstyle/checkstyle/issues/11166 - @SuppressWarnings("deprecation") - private boolean matchesComment(Pattern pattern, int lineNo) { - final String line = getLine(lineNo - 1); - - final Matcher matcher = pattern.matcher(line); - return matcher.find() - && getFileContents().hasIntersectionWithComment( - lineNo, matcher.start(), lineNo, matcher.end()); + private boolean hasReliefComment(DetailAST ast) { + return Optional.ofNullable(getNextNonCommentAst(ast)) + .map(DetailAST::getPreviousSibling) + .map(previous -> previous.getFirstChild().getText()) + .map(text -> reliefPattern.matcher(text).find()) + .orElse(Boolean.FALSE); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java index 3b33a6aca3f..44e3f656d69 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -53,6 +53,13 @@ * Default value is {@code false}. *

      • *
      • + * Property {@code validateUnnamedVariables} - Control whether to check + * + * unnamed variables. + * Type is {@code boolean}. + * Default value is {@code false}. + *
      • + *
      • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -118,10 +125,6 @@ public class FinalLocalVariableCheck extends AbstractCheck { /** Scope Deque. */ private final Deque scopeStack = new ArrayDeque<>(); - /** Uninitialized variables of previous scope. */ - private final Deque> prevScopeUninitializedVariables = - new ArrayDeque<>(); - /** Assigned variables of current scope. */ private final Deque> currentScopeAssignedVariables = new ArrayDeque<>(); @@ -133,6 +136,13 @@ public class FinalLocalVariableCheck extends AbstractCheck { */ private boolean validateEnhancedForLoopVariable; + /** + * Control whether to check + * + * unnamed variables. + */ + private boolean validateUnnamedVariables; + /** * Setter to control whether to check * @@ -145,6 +155,18 @@ public final void setValidateEnhancedForLoopVariable(boolean validateEnhancedFor this.validateEnhancedForLoopVariable = validateEnhancedForLoopVariable; } + /** + * Setter to control whether to check + * + * unnamed variables. + * + * @param validateUnnamedVariables whether to check unnamed variables + * @since 10.18.0 + */ + public final void setValidateUnnamedVariables(boolean validateUnnamedVariables) { + this.validateUnnamedVariables = validateUnnamedVariables; + } + @Override public int[] getRequiredTokens() { return new int[] { @@ -226,7 +248,8 @@ public void visitToken(DetailAST ast) { && ast.findFirstToken(TokenTypes.MODIFIERS) .findFirstToken(TokenTypes.FINAL) == null && !isVariableInForInit(ast) - && shouldCheckEnhancedForLoopVariable(ast)) { + && shouldCheckEnhancedForLoopVariable(ast) + && shouldCheckUnnamedVariable(ast)) { insertVariable(ast); } break; @@ -235,7 +258,7 @@ && shouldCheckEnhancedForLoopVariable(ast)) { if (isAssignOperator(parentType) && isFirstChild(ast)) { final Optional candidate = getFinalCandidate(ast); if (candidate.isPresent()) { - determineAssignmentConditions(ast, candidate.get()); + determineAssignmentConditions(ast, candidate.orElseThrow()); currentScopeAssignedVariables.peek().add(ast); } removeFinalVariableCandidateFromStack(ast); @@ -258,7 +281,6 @@ && shouldCheckEnhancedForLoopVariable(ast)) { @Override public void leaveToken(DetailAST ast) { Map scope = null; - final Deque prevScopeUninitializedVariableData; final DetailAST parentAst = ast.getParent(); switch (ast.getType()) { case TokenTypes.OBJBLOCK: @@ -269,24 +291,20 @@ public void leaveToken(DetailAST ast) { break; case TokenTypes.EXPR: // Switch labeled expression has no slist - if (parentAst.getType() == TokenTypes.SWITCH_RULE) { - prevScopeUninitializedVariableData = prevScopeUninitializedVariables.peek(); - if (shouldUpdateUninitializedVariables(parentAst)) { - updateAllUninitializedVariables(prevScopeUninitializedVariableData); - } + if (parentAst.getType() == TokenTypes.SWITCH_RULE + && shouldUpdateUninitializedVariables(parentAst)) { + updateAllUninitializedVariables(); } break; case TokenTypes.SLIST: - prevScopeUninitializedVariableData = prevScopeUninitializedVariables.peek(); boolean containsBreak = false; if (parentAst.getType() != TokenTypes.CASE_GROUP || findLastCaseGroupWhichContainsSlist(parentAst.getParent()) == parentAst) { containsBreak = scopeStack.peek().containsBreak; scope = scopeStack.pop().scope; - prevScopeUninitializedVariables.pop(); } if (containsBreak || shouldUpdateUninitializedVariables(parentAst)) { - updateAllUninitializedVariables(prevScopeUninitializedVariableData); + updateAllUninitializedVariables(); } updateCurrentScopeAssignedVariables(); break; @@ -383,26 +401,18 @@ private void storePrevScopeUninitializedVariableData() { final Deque prevScopeUninitializedVariableData = new ArrayDeque<>(); scopeData.uninitializedVariables.forEach(prevScopeUninitializedVariableData::push); - prevScopeUninitializedVariables.push(prevScopeUninitializedVariableData); + scopeData.prevScopeUninitializedVariables = prevScopeUninitializedVariableData; } /** * Update current scope data uninitialized variable according to the whole scope data. - * - * @param prevScopeUninitializedVariableData variable for previous stack of uninitialized - * variables - * @noinspection MethodParameterNamingConvention - * @noinspectionreason MethodParameterNamingConvention - complicated check - * requires descriptive naming - */ - private void updateAllUninitializedVariables( - Deque prevScopeUninitializedVariableData) { + */ + private void updateAllUninitializedVariables() { final boolean hasSomeScopes = !currentScopeAssignedVariables.isEmpty(); if (hasSomeScopes) { - // Check for only previous scope - updateUninitializedVariables(prevScopeUninitializedVariableData); - // Check for rest of the scope - prevScopeUninitializedVariables.forEach(this::updateUninitializedVariables); + scopeStack.forEach(scopeData -> { + updateUninitializedVariables(scopeData.prevScopeUninitializedVariables); + }); } } @@ -497,6 +507,17 @@ private boolean shouldCheckEnhancedForLoopVariable(DetailAST ast) { || ast.getParent().getType() != TokenTypes.FOR_EACH_CLAUSE; } + /** + * Determines whether unnamed variable should be checked or not. + * + * @param ast The ast to compare. + * @return true if unnamed variable should be checked. + */ + private boolean shouldCheckUnnamedVariable(DetailAST ast) { + return validateUnnamedVariables + || !"_".equals(ast.findFirstToken(TokenTypes.IDENT).getText()); + } + /** * Insert a parameter at the topmost scope stack. * @@ -735,6 +756,9 @@ private static final class ScopeData { /** Contains definitions of uninitialized variables. */ private final Deque uninitializedVariables = new ArrayDeque<>(); + /** Contains definitions of previous scope uninitialized variables. */ + private Deque prevScopeUninitializedVariables = new ArrayDeque<>(); + /** Whether there is a {@code break} in the scope. */ private boolean containsBreak; @@ -750,7 +774,7 @@ public Optional findFinalVariableCandidateForAst(DetailA final Optional candidate = Optional.ofNullable(scope.get(ast.getText())); if (candidate.isPresent()) { - storedVariable = candidate.get().variableIdent; + storedVariable = candidate.orElseThrow().variableIdent; } if (storedVariable != null && isSameVariables(storedVariable, ast)) { result = candidate; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java index 997f5d01273..1510cf0dec8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -75,10 +75,10 @@ *

        *
          *
        • - * Property {@code ignoreFormat} - Define the RegExp for names of variables - * and parameters to ignore. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code null}. + * Property {@code ignoreAbstractMethods} - Control whether to ignore parameters + * of abstract methods. + * Type is {@code boolean}. + * Default value is {@code false}. *
        • *
        • * Property {@code ignoreConstructorParameter} - Control whether to ignore constructor parameters. @@ -86,6 +86,12 @@ * Default value is {@code false}. *
        • *
        • + * Property {@code ignoreFormat} - Define the RegExp for names of variables + * and parameters to ignore. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code null}. + *
        • + *
        • * Property {@code ignoreSetter} - Allow to ignore the parameter of a property setter method. * Type is {@code boolean}. * Default value is {@code false}. @@ -97,12 +103,6 @@ * Default value is {@code false}. *
        • *
        • - * Property {@code ignoreAbstractMethods} - Control whether to ignore parameters - * of abstract methods. - * Type is {@code boolean}. - * Default value is {@code false}. - *
        • - *
        • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -257,7 +257,9 @@ private void visitOtherTokens(DetailAST ast, int type) { final DetailAST typeMods = ast.findFirstToken(TokenTypes.MODIFIERS); final boolean isStaticInnerType = typeMods != null - && typeMods.findFirstToken(TokenTypes.LITERAL_STATIC) != null; + && typeMods.findFirstToken(TokenTypes.LITERAL_STATIC) != null + // inner record is implicitly static + || ast.getType() == TokenTypes.RECORD_DEF; final String frameName; if (type == TokenTypes.CLASS_DEF @@ -647,6 +649,8 @@ public void addStaticField(String field) { * * @param field the field to check * @return true if this FieldFrame contains instance field + * @noinspection TailRecursion + * @noinspectionreason TailRecursion - until issue #14814 */ public boolean containsInstanceField(String field) { return instanceFields.contains(field) @@ -659,6 +663,8 @@ public boolean containsInstanceField(String field) { * * @param field the field to check * @return true if this FieldFrame contains static field + * @noinspection TailRecursion + * @noinspectionreason TailRecursion - until issue #14814 */ public boolean containsStaticField(String field) { return staticFields.contains(field) diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java index c9cc9653884..c79a4b73219 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalCatchCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java index 312d4fc9599..ebeba90b8bf 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -346,7 +346,7 @@ private boolean isStandardClass(String className, String illegal) { * @since 3.0 */ public void setClasses(String... names) { - classes = Arrays.stream(names).collect(Collectors.toSet()); + classes = Arrays.stream(names).collect(Collectors.toUnmodifiableSet()); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java index 2c487c1c0db..3c0b42ce995 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -41,10 +41,10 @@ *

          *
            *
          • - * Property {@code illegalClassNames} - Specify throw class names to reject. - * Type is {@code java.lang.String[]}. - * Default value is {@code Error, RuntimeException, Throwable, java.lang.Error, - * java.lang.RuntimeException, java.lang.Throwable}. + * Property {@code ignoreOverriddenMethods} - Allow to ignore checking overridden methods + * (marked with {@code Override} or {@code java.lang.Override} annotation). + * Type is {@code boolean}. + * Default value is {@code true}. *
          • *
          • * Property {@code ignoredMethodNames} - Specify names of methods to ignore. @@ -52,10 +52,10 @@ * Default value is {@code finalize}. *
          • *
          • - * Property {@code ignoreOverriddenMethods} - allow to ignore checking overridden methods - * (marked with {@code Override} or {@code java.lang.Override} annotation). - * Type is {@code boolean}. - * Default value is {@code true}. + * Property {@code illegalClassNames} - Specify throw class names to reject. + * Type is {@code java.lang.String[]}. + * Default value is {@code Error, RuntimeException, Throwable, java.lang.Error, + * java.lang.RuntimeException, java.lang.Throwable}. *
          • *
          *

          diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java index d85043bb7f2..7e11e64bcf1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java index 0aa1bcacd55..c74ead0ff17 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTokenTextCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java index 7e7a1365a8b..0c7e4f17f86 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalTypeCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -81,9 +81,15 @@ *

          *
            *
          • - * Property {@code validateAbstractClassNames} - Control whether to validate abstract class names. - * Type is {@code boolean}. - * Default value is {@code false}. + * Property {@code ignoredMethodNames} - Specify methods that should not be checked. + * Type is {@code java.lang.String[]}. + * Default value is {@code getEnvironment, getInitialContext}. + *
          • + *
          • + * Property {@code illegalAbstractClassNameFormat} - Specify RegExp for illegal abstract class + * names. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code "^(.*[.])?Abstract.*$"}. *
          • *
          • * Property {@code illegalClassNames} - Specify classes that should not be used @@ -99,17 +105,6 @@ * Default value is {@code ""}. *
          • *
          • - * Property {@code ignoredMethodNames} - Specify methods that should not be checked. - * Type is {@code java.lang.String[]}. - * Default value is {@code getEnvironment, getInitialContext}. - *
          • - *
          • - * Property {@code illegalAbstractClassNameFormat} - Specify RegExp for illegal abstract class - * names. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code "^(.*[.])?Abstract.*$"}. - *
          • - *
          • * Property {@code memberModifiers} - Control whether to check only methods and fields with any * of the specified modifiers. * This property does not affect method calls nor method references nor record components. @@ -118,6 +113,11 @@ * Default value is {@code ""}. *
          • *
          • + * Property {@code validateAbstractClassNames} - Control whether to validate abstract class names. + * Type is {@code boolean}. + * Default value is {@code false}. + *
          • + *
          • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -143,7 +143,9 @@ * * RECORD_DEF, * - * RECORD_COMPONENT_DEF. + * RECORD_COMPONENT_DEF, + * + * RECORD_PATTERN_DEF. *
          • *
          *

          @@ -264,6 +266,7 @@ public int[] getAcceptableTokens() { TokenTypes.PATTERN_VARIABLE_DEF, TokenTypes.RECORD_DEF, TokenTypes.RECORD_COMPONENT_DEF, + TokenTypes.RECORD_PATTERN_DEF, }; } @@ -299,6 +302,7 @@ public void visitToken(DetailAST ast) { visitVariableDef(ast); break; case TokenTypes.RECORD_COMPONENT_DEF: + case TokenTypes.RECORD_PATTERN_DEF: checkClassName(ast); break; case TokenTypes.PARAMETER_DEF: diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java index 2a923a04e14..3fc5ba33430 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/InnerAssignmentCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -101,6 +101,7 @@ public class InnerAssignmentCheck TokenTypes.RESOURCE_SPECIFICATION, }, {TokenTypes.EXPR, TokenTypes.LAMBDA}, + {TokenTypes.EXPR, TokenTypes.SWITCH_RULE, TokenTypes.LITERAL_SWITCH, TokenTypes.SLIST}, }; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java index 48a2949de18..60cb98bb019 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -55,32 +55,6 @@ * *

            *
          • - * Property {@code ignoreNumbers} - Specify non-magic numbers. - * Type is {@code double[]}. - * Default value is {@code -1, 0, 1, 2}. - *
          • - *
          • - * Property {@code ignoreHashCodeMethod} - Ignore magic numbers in hashCode methods. - * Type is {@code boolean}. - * Default value is {@code false}. - *
          • - *
          • - * Property {@code ignoreAnnotation} - Ignore magic numbers in annotation declarations. - * Type is {@code boolean}. - * Default value is {@code false}. - *
          • - *
          • - * Property {@code ignoreFieldDeclaration} - Ignore magic numbers in field declarations. - * Type is {@code boolean}. - * Default value is {@code false}. - *
          • - *
          • - * Property {@code ignoreAnnotationElementDefaults} - - * Ignore magic numbers in annotation elements defaults. - * Type is {@code boolean}. - * Default value is {@code true}. - *
          • - *
          • * Property {@code constantWaiverParentToken} - Specify tokens that are allowed in the AST path * from the number literal to the enclosing constant definition. * Type is {@code java.lang.String[]}. @@ -114,6 +88,32 @@ * UNARY_PLUS. *
          • *
          • + * Property {@code ignoreAnnotation} - Ignore magic numbers in annotation declarations. + * Type is {@code boolean}. + * Default value is {@code false}. + *
          • + *
          • + * Property {@code ignoreAnnotationElementDefaults} - + * Ignore magic numbers in annotation elements defaults. + * Type is {@code boolean}. + * Default value is {@code true}. + *
          • + *
          • + * Property {@code ignoreFieldDeclaration} - Ignore magic numbers in field declarations. + * Type is {@code boolean}. + * Default value is {@code false}. + *
          • + *
          • + * Property {@code ignoreHashCodeMethod} - Ignore magic numbers in hashCode methods. + * Type is {@code boolean}. + * Default value is {@code false}. + *
          • + *
          • + * Property {@code ignoreNumbers} - Specify non-magic numbers. + * Type is {@code double[]}. + * Default value is {@code -1, 0, 1, 2}. + *
          • + *
          • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -387,7 +387,7 @@ private boolean isInIgnoreList(DetailAST ast) { private static boolean isFieldDeclaration(DetailAST ast) { DetailAST varDefAST = null; DetailAST node = ast; - while (node.getType() != TokenTypes.OBJBLOCK) { + while (node != null && node.getType() != TokenTypes.OBJBLOCK) { if (node.getType() == TokenTypes.VARIABLE_DEF) { varDefAST = node; break; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java index 723e9c2d547..7705c3a61e1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MatchXpathCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -49,9 +49,10 @@ *

            *

            * Please read more about Xpath syntax at - * Xpath Syntax. + * Xpath Syntax. * Information regarding Xpath functions can be found at - * XSLT/XPath Reference. + * + * XSLT/XPath Reference. * Note, that @text attribute can be used only with token types that are listed in * * XpathUtil. @@ -134,7 +135,7 @@ public boolean isCommentNodesRequired() { @Override public void beginTree(DetailAST rootAST) { - if (xpathExpression != null) { + if (!query.isEmpty()) { final List matchingNodes = findMatchingNodesByXpathQuery(rootAST); matchingNodes.forEach(node -> log(node, MSG_KEY)); } @@ -155,7 +156,7 @@ private List findMatchingNodesByXpathQuery(DetailAST rootAST) { final List matchingItems = xpathExpression.evaluate(xpathDynamicContext); return matchingItems.stream() .map(item -> (DetailAST) ((AbstractNode) item).getUnderlyingNode()) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); } catch (XPathException ex) { throw new IllegalStateException("Evaluation of Xpath query failed: " + query, ex); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java index 62b7d53e784..d405df15968 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingCtorCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingNullCaseInSwitchCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingNullCaseInSwitchCheck.java new file mode 100644 index 00000000000..d674fb2cd4b --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingNullCaseInSwitchCheck.java @@ -0,0 +1,186 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.coding; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +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.TokenUtil; + +/** + *

            + * Checks that a given switch statement or expression that use a reference type in its selector + * expression has a {@code null} case label. + *

            + *

            + * Rationale: switch statements and expressions in Java throw a + * {@code NullPointerException} if the selector expression evaluates to {@code null}. + * As of Java 21, it is now possible to integrate a null check within the switch, + * eliminating the risk of {@code NullPointerException} and simplifies the code + * as there is no need for an external null check before entering the switch. + *

            + *

            + * See the + * Java Language Specification for more information about switch statements and expressions. + *

            + *

            + * Specifically, this check validates switch statement or expression + * that use patterns or strings in their case labels. + *

            + *

            + * Due to Checkstyle not being type-aware, this check cannot validate other reference types, + * such as enums; syntactically, these are no different from other constants. + *

            + *

            + * Attention: this Check should be activated only on source code + * that is compiled by jdk21 or above. + *

            + *

            + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

            + *

            + * Violation Message Keys: + *

            + *
              + *
            • + * {@code missing.switch.nullcase} + *
            • + *
            + * + * @since 10.18.0 + */ + +@StatelessCheck +public class MissingNullCaseInSwitchCheck extends AbstractCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_KEY = "missing.switch.nullcase"; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] {TokenTypes.LITERAL_SWITCH}; + } + + @Override + public void visitToken(DetailAST ast) { + final List caseLabels = getAllCaseLabels(ast); + final boolean hasNullCaseLabel = caseLabels.stream() + .anyMatch(MissingNullCaseInSwitchCheck::hasLiteralNull); + if (!hasNullCaseLabel) { + final boolean hasPatternCaseLabel = caseLabels.stream() + .anyMatch(MissingNullCaseInSwitchCheck::hasPatternCaseLabel); + final boolean hasStringCaseLabel = caseLabels.stream() + .anyMatch(MissingNullCaseInSwitchCheck::hasStringCaseLabel); + if (hasPatternCaseLabel || hasStringCaseLabel) { + log(ast, MSG_KEY); + } + } + } + + /** + * Gets all case labels in the given switch AST node. + * + * @param switchAST the AST node representing {@code LITERAL_SWITCH} + * @return a list of all case labels in the switch + */ + private static List getAllCaseLabels(DetailAST switchAST) { + final List caseLabels = new ArrayList<>(); + DetailAST ast = switchAST.getFirstChild(); + while (ast != null) { + // case group token may have several LITERAL_CASE tokens + TokenUtil.forEachChild(ast, TokenTypes.LITERAL_CASE, caseLabels::add); + ast = ast.getNextSibling(); + } + return Collections.unmodifiableList(caseLabels); + } + + /** + * Checks if the given case AST node has a null label. + * + * @param caseAST the AST node representing {@code LITERAL_CASE} + * @return true if the case has {@code null} label, false otherwise + */ + private static boolean hasLiteralNull(DetailAST caseAST) { + return Optional.ofNullable(caseAST.findFirstToken(TokenTypes.EXPR)) + .map(exp -> exp.findFirstToken(TokenTypes.LITERAL_NULL)) + .isPresent(); + } + + /** + * Checks if the given case AST node has a pattern variable declaration label + * or record pattern definition label. + * + * @param caseAST the AST node representing {@code LITERAL_CASE} + * @return true if case has a pattern in its label + */ + private static boolean hasPatternCaseLabel(DetailAST caseAST) { + return caseAST.findFirstToken(TokenTypes.RECORD_PATTERN_DEF) != null + || caseAST.findFirstToken(TokenTypes.PATTERN_VARIABLE_DEF) != null + || caseAST.findFirstToken(TokenTypes.PATTERN_DEF) != null; + } + + /** + * Checks if the given case contains a string in its label. + * It may contain a single string literal or a string literal + * in a concatenated expression. + * + * @param caseAST the AST node representing {@code LITERAL_CASE} + * @return true if switch block contains a string case label + */ + private static boolean hasStringCaseLabel(DetailAST caseAST) { + DetailAST curNode = caseAST; + boolean hasStringCaseLabel = false; + boolean exitCaseLabelExpression = false; + while (!exitCaseLabelExpression) { + DetailAST toVisit = curNode.getFirstChild(); + if (curNode.getType() == TokenTypes.STRING_LITERAL) { + hasStringCaseLabel = true; + break; + } + while (toVisit == null) { + toVisit = curNode.getNextSibling(); + curNode = curNode.getParent(); + } + curNode = toVisit; + exitCaseLabelExpression = TokenUtil.isOfType(curNode, TokenTypes.COLON, + TokenTypes.LAMBDA); + } + return hasStringCaseLabel; + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java index 5cbe9b1e9a2..b4e241ca1c2 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MissingSwitchDefaultCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -50,11 +50,15 @@ * inputs must be covered. *

            *

            - * See the + * See the * Java Language Specification for more information about switch statements * and expressions. *

            *

            + * See the + * Java Language Specification for more information about patterns. + *

            + *

            * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

            *

            @@ -97,6 +101,7 @@ public void visitToken(DetailAST ast) { if (!containsDefaultLabel(ast) && !containsPatternCaseLabelElement(ast) && !containsDefaultCaseLabelElement(ast) + && !containsNullCaseLabelElement(ast) && !isSwitchExpression(ast)) { log(ast, MSG_KEY); } @@ -115,7 +120,8 @@ private static boolean containsDefaultLabel(DetailAST detailAst) { } /** - * Checks if a switch block contains a case label with a pattern variable definition. + * Checks if a switch block contains a case label with a pattern variable definition + * or record pattern definition. * In this situation, the compiler enforces the given switch block to cover * all possible inputs, and we do not need a default label. * @@ -125,7 +131,8 @@ private static boolean containsDefaultLabel(DetailAST detailAst) { private static boolean containsPatternCaseLabelElement(DetailAST detailAst) { return TokenUtil.findFirstTokenByPredicate(detailAst, ast -> { return ast.getFirstChild() != null - && ast.getFirstChild().findFirstToken(TokenTypes.PATTERN_VARIABLE_DEF) != null; + && (ast.getFirstChild().findFirstToken(TokenTypes.PATTERN_VARIABLE_DEF) != null + || ast.getFirstChild().findFirstToken(TokenTypes.RECORD_PATTERN_DEF) != null); }).isPresent(); } @@ -142,6 +149,19 @@ private static boolean containsDefaultCaseLabelElement(DetailAST detailAst) { }).isPresent(); } + /** + * Checks if a switch block contains a null case label. + * + * @param detailAst first case group to check. + * @return true if switch block contains null case label + */ + private static boolean containsNullCaseLabelElement(DetailAST detailAst) { + return TokenUtil.findFirstTokenByPredicate(detailAst, ast -> { + return ast.getFirstChild() != null + && hasNullCaseLabel(ast.getFirstChild()); + }).isPresent(); + } + /** * Checks if this LITERAL_SWITCH token is part of a switch expression. * @@ -149,7 +169,29 @@ private static boolean containsDefaultCaseLabelElement(DetailAST detailAst) { * @return true if part of a switch expression */ private static boolean isSwitchExpression(DetailAST ast) { - return ast.getParent().getType() == TokenTypes.EXPR - || ast.getParent().getParent().getType() == TokenTypes.EXPR; + final int[] switchStatementParents = { + TokenTypes.SLIST, + TokenTypes.LITERAL_IF, + TokenTypes.LITERAL_ELSE, + TokenTypes.LITERAL_DO, + TokenTypes.LITERAL_WHILE, + TokenTypes.LITERAL_FOR, + TokenTypes.LABELED_STAT, + }; + + return !TokenUtil.isOfType(ast.getParent(), switchStatementParents); + } + + /** + * Checks if the case contains null label. + * + * @param detailAST the switch statement we are checking + * @return returnValue the ast of null label + */ + private static boolean hasNullCaseLabel(DetailAST detailAST) { + return TokenUtil.findFirstTokenByPredicate(detailAST.getParent(), ast -> { + final DetailAST expr = ast.findFirstToken(TokenTypes.EXPR); + return expr != null && expr.findFirstToken(TokenTypes.LITERAL_NULL) != null; + }).isPresent(); } } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java index a1eb1b74e06..c70dc27c39d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ModifiedControlVariableCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -312,7 +312,7 @@ private static Set getVariablesManagedByForLoop(DetailAST ast) { final Set initializedVariables = getForInitVariables(ast); final Set iteratingVariables = getForIteratorVariables(ast); return initializedVariables.stream().filter(iteratingVariables::contains) - .collect(Collectors.toSet()); + .collect(Collectors.toUnmodifiableSet()); } /** @@ -408,7 +408,7 @@ private static Set getForIteratorVariables(DetailAST ast) { } /** - * Find all child of given AST of type TokenType.EXPR + * Find all child of given AST of type TokenType.EXPR. * * @param ast parent of expressions to find * @return all child of given ast diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.java index c33aa0cec55..6952c426ff7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleStringLiteralsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -51,17 +51,19 @@ * Default value is {@code 1}. *

          • *
          • - * Property {@code ignoreStringsRegexp} - Specify RegExp for ignored strings (with quotation marks). - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code "^""$"}. - *
          • - *
          • * Property {@code ignoreOccurrenceContext} - Specify token type names where duplicate * strings are ignored even if they don't match ignoredStringsRegexp. This allows you to * exclude syntactical contexts like annotations or static initializers from the check. * Type is {@code java.lang.String[]}. * Validation type is {@code tokenTypesSet}. - * Default value is {@code ANNOTATION}. + * Default value is + * + * ANNOTATION. + *
          • + *
          • + * Property {@code ignoreStringsRegexp} - Specify RegExp for ignored strings (with quotation marks). + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code "^""$"}. *
          • *
          *

          diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java index d3d218ebc2d..d5c54c718fb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MultipleVariableDeclarationsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheck.java index 796bbcc37d0..54284568aa4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedForDepthCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java index 7f44b2fbca5..278cad9f1ed 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedIfDepthCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java index 071844ef5cf..ef3fa583930 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NestedTryDepthCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheck.java index d069e78cfa5..f985ff464eb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoArrayTrailingCommaCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheck.java index 2789b0e1813..4eec4c59567 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoCloneCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheck.java index 2bcb31516e7..f77e5887a6c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoEnumTrailingCommaCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheck.java index e4321ff84d4..8a743eca039 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/NoFinalizerCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheck.java index 6694948da1a..1c7512148e6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OneStatementPerLineCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheck.java index e9973c91618..8fc95c85513 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/OverloadMethodsDeclarationOrderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -110,7 +110,11 @@ private void checkOverloadMethodsGrouping(DetailAST objectBlock) { final String methodName = currentToken.findFirstToken(TokenTypes.IDENT).getText(); final Integer previousIndex = methodIndexMap.get(methodName); - if (previousIndex != null && currentIndex - previousIndex > allowedDistance) { + final DetailAST previousSibling = currentToken.getPreviousSibling(); + final boolean isMethod = previousSibling.getType() == TokenTypes.METHOD_DEF; + + if (previousIndex != null + && (!isMethod || currentIndex - previousIndex > allowedDistance)) { final int previousLineWithOverloadMethod = methodLineNumberMap.get(methodName); log(currentToken, MSG_KEY, diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java index 7a7faa4a3ec..da15b84a8dd 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/PackageDeclarationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java index 2885027e211..635760b47e5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ParameterAssignmentCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java index bb712b9b95b..36676f94a19 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.java index cb57314e7e4..e3f99d49f82 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ReturnCountCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -51,6 +51,11 @@ *

          *
            *
          • + * Property {@code format} - Specify method names to ignore. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code "^equals$"}. + *
          • + *
          • * Property {@code max} - Specify maximum allowed number of return statements * in non-void methods/lambdas. * Type is {@code int}. @@ -63,11 +68,6 @@ * Default value is {@code 1}. *
          • *
          • - * Property {@code format} - Specify method names to ignore. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code "^equals$"}. - *
          • - *
          • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java index 288fd0f3ec0..fe08ec41392 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanExpressionCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java index 9ffc44f84c1..0d0a8858575 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SimplifyBooleanReturnCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -27,7 +27,7 @@ /** *

            - * Checks for over-complicated boolean return statements. + * Checks for over-complicated boolean return or yield statements. * For example the following code *

            *
            @@ -44,7 +44,8 @@
              * 
            *

            * The idea for this Check has been shamelessly stolen from the equivalent - * PMD rule. + * + * PMD rule. *

            *

            * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} @@ -104,55 +105,56 @@ public void visitToken(DetailAST ast) { final DetailAST condition = ast.getFirstChild().getNextSibling(); final DetailAST thenStatement = condition.getNextSibling().getNextSibling(); - if (canReturnOnlyBooleanLiteral(thenStatement) - && canReturnOnlyBooleanLiteral(elseStatement)) { + if (canReturnOrYieldOnlyBooleanLiteral(thenStatement) + && canReturnOrYieldOnlyBooleanLiteral(elseStatement)) { log(ast, MSG_KEY); } } } /** - * Returns if an AST is a return statement with a boolean literal - * or a compound statement that contains only such a return statement. + * Returns if an AST is a return or a yield statement with a boolean literal + * or a compound statement that contains only such a return or a yield statement. * *

            Returns {@code true} iff ast represents *

            -     * return true/false;
            +     * return/yield true/false;
                  * 
            * or *
                  * {
            -     *   return true/false;
            +     *   return/yield true/false;
                  * }
                  * 
            * * @param ast the syntax tree to check - * @return if ast is a return statement with a boolean literal. + * @return if ast is a return or a yield statement with a boolean literal. */ - private static boolean canReturnOnlyBooleanLiteral(DetailAST ast) { + private static boolean canReturnOrYieldOnlyBooleanLiteral(DetailAST ast) { boolean result = true; - if (!isBooleanLiteralReturnStatement(ast)) { + if (!isBooleanLiteralReturnOrYieldStatement(ast)) { final DetailAST firstStatement = ast.getFirstChild(); - result = isBooleanLiteralReturnStatement(firstStatement); + result = isBooleanLiteralReturnOrYieldStatement(firstStatement); } return result; } /** - * Returns if an AST is a return statement with a boolean literal. + * Returns if an AST is a return or a yield statement with a boolean literal. * *

            Returns {@code true} iff ast represents *

            -     * return true/false;
            +     * return/yield true/false;
                  * 
            * * @param ast the syntax tree to check - * @return if ast is a return statement with a boolean literal. + * @return if ast is a return or a yield statement with a boolean literal. */ - private static boolean isBooleanLiteralReturnStatement(DetailAST ast) { + private static boolean isBooleanLiteralReturnOrYieldStatement(DetailAST ast) { boolean booleanReturnStatement = false; - if (ast != null && ast.getType() == TokenTypes.LITERAL_RETURN) { + if (ast != null && (ast.getType() == TokenTypes.LITERAL_RETURN + || ast.getType() == TokenTypes.LITERAL_YIELD)) { final DetailAST expr = ast.getFirstChild(); if (expr.getType() != TokenTypes.SEMI) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java index 59e07af0301..5ffac838940 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/StringLiteralEqualityCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java index 4a935e71682..a67978cb54f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperCloneCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java index 5a4b6e74298..5a4d8ec3f8f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/SuperFinalizeCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java index 84d78f3b0cb..9ce4045033a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessaryParenthesesCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheck.java index a00448cc9fd..f35296848bb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterOuterTypeDeclarationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheck.java index 9856fdaf511..db0daf32475 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonAfterTypeMemberDeclarationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheck.java index 1e65839ad79..33666ecc980 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInEnumerationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheck.java index 03dc0283d53..07d52056236 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnnecessarySemicolonInTryWithResourcesCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedCatchParameterShouldBeUnnamedCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedCatchParameterShouldBeUnnamedCheck.java new file mode 100644 index 00000000000..c7c9cc21bb1 --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedCatchParameterShouldBeUnnamedCheck.java @@ -0,0 +1,263 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.coding; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Optional; + +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.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +/** + *

            + * Ensures that catch parameters that are not used are declared as an unnamed variable. + *

            + *

            + * Rationale: + *

            + *
              + *
            • + * Improves code readability by clearly indicating which parameters are unused. + *
            • + *
            • + * Follows Java conventions for denoting unused parameters with an underscore ({@code _}). + *
            • + *
            + *

            + * See the + * Java Language Specification for more information about unnamed variables. + *

            + *

            + * Attention: This check should be activated only on source code + * that is compiled by jdk21 or higher; + * unnamed catch parameters came out as the first preview in Java 21. + *

            + *

            + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

            + *

            + * Violation Message Keys: + *

            + *
              + *
            • + * {@code unused.catch.parameter} + *
            • + *
            + * + * @since 10.18.0 + * + */ + +@FileStatefulCheck +public class UnusedCatchParameterShouldBeUnnamedCheck extends AbstractCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_UNUSED_CATCH_PARAMETER = "unused.catch.parameter"; + + /** + * Invalid parents of the catch parameter identifier. + */ + private static final int[] INVALID_CATCH_PARAM_IDENT_PARENTS = { + TokenTypes.DOT, + TokenTypes.LITERAL_NEW, + TokenTypes.METHOD_CALL, + TokenTypes.TYPE, + }; + + /** + * Keeps track of the catch parameters in a block. + */ + private final Deque catchParameters = new ArrayDeque<>(); + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.LITERAL_CATCH, + TokenTypes.IDENT, + }; + } + + @Override + public void beginTree(DetailAST rootAST) { + catchParameters.clear(); + } + + @Override + public void visitToken(DetailAST ast) { + if (ast.getType() == TokenTypes.LITERAL_CATCH) { + final CatchParameterDetails catchParameter = new CatchParameterDetails(ast); + catchParameters.push(catchParameter); + } + else if (isCatchParameterIdentifierCandidate(ast) && !isLeftHandOfAssignment(ast)) { + // we do not count reassignment as usage + catchParameters.stream() + .filter(parameter -> parameter.getName().equals(ast.getText())) + .findFirst() + .ifPresent(CatchParameterDetails::registerAsUsed); + } + } + + @Override + public void leaveToken(DetailAST ast) { + if (ast.getType() == TokenTypes.LITERAL_CATCH) { + final Optional unusedCatchParameter = + Optional.ofNullable(catchParameters.peek()) + .filter(parameter -> !parameter.isUsed()) + .filter(parameter -> !"_".equals(parameter.getName())); + + unusedCatchParameter.ifPresent(parameter -> { + log(parameter.getParameterDefinition(), + MSG_UNUSED_CATCH_PARAMETER, + parameter.getName()); + }); + catchParameters.pop(); + } + } + + /** + * Visit ast of type {@link TokenTypes#IDENT} + * and check if it is a candidate for a catch parameter identifier. + * + * @param identifierAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} could be a catch parameter identifier + */ + private static boolean isCatchParameterIdentifierCandidate(DetailAST identifierAst) { + // we should ignore the ident if it is in the exception declaration + final boolean isCatchParameterDeclaration = + identifierAst.getParent().getParent().getType() == TokenTypes.LITERAL_CATCH; + + final boolean hasValidParentToken = + !TokenUtil.isOfType(identifierAst.getParent(), INVALID_CATCH_PARAM_IDENT_PARENTS); + + final boolean isMethodInvocation = isMethodInvocation(identifierAst); + + return !isCatchParameterDeclaration && (hasValidParentToken || isMethodInvocation); + } + + /** + * Check if the given {@link TokenTypes#IDENT} is a child of a dot operator + * and is a candidate for catch parameter. + * + * @param identAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} is a child of a dot operator + * and a candidate for catch parameter. + */ + private static boolean isMethodInvocation(DetailAST identAst) { + final DetailAST parent = identAst.getParent(); + return parent.getType() == TokenTypes.DOT + && identAst.equals(parent.getFirstChild()); + } + + /** + * Check if the given {@link TokenTypes#IDENT} is a left hand side value. + * + * @param identAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} is a left hand side value. + */ + private static boolean isLeftHandOfAssignment(DetailAST identAst) { + final DetailAST parent = identAst.getParent(); + return parent.getType() == TokenTypes.ASSIGN + && !identAst.equals(parent.getLastChild()); + } + + /** + * Maintains information about the catch parameter. + */ + private static final class CatchParameterDetails { + + /** + * The name of the catch parameter. + */ + private final String name; + + /** + * Ast of type {@link TokenTypes#PARAMETER_DEF} to use it when logging. + */ + private final DetailAST parameterDefinition; + + /** + * Is the variable used. + */ + private boolean used; + + /** + * Create a new catch parameter instance. + * + * @param enclosingCatchClause ast of type {@link TokenTypes#LITERAL_CATCH} + */ + private CatchParameterDetails(DetailAST enclosingCatchClause) { + parameterDefinition = + enclosingCatchClause.findFirstToken(TokenTypes.PARAMETER_DEF); + name = parameterDefinition.findFirstToken(TokenTypes.IDENT).getText(); + } + + /** + * Register the catch parameter as used. + */ + private void registerAsUsed() { + used = true; + } + + /** + * Get the name of the catch parameter. + * + * @return the name of the catch parameter + */ + private String getName() { + return name; + } + + /** + * Check if the catch parameter is used. + * + * @return true if the catch parameter is used + */ + private boolean isUsed() { + return used; + } + + /** + * Get the parameter definition token of the catch parameter + * represented by ast of type {@link TokenTypes#PARAMETER_DEF}. + * + * @return the ast of type {@link TokenTypes#PARAMETER_DEF} + */ + private DetailAST getParameterDefinition() { + return parameterDefinition; + } + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.java new file mode 100644 index 00000000000..bfb5a5b5e36 --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLambdaParameterShouldBeUnnamedCheck.java @@ -0,0 +1,289 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.coding; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Optional; + +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.TokenTypes; +import com.puppycrawl.tools.checkstyle.utils.TokenUtil; + +/** + *

            + * Ensures that lambda parameters that are not used are declared as an unnamed variable. + *

            + *

            + * Rationale: + *

            + *
              + *
            • + * Improves code readability by clearly indicating which parameters are unused. + *
            • + *
            • + * Follows Java conventions for denoting unused parameters with an underscore ({@code _}). + *
            • + *
            + *

            + * See the + * Java Language Specification for more information about unnamed variables. + *

            + *

            + * Attention: Unnamed variables are available as a preview feature in Java 21, + * and became an official part of the language in Java 22. + * This check should be activated only on source code which meets those requirements. + *

            + *

            + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

            + *

            + * Violation Message Keys: + *

            + *
              + *
            • + * {@code unused.lambda.parameter} + *
            • + *
            + * + * @since 10.18.0 + */ +@FileStatefulCheck +public class UnusedLambdaParameterShouldBeUnnamedCheck extends AbstractCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_UNUSED_LAMBDA_PARAMETER = "unused.lambda.parameter"; + + /** + * Invalid parents of the lambda parameter identifier. + * These are tokens that can not be parents for a lambda + * parameter identifier. + */ + private static final int[] INVALID_LAMBDA_PARAM_IDENT_PARENTS = { + TokenTypes.DOT, + TokenTypes.LITERAL_NEW, + TokenTypes.METHOD_CALL, + TokenTypes.TYPE, + }; + + /** + * Keeps track of the lambda parameters in a block. + */ + private final Deque lambdaParameters = new ArrayDeque<>(); + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.LAMBDA, + TokenTypes.IDENT, + }; + } + + @Override + public void beginTree(DetailAST rootAST) { + lambdaParameters.clear(); + } + + @Override + public void visitToken(DetailAST ast) { + if (ast.getType() == TokenTypes.LAMBDA) { + final DetailAST parameters = ast.findFirstToken(TokenTypes.PARAMETERS); + if (parameters != null) { + // we have multiple lambda parameters + TokenUtil.forEachChild(parameters, TokenTypes.PARAMETER_DEF, parameter -> { + final DetailAST identifierAst = parameter.findFirstToken(TokenTypes.IDENT); + final LambdaParameterDetails lambdaParameter = + new LambdaParameterDetails(ast, identifierAst); + lambdaParameters.push(lambdaParameter); + }); + } + else if (ast.getChildCount() != 0) { + // we are not switch rule and have a single parameter + final LambdaParameterDetails lambdaParameter = + new LambdaParameterDetails(ast, ast.findFirstToken(TokenTypes.IDENT)); + lambdaParameters.push(lambdaParameter); + } + } + else if (isLambdaParameterIdentifierCandidate(ast) && !isLeftHandOfAssignment(ast)) { + // we do not count reassignment as usage + lambdaParameters.stream() + .filter(parameter -> parameter.getName().equals(ast.getText())) + .findFirst() + .ifPresent(LambdaParameterDetails::registerAsUsed); + } + } + + @Override + public void leaveToken(DetailAST ast) { + while (lambdaParameters.peek() != null + && ast.equals(lambdaParameters.peek().enclosingLambda)) { + + final Optional unusedLambdaParameter = + Optional.ofNullable(lambdaParameters.peek()) + .filter(parameter -> !parameter.isUsed()) + .filter(parameter -> !"_".equals(parameter.getName())); + + unusedLambdaParameter.ifPresent(parameter -> { + log(parameter.getIdentifierAst(), + MSG_UNUSED_LAMBDA_PARAMETER, + parameter.getName()); + }); + lambdaParameters.pop(); + } + } + + /** + * Visit ast of type {@link TokenTypes#IDENT} + * and check if it is a candidate for a lambda parameter identifier. + * + * @param identifierAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} could be a lambda parameter identifier + */ + private static boolean isLambdaParameterIdentifierCandidate(DetailAST identifierAst) { + // we should ignore the ident if it is in the lambda parameters declaration + final boolean isLambdaParameterDeclaration = + identifierAst.getParent().getType() == TokenTypes.LAMBDA + || identifierAst.getParent().getType() == TokenTypes.PARAMETER_DEF; + + return !isLambdaParameterDeclaration + && (hasValidParentToken(identifierAst) || isMethodInvocation(identifierAst)); + } + + /** + * Check if the given {@link TokenTypes#IDENT} has a valid parent token. + * A valid parent token is a token that can be a parent for a lambda parameter identifier. + * + * @param identifierAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} has a valid parent token + */ + private static boolean hasValidParentToken(DetailAST identifierAst) { + return !TokenUtil.isOfType(identifierAst.getParent(), INVALID_LAMBDA_PARAM_IDENT_PARENTS); + } + + /** + * Check if the given {@link TokenTypes#IDENT} is a child of a dot operator + * and is a candidate for lambda parameter. + * + * @param identAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} is a child of a dot operator + * and a candidate for lambda parameter. + */ + private static boolean isMethodInvocation(DetailAST identAst) { + final DetailAST parent = identAst.getParent(); + return parent.getType() == TokenTypes.DOT + && identAst.equals(parent.getFirstChild()); + } + + /** + * Check if the given {@link TokenTypes#IDENT} is a left hand side value. + * + * @param identAst token representing {@link TokenTypes#IDENT} + * @return true if the given {@link TokenTypes#IDENT} is a left hand side value. + */ + private static boolean isLeftHandOfAssignment(DetailAST identAst) { + final DetailAST parent = identAst.getParent(); + return parent.getType() == TokenTypes.ASSIGN + && !identAst.equals(parent.getLastChild()); + } + + /** + * Maintains information about the lambda parameter. + */ + private static final class LambdaParameterDetails { + + /** + * Ast of type {@link TokenTypes#LAMBDA} enclosing the lambda + * parameter. + */ + private final DetailAST enclosingLambda; + + /** + * Ast of type {@link TokenTypes#IDENT} of the given + * lambda parameter. + */ + private final DetailAST identifierAst; + + /** + * Is the variable used. + */ + private boolean used; + + /** + * Create a new lambda parameter instance. + * + * @param enclosingLambda ast of type {@link TokenTypes#LAMBDA} + * @param identifierAst ast of type {@link TokenTypes#IDENT} + */ + private LambdaParameterDetails(DetailAST enclosingLambda, DetailAST identifierAst) { + this.enclosingLambda = enclosingLambda; + this.identifierAst = identifierAst; + } + + /** + * Register the lambda parameter as used. + */ + private void registerAsUsed() { + used = true; + } + + /** + * Get the name of the lambda parameter. + * + * @return the name of the lambda parameter + */ + private String getName() { + return identifierAst.getText(); + } + + /** + * Get ast of type {@link TokenTypes#IDENT} of the given + * lambda parameter. + * + * @return ast of type {@link TokenTypes#IDENT} of the given lambda parameter + */ + private DetailAST getIdentifierAst() { + return identifierAst; + } + + /** + * Check if the lambda parameter is used. + * + * @return true if the lambda parameter is used + */ + private boolean isUsed() { + return used; + } + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java index 28e8c1fa1b4..0c8be5b4427 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/UnusedLocalVariableCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -51,6 +51,15 @@ * components are classified as different kind of variables by * JLS. *

            + *
              + *
            • + * Property {@code allowUnnamedVariables} - Allow variables named with a single underscore + * (known as + * unnamed variables in Java 21+). + * Type is {@code boolean}. + * Default value is {@code true}. + *
            • + *
            *

            * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

            @@ -61,6 +70,9 @@ *
          • * {@code unused.local.var} *
          • + *
          • + * {@code unused.named.local.var} + *
          • *
          * * @since 9.3 @@ -74,6 +86,12 @@ public class UnusedLocalVariableCheck extends AbstractCheck { */ public static final String MSG_UNUSED_LOCAL_VARIABLE = "unused.local.var"; + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_UNUSED_NAMED_LOCAL_VARIABLE = "unused.named.local.var"; + /** * An array of increment and decrement tokens. */ @@ -120,7 +138,7 @@ public class UnusedLocalVariableCheck extends AbstractCheck { /** * An array of blocks in which local anon inner classes can exist. */ - private static final int[] CONTAINERS_FOR_ANON_INNERS = { + private static final int[] ANONYMOUS_CLASS_PARENT_TOKENS = { TokenTypes.METHOD_DEF, TokenTypes.CTOR_DEF, TokenTypes.STATIC_INIT, @@ -128,6 +146,21 @@ public class UnusedLocalVariableCheck extends AbstractCheck { TokenTypes.COMPACT_CTOR_DEF, }; + /** + * An array of token types that indicate a variable is being used within + * an expression involving increment or decrement operators, or within a switch statement. + * When a token of one of these types is the parent of an expression, it indicates that the + * variable associated with the increment or decrement operation is being used. + * Ex:- TokenTypes.LITERAL_SWITCH: Indicates a switch statement. Variables used within the + * switch expression are considered to be used + */ + private static final int[] INCREMENT_DECREMENT_VARIABLE_USAGE_TYPES = { + TokenTypes.ELIST, + TokenTypes.INDEX_OP, + TokenTypes.ASSIGN, + TokenTypes.LITERAL_SWITCH, + }; + /** Package separator. */ private static final String PACKAGE_SEPARATOR = "."; @@ -155,11 +188,18 @@ public class UnusedLocalVariableCheck extends AbstractCheck { private final Map anonInnerAstToTypeDeclDesc = new HashMap<>(); /** - * Set of tokens of type {@link UnusedLocalVariableCheck#CONTAINERS_FOR_ANON_INNERS} + * Set of tokens of type {@link UnusedLocalVariableCheck#ANONYMOUS_CLASS_PARENT_TOKENS} * and {@link TokenTypes#LAMBDA} in some cases. */ private final Set anonInnerClassHolders = new HashSet<>(); + /** + * Allow variables named with a single underscore + * (known as + * unnamed variables in Java 21+). + */ + private boolean allowUnnamedVariables = true; + /** * Name of the package. */ @@ -170,6 +210,18 @@ public class UnusedLocalVariableCheck extends AbstractCheck { */ private int depth; + /** + * Setter to allow variables named with a single underscore + * (known as + * unnamed variables in Java 21+). + * + * @param allowUnnamedVariables true or false. + * @since 10.18.0 + */ + public void setAllowUnnamedVariables(boolean allowUnnamedVariables) { + this.allowUnnamedVariables = allowUnnamedVariables; + } + @Override public int[] getDefaultTokens() { return new int[] { @@ -223,7 +275,7 @@ public void visitToken(DetailAST ast) { if (type == TokenTypes.DOT) { visitDotToken(ast, variables); } - else if (type == TokenTypes.VARIABLE_DEF) { + else if (type == TokenTypes.VARIABLE_DEF && !skipUnnamedVariables(ast)) { visitVariableDefToken(ast); } else if (type == TokenTypes.IDENT) { @@ -232,8 +284,8 @@ else if (type == TokenTypes.IDENT) { else if (isInsideLocalAnonInnerClass(ast)) { visitLocalAnonInnerClass(ast); } - else if (TokenUtil.isTypeDeclaration(type)) { - visitTypeDeclarationToken(ast); + else if (isNonLocalTypeDeclaration(ast)) { + visitNonLocalTypeDeclarationToken(ast); } else if (type == TokenTypes.PACKAGE_DEF) { packageName = CheckUtil.extractQualifiedName(ast.getFirstChild().getNextSibling()); @@ -263,7 +315,10 @@ else if (isNonLocalTypeDeclaration(ast)) { private static void visitDotToken(DetailAST dotAst, Deque variablesStack) { if (dotAst.getParent().getType() != TokenTypes.LITERAL_NEW && shouldCheckIdentTokenNestedUnderDot(dotAst)) { - checkIdentifierAst(dotAst.findFirstToken(TokenTypes.IDENT), variablesStack); + final DetailAST identifier = dotAst.findFirstToken(TokenTypes.IDENT); + if (identifier != null) { + checkIdentifierAst(identifier, variablesStack); + } } } @@ -301,18 +356,16 @@ private static void visitIdentToken(DetailAST identAst, Deque vari } /** - * Visit the type declaration token. + * Visit the non-local type declaration token. * * @param typeDeclAst type declaration ast */ - private void visitTypeDeclarationToken(DetailAST typeDeclAst) { - if (isNonLocalTypeDeclaration(typeDeclAst)) { - final String qualifiedName = getQualifiedTypeDeclarationName(typeDeclAst); - final TypeDeclDesc currTypeDecl = new TypeDeclDesc(qualifiedName, depth, typeDeclAst); - depth++; - typeDeclarations.push(currTypeDecl); - typeDeclAstToTypeDeclDesc.put(typeDeclAst, currTypeDecl); - } + private void visitNonLocalTypeDeclarationToken(DetailAST typeDeclAst) { + final String qualifiedName = getQualifiedTypeDeclarationName(typeDeclAst); + final TypeDeclDesc currTypeDecl = new TypeDeclDesc(qualifiedName, depth, typeDeclAst); + depth++; + typeDeclarations.push(currTypeDecl); + typeDeclAstToTypeDeclDesc.put(typeDeclAst, currTypeDecl); } /** @@ -325,6 +378,18 @@ private void visitLocalAnonInnerClass(DetailAST literalNewAst) { anonInnerClassHolders.add(getBlockContainingLocalAnonInnerClass(literalNewAst)); } + /** + * Check for skip current {@link TokenTypes#VARIABLE_DEF} + * due to allowUnnamedVariable option. + * + * @param varDefAst varDefAst variable to check + * @return true if the current variable should be skipped. + */ + private boolean skipUnnamedVariables(DetailAST varDefAst) { + final DetailAST ident = varDefAst.findFirstToken(TokenTypes.IDENT); + return allowUnnamedVariables && "_".equals(ident.getText()); + } + /** * Whether ast node of type {@link TokenTypes#LITERAL_NEW} is a part of a local * anonymous inner class. @@ -360,7 +425,12 @@ private void logViolations(DetailAST scopeAst, Deque variablesStac if (!variableDesc.isUsed() && !variableDesc.isInstVarOrClassVar()) { final DetailAST typeAst = variableDesc.getTypeAst(); - log(typeAst, MSG_UNUSED_LOCAL_VARIABLE, variableDesc.getName()); + if (allowUnnamedVariables) { + log(typeAst, MSG_UNUSED_NAMED_LOCAL_VARIABLE, variableDesc.getName()); + } + else { + log(typeAst, MSG_UNUSED_LOCAL_VARIABLE, variableDesc.getName()); + } } } } @@ -397,16 +467,19 @@ private static boolean isNonLocalTypeDeclaration(DetailAST typeDeclAst) { private static DetailAST getBlockContainingLocalAnonInnerClass(DetailAST literalNewAst) { DetailAST currentAst = literalNewAst; DetailAST result = null; - while (!TokenUtil.isOfType(currentAst, CONTAINERS_FOR_ANON_INNERS)) { - if (currentAst.getType() == TokenTypes.LAMBDA - && currentAst.getParent() - .getParent().getParent().getType() == TokenTypes.OBJBLOCK) { - result = currentAst; - break; + DetailAST topMostLambdaAst = null; + while (currentAst != null && !TokenUtil.isOfType(currentAst, + ANONYMOUS_CLASS_PARENT_TOKENS)) { + if (currentAst.getType() == TokenTypes.LAMBDA) { + topMostLambdaAst = currentAst; } currentAst = currentAst.getParent(); result = currentAst; } + + if (currentAst == null) { + result = topMostLambdaAst; + } return result; } @@ -420,14 +493,15 @@ private static DetailAST getBlockContainingLocalAnonInnerClass(DetailAST literal private static void addLocalVariables(DetailAST varDefAst, Deque variablesStack) { final DetailAST parentAst = varDefAst.getParent(); final DetailAST grandParent = parentAst.getParent(); - final boolean isInstanceVarInAnonymousInnerClass = - grandParent.getType() == TokenTypes.LITERAL_NEW; - if (isInstanceVarInAnonymousInnerClass + final boolean isInstanceVarInInnerClass = + grandParent.getType() == TokenTypes.LITERAL_NEW + || grandParent.getType() == TokenTypes.CLASS_DEF; + if (isInstanceVarInInnerClass || parentAst.getType() != TokenTypes.OBJBLOCK) { final DetailAST ident = varDefAst.findFirstToken(TokenTypes.IDENT); final VariableDesc desc = new VariableDesc(ident.getText(), varDefAst.findFirstToken(TokenTypes.TYPE), findScopeOfVariable(varDefAst)); - if (isInstanceVarInAnonymousInnerClass) { + if (isInstanceVarInInnerClass) { desc.registerAsInstOrClassVar(); } variablesStack.push(desc); @@ -480,7 +554,7 @@ private TypeDeclDesc getSuperClassOfAnonInnerClass(DetailAST literalNewAst) { }) .findFirst(); if (classWithCompletePackageName.isPresent()) { - obtainedClass = classWithCompletePackageName.get(); + obtainedClass = classWithCompletePackageName.orElseThrow(); } } else { @@ -517,14 +591,14 @@ private void modifyVariablesStack(TypeDeclDesc obtainedClass, * Checks if there is a type declaration with same name as the super class. * * @param superClassName name of the super class - * @return true if there is another type declaration with same name. + * @return list if there is another type declaration with same name. */ private List typeDeclWithSameName(String superClassName) { return typeDeclAstToTypeDeclDesc.values().stream() .filter(typeDeclDesc -> { return hasSameNameAsSuperClass(superClassName, typeDeclDesc); }) - .collect(Collectors.toList()); + .collect(Collectors.toUnmodifiableList()); } /** @@ -748,8 +822,7 @@ private static boolean isStandAloneIncrementOrDecrement(DetailAST identAst) { * @return true if variable nested in exprAst is used */ private static boolean isIncrementOrDecrementVariableUsed(DetailAST exprAst) { - return TokenUtil.isOfType(exprAst.getParent(), - TokenTypes.ELIST, TokenTypes.INDEX_OP, TokenTypes.ASSIGN) + return TokenUtil.isOfType(exprAst.getParent(), INCREMENT_DECREMENT_VARIABLE_USAGE_TYPES) && exprAst.getParent().getParent().getType() != TokenTypes.FOR_ITERATOR; } @@ -962,7 +1035,7 @@ public DetailAST getTypeDeclAst() { * @return copy of variables in instanceAndClassVar stack with updated scope. */ public Deque getUpdatedCopyOfVarStack(DetailAST literalNewAst) { - final DetailAST updatedScope = literalNewAst.getLastChild(); + final DetailAST updatedScope = literalNewAst; final Deque instAndClassVarDeque = new ArrayDeque<>(); instanceAndClassVarStack.forEach(instVar -> { final VariableDesc variableDesc = new VariableDesc(instVar.getName(), diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java index fa01f9034e0..a5d777e2225 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/VariableDeclarationUsageDistanceCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -47,6 +47,11 @@ * Default value is {@code 3}. *
        • *
        • + * Property {@code ignoreFinal} - Allow to ignore variables with a 'final' modifier. + * Type is {@code boolean}. + * Default value is {@code true}. + *
        • + *
        • * Property {@code ignoreVariablePattern} - Define RegExp to ignore distance calculation * for variables listed in this pattern. * Type is {@code java.util.regex.Pattern}. @@ -58,11 +63,6 @@ * Type is {@code boolean}. * Default value is {@code false}. *
        • - *
        • - * Property {@code ignoreFinal} - Allow to ignore variables with a 'final' modifier. - * Type is {@code boolean}. - * Default value is {@code true}. - *
        • *
        *

        * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} @@ -306,7 +306,7 @@ private static Entry calculateDistanceInSingleScope( while (!firstUsageFound && currentAst != null) { if (currentAst.getFirstChild() != null) { if (isChild(currentAst, variableIdentAst)) { - dist = getDistToVariableUsageInChildNode(currentAst, variableIdentAst, dist); + dist = getDistToVariableUsageInChildNode(currentAst, dist); variableUsageAst = currentAst; firstUsageFound = true; } @@ -324,11 +324,10 @@ else if (currentAst.getType() != TokenTypes.VARIABLE_DEF) { * Returns the distance to variable usage for in the child node. * * @param childNode child node. - * @param varIdent variable variable identifier. * @param currentDistToVarUsage current distance to the variable usage. * @return the distance to variable usage for in the child node. */ - private static int getDistToVariableUsageInChildNode(DetailAST childNode, DetailAST varIdent, + private static int getDistToVariableUsageInChildNode(DetailAST childNode, int currentDistToVarUsage) { DetailAST examineNode = childNode; if (examineNode.getType() == TokenTypes.LABELED_STAT) { @@ -336,6 +335,7 @@ private static int getDistToVariableUsageInChildNode(DetailAST childNode, Detail } int resultDist = currentDistToVarUsage; + switch (examineNode.getType()) { case TokenTypes.SLIST: resultDist = 0; @@ -345,17 +345,12 @@ private static int getDistToVariableUsageInChildNode(DetailAST childNode, Detail case TokenTypes.LITERAL_DO: case TokenTypes.LITERAL_IF: case TokenTypes.LITERAL_SWITCH: - if (isVariableInOperatorExpr(examineNode, varIdent)) { - resultDist++; - } - else { - // variable usage is in inner scope - // reset counters, because we can't determine distance - resultDist = 0; - } + // variable usage is in inner scope, treated as 1 block + // or in operator expression, then distance + 1 + resultDist++; break; default: - if (examineNode.findFirstToken(TokenTypes.SLIST) == null) { + if (childNode.findFirstToken(TokenTypes.SLIST) == null) { resultDist++; } else { @@ -708,22 +703,6 @@ private static boolean isVariableInOperatorExpr( ast = ast.getNextSibling(); } - // Variable may be met in ELSE declaration - // So, check variable usage in these declarations. - if (!isVarInOperatorDeclaration) { - final DetailAST elseBlock = operator.getLastChild(); - - if (elseBlock.getType() == TokenTypes.LITERAL_ELSE) { - // Get IF followed by ELSE - final DetailAST firstNodeInsideElseBlock = elseBlock.getFirstChild(); - - if (firstNodeInsideElseBlock.getType() == TokenTypes.LITERAL_IF) { - isVarInOperatorDeclaration = - isVariableInOperatorExpr(firstNodeInsideElseBlock, variable); - } - } - } - return isVarInOperatorDeclaration; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/WhenShouldBeUsedCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/WhenShouldBeUsedCheck.java new file mode 100644 index 00000000000..18cc4ead475 --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/WhenShouldBeUsedCheck.java @@ -0,0 +1,183 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.coding; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +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.TokenUtil; + +/** + *

        + * Ensures that {@code when} is used instead of a single {@code if} + * statement inside a case block. + *

        + *

        + * Rationale: Java 21 has introduced enhancements for switch statements and expressions + * that allow the use of patterns in case labels. The {@code when} keyword is used to specify + * condition for a case label, also called as guarded case labels. This syntax is more readable + * and concise than the single {@code if} statement inside the pattern match block. + *

        + *

        + * See the + * Java Language Specification for more information about guarded case labels. + *

        + *

        + * See the + * Java Language Specification for more information about patterns. + *

        + *

        + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

        + *

        + * Violation Message Keys: + *

        + *
          + *
        • + * {@code when.should.be.used} + *
        • + *
        + * + * @since 10.18.0 + */ + +@StatelessCheck +public class WhenShouldBeUsedCheck extends AbstractCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_KEY = "when.should.be.used"; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] {TokenTypes.LITERAL_CASE}; + } + + @Override + public void visitToken(DetailAST ast) { + final boolean hasPatternLabel = hasPatternLabel(ast); + final DetailAST statementList = getStatementList(ast); + // until https://github.com/checkstyle/checkstyle/issues/15270 + final boolean isInSwitchRule = ast.getParent().getType() == TokenTypes.SWITCH_RULE; + + if (hasPatternLabel && statementList != null && isInSwitchRule) { + final List blockStatements = getBlockStatements(statementList); + + final boolean hasAcceptableStatementsOnly = blockStatements.stream() + .allMatch(WhenShouldBeUsedCheck::isAcceptableStatement); + + final boolean hasSingleIfWithNoElse = blockStatements.stream() + .filter(WhenShouldBeUsedCheck::isSingleIfWithNoElse) + .count() == 1; + + if (hasAcceptableStatementsOnly && hasSingleIfWithNoElse) { + log(ast, MSG_KEY); + } + } + } + + /** + * Get the statement list token of the case block. + * + * @param caseAST the AST node representing {@code LITERAL_CASE} + * @return the AST node representing {@code SLIST} of the current case + */ + private static DetailAST getStatementList(DetailAST caseAST) { + final DetailAST caseParent = caseAST.getParent(); + return caseParent.findFirstToken(TokenTypes.SLIST); + } + + /** + * Get all statements inside the case block. + * + * @param statementList the AST node representing {@code SLIST} of the current case + * @return statements inside the current case block + */ + private static List getBlockStatements(DetailAST statementList) { + final List blockStatements = new ArrayList<>(); + DetailAST ast = statementList.getFirstChild(); + while (ast != null) { + blockStatements.add(ast); + ast = ast.getNextSibling(); + } + return Collections.unmodifiableList(blockStatements); + } + + /** + * Check if the statement is an acceptable statement inside the case block. + * If these statements are the only ones in the case block, this case + * can be considered a violation. If at least one of the statements + * is not acceptable, this case can not be a violation. + * + * @param ast the AST node representing the statement + * @return true if the statement is an acceptable statement, false otherwise + */ + private static boolean isAcceptableStatement(DetailAST ast) { + final int[] acceptableChildrenOfSlist = { + TokenTypes.LITERAL_IF, + TokenTypes.LITERAL_BREAK, + TokenTypes.EMPTY_STAT, + TokenTypes.RCURLY, + }; + return TokenUtil.isOfType(ast, acceptableChildrenOfSlist); + } + + /** + * Check if the case block has a pattern variable definition + * or a record pattern definition. + * + * @param caseAST the AST node representing {@code LITERAL_CASE} + * @return true if the case block has a pattern label, false otherwise + */ + private static boolean hasPatternLabel(DetailAST caseAST) { + return caseAST.findFirstToken(TokenTypes.PATTERN_VARIABLE_DEF) != null + || caseAST.findFirstToken(TokenTypes.RECORD_PATTERN_DEF) != null + || caseAST.findFirstToken(TokenTypes.PATTERN_DEF) != null; + } + + /** + * Check if the case block statement is a single if statement with no else branch. + * + * @param statement statement to check inside the current case block + * @return true if the statement is a single if statement with no else branch, false otherwise + */ + private static boolean isSingleIfWithNoElse(DetailAST statement) { + return statement.getType() == TokenTypes.LITERAL_IF + && statement.findFirstToken(TokenTypes.LITERAL_ELSE) == null; + } + +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/package-info.java index ef59e218b90..4df044a7d1b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java index 79dc6430f5c..3532c23406f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -170,193 +170,6 @@ *
      • *
      *

      - * To configure the check: - *

      - *
      - * <module name="DesignForExtension"/>
      - * 
      - *

      Example:

      - *
      - * public abstract class Foo {
      - *   private int bar;
      - *
      - *   public int m1() {return 2;}  // Violation. No javadoc.
      - *
      - *   public int m2() {return 8;}  // Violation. No javadoc.
      - *
      - *   private void m3() {m4();}  // OK. Private method.
      - *
      - *   protected void m4() { }  // OK. No implementation.
      - *
      - *   public abstract void m5();  // OK. Abstract method.
      - *
      - *   /**
      - *    * This implementation ...
      - *    @return some int value.
      - *    */
      - *   public int m6() {return 1;}  // OK. Have javadoc on overridable method.
      - *
      - *   /**
      - *    * Some comments ...
      - *    */
      - *   public int m7() {return 1;}  // OK. Have javadoc on overridable method.
      - *
      - *   /**
      - *    * This
      - *    * implementation ...
      - *    */
      - *   public int m8() {return 2;}  // OK. Have javadoc on overridable method.
      - *
      - *   @Override
      - *   public String toString() {  // Violation. No javadoc for @Override method.
      - *     return "";
      - *   }
      - * }
      - * 
      - *

      - * To configure the check to allow methods which have @Override annotations - * to be designed for extension. - *

      - *
      - * <module name="DesignForExtension">
      - *   <property name="ignoredAnnotations" value="Override"/>
      - * </module>
      - * 
      - *

      Example:

      - *
      - * public abstract class Foo {
      - *   private int bar;
      - *
      - *   public int m1() {return 2;}  // Violation. No javadoc.
      - *
      - *   public int m2() {return 8;}  // Violation. No javadoc.
      - *
      - *   private void m3() {m4();}  // OK. Private method.
      - *
      - *   protected void m4() { }  // OK. No implementation.
      - *
      - *   public abstract void m5();  // OK. Abstract method.
      - *
      - *   /**
      - *    * This implementation ...
      - *    @return some int value.
      - *    */
      - *   public int m6() {return 1;}  // OK. Have javadoc on overridable method.
      - *
      - *   /**
      - *    * Some comments ...
      - *    */
      - *   public int m7() {return 1;}  // OK. Have javadoc on overridable method.
      - *
      - *   /**
      - *    * This
      - *    * implementation ...
      - *    */
      - *   public int m8() {return 2;}  // OK. Have javadoc on overridable method.
      - *
      - *   @Override
      - *   public String toString() {  // OK. Have javadoc on overridable method.
      - *     return "";
      - *   }
      - * }
      - * 
      - *

      - * To configure the check to allow methods which contain a specified comment text - * pattern in their javadoc to be designed for extension. - *

      - *
      - * <module name="DesignForExtension">
      - *   <property name="requiredJavadocPhrase" value="This implementation"/>
      - * </module>
      - * 
      - *

      Example:

      - *
      - * public abstract class Foo {
      - *   private int bar;
      - *
      - *   public int m1() {return 2;}  // Violation. No javadoc.
      - *
      - *   public int m2() {return 8;}  // Violation. No javadoc.
      - *
      - *   private void m3() {m4();}  // OK. Private method.
      - *
      - *   protected void m4() { }  // OK. No implementation.
      - *
      - *   public abstract void m5();  // OK. Abstract method.
      - *
      - *   /**
      - *    * This implementation ...
      - *    @return some int value.
      - *    */
      - *   public int m6() {return 1;}  // OK. Have required javadoc.
      - *
      - *   /**
      - *    * Some comments ...
      - *    */
      - *   public int m7() {return 1;}  // Violation. No required javadoc.
      - *
      - *   /**
      - *    * This
      - *    * implementation ...
      - *    */
      - *   public int m8() {return 2;}  // Violation. No required javadoc.
      - *
      - *   @Override
      - *   public String toString() {  // Violation. No required javadoc.
      - *     return "";
      - *   }
      - * }
      - * 
      - *

      - * To configure the check to allow methods which contain a specified comment text - * pattern in their javadoc which can span multiple lines - * to be designed for extension. - *

      - *
      - * <module name="DesignForExtension">
      - *   <property name="requiredJavadocPhrase"
      - *     value="This[\s\S]*implementation"/>
      - * </module>
      - * 
      - *

      Example:

      - *
      - * public abstract class Foo {
      - *   private int bar;
      - *
      - *   public int m1() {return 2;}  // Violation. No javadoc.
      - *
      - *   public int m2() {return 8;}  // Violation. No javadoc.
      - *
      - *   private void m3() {m4();}
      - *
      - *   protected void m4() { }  // OK. No implementation.
      - *
      - *   public abstract void m5();  // OK. Abstract method.
      - *
      - *   /**
      - *    * This implementation ...
      - *    @return some int value.
      - *    */
      - *   public int m6() {return 1;}  // OK. Have required javadoc.
      - *
      - *   /**
      - *    * Some comments ...
      - *    */
      - *   public int m7() {return 1;}  // Violation. No required javadoc.
      - *
      - *   /**
      - *    * This
      - *    * implementation ...
      - *    */
      - *   public int m8() {return 2;}  // OK. Have required javadoc.
      - *
      - *   @Override
      - *   public String toString() {  // Violation. No required javadoc.
      - *     return "";
      - *   }
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      @@ -383,7 +196,7 @@ 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()); + "BeforeClass", "AfterClass", }).collect(Collectors.toUnmodifiableSet()); /** * Specify the comment text pattern which qualifies a method as designed for extension. @@ -398,7 +211,8 @@ public class DesignForExtensionCheck extends AbstractCheck { * @since 7.2 */ public void setIgnoredAnnotations(String... ignoredAnnotations) { - this.ignoredAnnotations = Arrays.stream(ignoredAnnotations).collect(Collectors.toSet()); + this.ignoredAnnotations = Arrays.stream(ignoredAnnotations) + .collect(Collectors.toUnmodifiableSet()); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java index b009be953a8..4819241f99f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -63,55 +63,6 @@ * * *

      - * To configure the check: - *

      - *
      - * <module name="FinalClass"/>
      - * 
      - *

      - * Example: - *

      - *
      - * final class MyClass {  // OK
      - *   private MyClass() { }
      - * }
      - *
      - * class MyClass { // violation, class should be declared final
      - *   private MyClass() { }
      - * }
      - *
      - * class MyClass { // OK, since it has a public constructor
      - *   int field1;
      - *   String field2;
      - *   private MyClass(int value) {
      - *     this.field1 = value;
      - *     this.field2 = " ";
      - *   }
      - *   public MyClass(String value) {
      - *     this.field2 = value;
      - *     this.field1 = 0;
      - *   }
      - * }
      - *
      - * class TestAnonymousInnerClasses { // OK, class has an anonymous inner class.
      - *     public static final TestAnonymousInnerClasses ONE = new TestAnonymousInnerClasses() {
      - *
      - *     };
      - *
      - *     private TestAnonymousInnerClasses() {
      - *     }
      - * }
      - * class Class1 {
      - *
      - *     private class Class2 { // violation, class should be declared final
      - *     }
      - *
      - *     public class Class3 { // ok
      - *     }
      - *
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java index def6a93710a..795881b1ec9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/HideUtilityClassConstructorCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -52,46 +52,6 @@ * } * *

      - * To configure the check: - *

      - *
      - * <module name="HideUtilityClassConstructor"/>
      - * 
      - *

      - * Example: - *

      - *
      - * class Test { // violation, class only has a static method and a constructor
      - *
      - *   public Test() {
      - *   }
      - *
      - *   public static void fun() {
      - *   }
      - * }
      - *
      - * class Foo { // OK
      - *
      - *   private Foo() {
      - *   }
      - *
      - *   static int n;
      - * }
      - *
      - * class Bar { // OK
      - *
      - *   protected Bar() {
      - *     // prevents calls from subclass
      - *     throw new UnsupportedOperationException();
      - *   }
      - * }
      - *
      - * class UtilityClass { // violation, class only has a static field
      - *
      - *   static float f;
      - * }
      - * 
      - *

      * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} *

      *

      @@ -202,7 +162,7 @@ private static final class Details { * C-tor. * * @param ast class ast - * */ + */ private Details(DetailAST ast) { this.ast = ast; } diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java index 6ec605ae82c..61d7561b684 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java index 6fc105dd43c..03d69938db8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InterfaceIsTypeCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.java index 9c189834412..057d7dc0296 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/MutableExceptionCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -50,12 +50,12 @@ *

      *
        *
      • - * Property {@code format} - Specify pattern for exception class names. + * Property {@code extendedClassNameFormat} - Specify pattern for extended class names. * Type is {@code java.util.regex.Pattern}. * Default value is {@code "^.*Exception$|^.*Error$|^.*Throwable$"}. *
      • *
      • - * Property {@code extendedClassNameFormat} - Specify pattern for extended class names. + * Property {@code format} - Specify pattern for exception class names. * Type is {@code java.util.regex.Pattern}. * Default value is {@code "^.*Exception$|^.*Error$|^.*Throwable$"}. *
      • diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java index 00023e4e324..191b1df7f67 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/OneTopLevelClassCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/SealedShouldHavePermitsListCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/SealedShouldHavePermitsListCheck.java new file mode 100644 index 00000000000..ab7348f0fab --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/SealedShouldHavePermitsListCheck.java @@ -0,0 +1,96 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.design; + +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; + +/** + *

        + * Checks that sealed classes and interfaces have a permits list. + *

        + *

        + * Rationale: When a permits clause is omitted from a sealed class, + * any class within the same compilation unit can extend it. This differs + * from other sealed classes where permitted subclasses are explicitly + * declared, making them readily visible to the reader. Without a permits + * clause, identifying potential subclasses requires searching the entire + * compilation unit, which can be challenging, especially in large files + * with complex class hierarchies. + *

        + *

        + * See the + * Java Language Specification for more information about sealed classes. + *

        + *

        + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

        + *

        + * Violation Message Keys: + *

        + *
          + *
        • + * {@code sealed.should.have.permits} + *
        • + *
        + * + * @since 10.18.0 + */ + +@StatelessCheck +public class SealedShouldHavePermitsListCheck extends AbstractCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_KEY = "sealed.should.have.permits"; + + @Override + public int[] getDefaultTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getAcceptableTokens() { + return getRequiredTokens(); + } + + @Override + public int[] getRequiredTokens() { + return new int[] { + TokenTypes.CLASS_DEF, + TokenTypes.INTERFACE_DEF, + }; + } + + @Override + public void visitToken(DetailAST ast) { + final DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS); + final boolean isSealed = modifiers.findFirstToken(TokenTypes.LITERAL_SEALED) != null; + final boolean hasPermitsList = ast.findFirstToken(TokenTypes.PERMITS_CLAUSE) != null; + + if (isSealed && !hasPermitsList) { + log(ast, MSG_KEY); + } + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java index cc69296d0e2..a0eca7caf77 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/ThrowsCountCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -55,15 +55,15 @@ *

        *
          *
        • - * Property {@code max} - Specify maximum allowed number of throws statements. - * Type is {@code int}. - * Default value is {@code 4}. - *
        • - *
        • * Property {@code ignorePrivateMethods} - Allow private methods to be ignored. * Type is {@code boolean}. * Default value is {@code true}. *
        • + *
        • + * Property {@code max} - Specify maximum allowed number of throws statements. + * Type is {@code int}. + * Default value is {@code 4}. + *
        • *
        *

        * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java index 1d8b9e9c04c..e7a9a4b73ad 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -105,21 +105,6 @@ *

        *
          *
        • - * Property {@code packageAllowed} - Control whether package visible members are allowed. - * Type is {@code boolean}. - * Default value is {@code false}. - *
        • - *
        • - * Property {@code protectedAllowed} - Control whether protected members are allowed. - * Type is {@code boolean}. - * Default value is {@code false}. - *
        • - *
        • - * Property {@code publicMemberPattern} - Specify pattern for public members that should be ignored. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code "^serialVersionUID$"}. - *
        • - *
        • * Property {@code allowPublicFinalFields} - Allow final fields to be declared as public. * Type is {@code boolean}. * Default value is {@code false}. @@ -131,6 +116,13 @@ * Default value is {@code false}. *
        • *
        • + * Property {@code ignoreAnnotationCanonicalNames} - Specify annotations canonical + * names which ignore variables in consideration. + * Type is {@code java.lang.String[]}. + * Default value is {@code com.google.common.annotations.VisibleForTesting, + * org.junit.ClassRule, org.junit.Rule}. + *
        • + *
        • * Property {@code immutableClassCanonicalNames} - Specify immutable classes canonical names. * Type is {@code java.lang.String[]}. * Default value is {@code java.io.File, java.lang.Boolean, java.lang.Byte, @@ -140,11 +132,19 @@ * java.net.InetSocketAddress, java.net.URI, java.net.URL, java.util.Locale, java.util.UUID}. *
        • *
        • - * Property {@code ignoreAnnotationCanonicalNames} - Specify annotations canonical - * names which ignore variables in consideration. - * Type is {@code java.lang.String[]}. - * Default value is {@code com.google.common.annotations.VisibleForTesting, - * org.junit.ClassRule, org.junit.Rule}. + * Property {@code packageAllowed} - Control whether package visible members are allowed. + * Type is {@code boolean}. + * Default value is {@code false}. + *
        • + *
        • + * Property {@code protectedAllowed} - Control whether protected members are allowed. + * Type is {@code boolean}. + * Default value is {@code false}. + *
        • + *
        • + * Property {@code publicMemberPattern} - Specify pattern for public members that should be ignored. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code "^serialVersionUID$"}. *
        • *
        *

        diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/package-info.java index bbcaee9f4cc..37b36c9adbf 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java index ddf463d5147..c145a7e9dae 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/AbstractHeaderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -29,7 +29,6 @@ import java.nio.charset.Charset; import java.nio.charset.UnsupportedCharsetException; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Set; import java.util.regex.Pattern; @@ -77,7 +76,7 @@ protected List getHeaderLines() { } /** - * Setter to specify the charset to use when reading the headerFile. + * Setter to specify the character encoding to use when reading the headerFile. * * @param charset the charset name to use for loading the header from a file */ @@ -86,7 +85,7 @@ public void setCharset(String charset) { } /** - * Setter to specify the name of the file containing the required header.. + * Setter to specify the name of the file containing the required header. * * @param uri the uri of the header to load. * @throws CheckstyleException if fileName is empty. @@ -147,8 +146,9 @@ private static Charset createCharset(String name) { } /** - * Set the header to check against. Individual lines in the header - * must be separated by '\n' characters. + * Specify the required header specified inline. + * Individual header lines must be separated by the string + * {@code "\n"}(even on platforms with a different line separator). * * @param header header content to check against. * @throws IllegalArgumentException if the header cannot be interpreted @@ -200,10 +200,10 @@ public Set getExternalResourceLocations() { final Set result; if (headerFile == null) { - result = Collections.emptySet(); + result = Set.of(); } else { - result = Collections.singleton(headerFile.toString()); + result = Set.of(headerFile.toASCIIString()); } return result; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java index f188900eca0..d0b3a4feac1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/HeaderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -55,31 +55,31 @@ *

        *
          *
        • - * Property {@code headerFile} - Specify the name of the file containing the required header. - * Type is {@code java.net.URI}. - * Default value is {@code null}. - *
        • - *
        • * Property {@code charset} - Specify the character encoding to use when reading the headerFile. * Type is {@code java.lang.String}. * Default value is {@code the charset property of the parent * Checker module}. *
        • *
        • + * Property {@code fileExtensions} - Specify the file extensions of the files to process. + * Type is {@code java.lang.String[]}. + * Default value is {@code ""}. + *
        • + *
        • * Property {@code header} - Specify the required header specified inline. * Individual header lines must be separated by the string {@code "\n"} - * (even on platforms with a different line separator), see examples below. + * (even on platforms with a different line separator). * Type is {@code java.lang.String}. * Default value is {@code null}. *
        • *
        • - * Property {@code ignoreLines} - Specify the line numbers to ignore. - * Type is {@code int[]}. - * Default value is {@code ""}. + * Property {@code headerFile} - Specify the name of the file containing the required header. + * Type is {@code java.net.URI}. + * Default value is {@code null}. *
        • *
        • - * Property {@code fileExtensions} - Specify the file type extension of files to process. - * Type is {@code java.lang.String[]}. + * Property {@code ignoreLines} - Specify the line numbers to ignore. + * Type is {@code int[]}. * Default value is {@code ""}. *
        • *
        diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java index d5c509f17d1..231b6d95156 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/RegexpHeaderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -98,17 +98,17 @@ *

        *
          *
        • - * Property {@code headerFile} - Specify the name of the file containing the required header. - * Type is {@code java.net.URI}. - * Default value is {@code null}. - *
        • - *
        • * Property {@code charset} - Specify the character encoding to use when reading the headerFile. * Type is {@code java.lang.String}. * Default value is {@code the charset property of the parent * Checker module}. *
        • *
        • + * Property {@code fileExtensions} - Specify the file extensions of the files to process. + * Type is {@code java.lang.String[]}. + * Default value is {@code ""}. + *
        • + *
        • * Property {@code header} - Define the required header specified inline. * Individual header lines must be separated by the string {@code "\n"} * (even on platforms with a different line separator). @@ -119,13 +119,13 @@ * Default value is {@code null}. *
        • *
        • - * Property {@code multiLines} - Specify the line numbers to repeat (zero or more times). - * Type is {@code int[]}. - * Default value is {@code ""}. + * Property {@code headerFile} - Specify the name of the file containing the required header. + * Type is {@code java.net.URI}. + * Default value is {@code null}. *
        • *
        • - * Property {@code fileExtensions} - Specify the file type extension of files to process. - * Type is {@code java.lang.String[]}. + * Property {@code multiLines} - Specify the line numbers to repeat (zero or more times). + * Type is {@code int[]}. * Default value is {@code ""}. *
        • *
        diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/package-info.java index 2b8d4149d6a..aa12aafda1d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/header/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportControl.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportControl.java index 1736fedc544..41b6faec12d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportControl.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportControl.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportRule.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportRule.java index 9f33b3e92a3..e1ba16ccf41 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportRule.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AbstractImportRule.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AccessResult.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AccessResult.java index b2b18643374..a08dd9b66d7 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AccessResult.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AccessResult.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java index 26db0a1319e..1f75d9bb981 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -44,12 +44,6 @@ *

        *
          *
        • - * Property {@code excludes} - Specify packages where starred class imports are - * allowed and classes where starred static member imports are allowed. - * Type is {@code java.lang.String[]}. - * Default value is {@code ""}. - *
        • - *
        • * Property {@code allowClassImports} - Control whether to allow starred class * imports like {@code import java.util.*;}. * Type is {@code boolean}. @@ -61,6 +55,12 @@ * Type is {@code boolean}. * Default value is {@code false}. *
        • + *
        • + * Property {@code excludes} - Specify packages where starred class imports are + * allowed and classes where starred static member imports are allowed. + * Type is {@code java.lang.String[]}. + * Default value is {@code ""}. + *
        • *
        *

        * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java index 4b2be599602..fb4f1066285 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStaticImportCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.java index 8abd84514f4..43f3b2bb638 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ClassImportRule.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java index 52c99a6860f..2efcd676aeb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.imports; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.StringTokenizer; import java.util.regex.Matcher; @@ -82,7 +83,11 @@ * * *

        - * Use the separator '###' between rules. + * Rules are configured as a comma-separated ordered list. + *

        + *

        + * Note: '###' group separator is deprecated (in favor of a comma-separated list), + * but is currently supported for backward compatibility. *

        *

        * To set RegExps for THIRD_PARTY_PACKAGE and STANDARD_JAVA_PACKAGE groups use @@ -135,20 +140,21 @@ *

        *
          *
        • - * Property {@code customImportOrderRules} - Specify format of order declaration - * customizing by user. - * Type is {@code java.lang.String}. + * Property {@code customImportOrderRules} - Specify ordered list of import groups. + * Type is {@code java.lang.String[]}. * Default value is {@code ""}. *
        • *
        • - * Property {@code standardPackageRegExp} - Specify RegExp for STANDARD_JAVA_PACKAGE group imports. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code "^(java|javax)\."}. + * Property {@code separateLineBetweenGroups} - Force empty line separator between + * import groups. + * Type is {@code boolean}. + * Default value is {@code true}. *
        • *
        • - * Property {@code thirdPartyPackageRegExp} - Specify RegExp for THIRD_PARTY_PACKAGE group imports. - * Type is {@code java.util.regex.Pattern}. - * Default value is {@code ".*"}. + * Property {@code sortImportsInGroupAlphabetically} - Force grouping alphabetically, + * in ASCII sort order. + * Type is {@code boolean}. + * Default value is {@code false}. *
        • *
        • * Property {@code specialImportsRegExp} - Specify RegExp for SPECIAL_IMPORTS group imports. @@ -156,16 +162,14 @@ * Default value is {@code "^$"}. *
        • *
        • - * Property {@code separateLineBetweenGroups} - Force empty line separator between - * import groups. - * Type is {@code boolean}. - * Default value is {@code true}. + * Property {@code standardPackageRegExp} - Specify RegExp for STANDARD_JAVA_PACKAGE group imports. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code "^(java|javax)\."}. *
        • *
        • - * Property {@code sortImportsInGroupAlphabetically} - Force grouping alphabetically, - * in ASCII sort order. - * Type is {@code boolean}. - * Default value is {@code false}. + * Property {@code thirdPartyPackageRegExp} - Specify RegExp for THIRD_PARTY_PACKAGE group imports. + * Type is {@code java.util.regex.Pattern}. + * Default value is {@code ".*"}. *
        • *
        *

        @@ -257,11 +261,8 @@ public class CustomImportOrderCheck extends AbstractCheck { /** Pattern used to separate groups of imports. */ private static final Pattern GROUP_SEPARATOR_PATTERN = Pattern.compile("\\s*###\\s*"); - /** Specify format of order declaration customizing by user. */ - private static final String DEFAULT_CUSTOM_IMPORT_ORDER_RULES = ""; - - /** Processed list of import order rules. */ - private final List customOrderRules = new ArrayList<>(); + /** Specify ordered list of import groups. */ + private final List customImportOrderRules = new ArrayList<>(); /** Contains objects with import attributes. */ private final List importToGroupList = new ArrayList<>(); @@ -347,19 +348,19 @@ public final void setSortImportsInGroupAlphabetically(boolean value) { } /** - * Setter to specify format of order declaration customizing by user. + * Setter to specify ordered list of import groups. * - * @param inputCustomImportOrder + * @param rules * user value. * @since 5.8 */ - public final void setCustomImportOrderRules(final String inputCustomImportOrder) { - if (!DEFAULT_CUSTOM_IMPORT_ORDER_RULES.equals(inputCustomImportOrder)) { - for (String currentState : GROUP_SEPARATOR_PATTERN.split(inputCustomImportOrder)) { - addRulesToList(currentState); - } - customOrderRules.add(NON_GROUP_RULE_GROUP); - } + public final void setCustomImportOrderRules(String... rules) { + Arrays.stream(rules) + .map(GROUP_SEPARATOR_PATTERN::split) + .flatMap(Arrays::stream) + .forEach(this::addRulesToList); + + customImportOrderRules.add(NON_GROUP_RULE_GROUP); } @Override @@ -410,7 +411,7 @@ public void finishTree(DetailAST rootAST) { /** Examine the order of all the imports and log any violations. */ private void finishImportList() { String currentGroup = getFirstGroup(); - int currentGroupNumber = customOrderRules.lastIndexOf(currentGroup); + int currentGroupNumber = customImportOrderRules.lastIndexOf(currentGroup); ImportDetails previousImportObjectFromCurrentGroup = null; String previousImportFromCurrentGroup = null; @@ -432,13 +433,13 @@ private void finishImportList() { } else { // not the last group, last one is always NON_GROUP - if (customOrderRules.size() > currentGroupNumber + 1) { + if (customImportOrderRules.size() > currentGroupNumber + 1) { final String nextGroup = getNextImportGroup(currentGroupNumber + 1); if (importGroup.equals(nextGroup)) { validateMissedEmptyLine(previousImportObjectFromCurrentGroup, importObject, fullImportIdent); currentGroup = nextGroup; - currentGroupNumber = customOrderRules.lastIndexOf(nextGroup); + currentGroupNumber = customImportOrderRules.lastIndexOf(nextGroup); previousImportFromCurrentGroup = fullImportIdent; } else { @@ -584,13 +585,13 @@ else if (NON_GROUP_RULE_GROUP.equals(currentGroupNumber)) { private String getNextImportGroup(int currentGroupNumber) { int nextGroupNumber = currentGroupNumber; - while (customOrderRules.size() > nextGroupNumber + 1) { - if (hasAnyImportInCurrentGroup(customOrderRules.get(nextGroupNumber))) { + while (customImportOrderRules.size() > nextGroupNumber + 1) { + if (hasAnyImportInCurrentGroup(customImportOrderRules.get(nextGroupNumber))) { break; } nextGroupNumber++; } - return customOrderRules.get(nextGroupNumber); + return customImportOrderRules.get(nextGroupNumber); } /** @@ -623,11 +624,11 @@ private boolean hasAnyImportInCurrentGroup(String currentGroup) { */ private String getImportGroup(boolean isStatic, String importPath) { RuleMatchForImport bestMatch = new RuleMatchForImport(NON_GROUP_RULE_GROUP, 0, 0); - if (isStatic && customOrderRules.contains(STATIC_RULE_GROUP)) { + if (isStatic && customImportOrderRules.contains(STATIC_RULE_GROUP)) { bestMatch.group = STATIC_RULE_GROUP; bestMatch.matchLength = importPath.length(); } - else if (customOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) { + else if (customImportOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) { final String importPathTrimmedToSamePackageDepth = getFirstDomainsFromIdent(samePackageMatchingDepth, importPath); if (samePackageDomainsRegExp.equals(importPathTrimmedToSamePackageDepth)) { @@ -635,7 +636,7 @@ else if (customOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) { bestMatch.matchLength = importPath.length(); } } - for (String group : customOrderRules) { + for (String group : customImportOrderRules) { if (STANDARD_JAVA_PACKAGE_RULE_GROUP.equals(group)) { bestMatch = findBetterPatternMatch(importPath, STANDARD_JAVA_PACKAGE_RULE_GROUP, standardPackageRegExp, bestMatch); @@ -647,7 +648,7 @@ else if (customOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) { } if (NON_GROUP_RULE_GROUP.equals(bestMatch.group) - && customOrderRules.contains(THIRD_PARTY_PACKAGE_RULE_GROUP) + && customImportOrderRules.contains(THIRD_PARTY_PACKAGE_RULE_GROUP) && thirdPartyPackageRegExp.matcher(importPath).find()) { bestMatch.group = THIRD_PARTY_PACKAGE_RULE_GROUP; } @@ -766,7 +767,7 @@ private void addRulesToList(String ruleStr) { || THIRD_PARTY_PACKAGE_RULE_GROUP.equals(ruleStr) || STANDARD_JAVA_PACKAGE_RULE_GROUP.equals(ruleStr) || SPECIAL_IMPORTS_RULE_GROUP.equals(ruleStr)) { - customOrderRules.add(ruleStr); + customImportOrderRules.add(ruleStr); } else if (ruleStr.startsWith(SAME_PACKAGE_RULE_GROUP)) { final String rule = ruleStr.substring(ruleStr.indexOf('(') + 1, @@ -776,7 +777,7 @@ else if (ruleStr.startsWith(SAME_PACKAGE_RULE_GROUP)) { throw new IllegalArgumentException( "SAME_PACKAGE rule parameter should be positive integer: " + ruleStr); } - customOrderRules.add(SAME_PACKAGE_RULE_GROUP); + customImportOrderRules.add(SAME_PACKAGE_RULE_GROUP); } else { throw new IllegalStateException("Unexpected rule: " + ruleStr); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java index 0a41cc021b7..83b8273e1a8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/FileImportControl.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -43,26 +43,9 @@ class FileImportControl extends AbstractImportControl { */ /* package */ FileImportControl(PkgImportControl parent, String name, boolean regex) { super(parent, MismatchStrategy.DELEGATE_TO_PARENT); - this.regex = regex; - if (regex) { - this.name = encloseInGroup(name); - patternForExactMatch = createPatternForExactMatch(this.name); - } - else { - this.name = name; - patternForExactMatch = null; - } - } - - /** - * Enclose {@code expression} in a (non-capturing) group. - * - * @param expression the input regular expression - * @return a grouped pattern. - */ - private static String encloseInGroup(String expression) { - return "(?:" + expression + ")"; + this.name = name; + patternForExactMatch = createPatternForExactMatch(name); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java index 9a6902518a4..48c92fdba61 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/IllegalImportCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -43,14 +43,6 @@ *

        *
          *
        • - * Property {@code illegalPkgs} - Specify packages to reject, if regexp - * property is not set, checks if import is the part of package. If regexp - * property is set, then list of packages will be interpreted as regular expressions. - * Note, all properties for match will be used. - * Type is {@code java.lang.String[]}. - * Default value is {@code sun}. - *
        • - *
        • * Property {@code illegalClasses} - Specify class names to reject, if regexp * property is not set, checks if import equals class name. If regexp * property is set, then list of class names will be interpreted as regular expressions. @@ -59,6 +51,14 @@ * Default value is {@code ""}. *
        • *
        • + * Property {@code illegalPkgs} - Specify packages to reject, if regexp + * property is not set, checks if import is the part of package. If regexp + * property is set, then list of packages will be interpreted as regular expressions. + * Note, all properties for match will be used. + * Type is {@code java.lang.String[]}. + * Default value is {@code sun}. + *
        • + *
        • * Property {@code regexp} - Control whether the {@code illegalPkgs} and * {@code illegalClasses} should be interpreted as regular expressions. * Type is {@code boolean}. diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java index 3aa81ee0d70..faeb4b34f2a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,6 @@ package com.puppycrawl.tools.checkstyle.checks.imports; import java.net.URI; -import java.util.Collections; import java.util.Set; import java.util.regex.Pattern; @@ -253,7 +252,7 @@ else if (currentImportControl != null) { @Override public Set getExternalResourceLocations() { - return Collections.singleton(file.toString()); + return Set.of(file.toASCIIString()); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.java index b1737868519..ed5666405da 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportControlLoader.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java index 137b728e811..35c859dae37 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -28,6 +28,8 @@ 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 com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; /** *

          @@ -61,36 +63,44 @@ *

        *
          *
        • - * Property {@code option} - specify policy on the relative order between type imports and static - * imports. - * Type is {@code com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderOption}. - * Default value is {@code under}. + * Property {@code caseSensitive} - Control whether string comparison should be + * case-sensitive or not. Case-sensitive sorting is in + * ASCII sort order. + * It affects both type imports and static imports. + * Type is {@code boolean}. + * Default value is {@code true}. *
        • *
        • - * Property {@code groups} - specify list of type import groups. Every group identified + * Property {@code groups} - Specify list of type import groups. Every group identified * either by a common prefix string, or by a regular expression enclosed in forward slashes * (e.g. {@code /regexp/}). All type imports, which does not match any group, falls into an * additional group, located at the end. * Thus, the empty list of type groups (the default value) means one group for all type imports. - * Type is {@code java.util.regex.Pattern[]}. + * Type is {@code java.lang.String[]}. * Default value is {@code ""}. *
        • *
        • - * Property {@code ordered} - control whether type imports within each group should be + * Property {@code option} - Specify policy on the relative order between type imports and static + * imports. + * Type is {@code com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderOption}. + * Default value is {@code under}. + *
        • + *
        • + * Property {@code ordered} - Control whether type imports within each group should be * sorted. * It doesn't affect sorting for static imports. * Type is {@code boolean}. * Default value is {@code true}. *
        • *
        • - * Property {@code separated} - control whether type import groups should be separated + * Property {@code separated} - Control whether type import groups should be separated * by, at least, one blank line or comment and aren't separated internally. * It doesn't affect separations for static imports. * Type is {@code boolean}. * Default value is {@code false}. *
        • *
        • - * Property {@code separatedStaticGroups} - control whether static import groups should + * Property {@code separatedStaticGroups} - Control whether static import groups should * be separated by, at least, one blank line or comment and aren't separated internally. * This property has effect only when the property {@code option} is set to {@code top} * or {@code bottom} and when property {@code staticGroups} is enabled. @@ -98,31 +108,23 @@ * Default value is {@code false}. *
        • *
        • - * Property {@code caseSensitive} - control whether string comparison should be - * case-sensitive or not. Case-sensitive sorting is in - * ASCII sort order. - * It affects both type imports and static imports. + * Property {@code sortStaticImportsAlphabetically} - Control whether + * static imports located at top or bottom are sorted within the group. * Type is {@code boolean}. - * Default value is {@code true}. + * Default value is {@code false}. *
        • *
        • - * Property {@code staticGroups} - specify list of static import groups. Every group + * Property {@code staticGroups} - Specify list of static import groups. Every group * identified either by a common prefix string, or by a regular expression enclosed in forward * slashes (e.g. {@code /regexp/}). All static imports, which does not match any group, fall into * an additional group, located at the end. Thus, the empty list of static groups (the default * value) means one group for all static imports. This property has effect only when the property * {@code option} is set to {@code top} or {@code bottom}. - * Type is {@code java.util.regex.Pattern[]}. + * Type is {@code java.lang.String[]}. * Default value is {@code ""}. *
        • *
        • - * Property {@code sortStaticImportsAlphabetically} - control whether - * static imports located at top or bottom are sorted within the group. - * Type is {@code boolean}. - * Default value is {@code false}. - *
        • - *
        • - * Property {@code useContainerOrderingForStatic} - control whether to use container + * Property {@code useContainerOrderingForStatic} - Control whether to use container * ordering (Eclipse IDE term) for static imports or not. * Type is {@code boolean}. * Default value is {@code false}. @@ -186,7 +188,7 @@ public class ImportOrderCheck * located at the end. Thus, the empty list of type groups (the default value) means one group * for all type imports. */ - private Pattern[] groups = EMPTY_PATTERN_ARRAY; + private String[] groups = CommonUtil.EMPTY_STRING_ARRAY; /** * Specify list of static import groups. Every group identified either by a common prefix @@ -196,7 +198,7 @@ public class ImportOrderCheck * static imports. This property has effect only when the property {@code option} is set to * {@code top} or {@code bottom}. */ - private Pattern[] staticGroups = EMPTY_PATTERN_ARRAY; + private String[] staticGroups = CommonUtil.EMPTY_STRING_ARRAY; /** * Control whether type import groups should be separated by, at least, one blank @@ -262,6 +264,16 @@ public class ImportOrderCheck */ private ImportOrderOption option = ImportOrderOption.UNDER; + /** + * Complied array of patterns for property {@code groups}. + */ + private Pattern[] groupsReg = EMPTY_PATTERN_ARRAY; + + /** + * Complied array of patterns for property {@code staticGroups}. + */ + private Pattern[] staticGroupsReg = EMPTY_PATTERN_ARRAY; + /** * Setter to specify policy on the relative order between type imports and static imports. * @@ -284,7 +296,8 @@ public void setOption(String optionStr) { * @since 3.2 */ public void setGroups(String... packageGroups) { - groups = compilePatterns(packageGroups); + groups = UnmodifiableCollectionUtil.copyOfArray(packageGroups, packageGroups.length); + groupsReg = compilePatterns(packageGroups); } /** @@ -299,7 +312,8 @@ public void setGroups(String... packageGroups) { * @since 8.12 */ public void setStaticGroups(String... packageGroups) { - staticGroups = compilePatterns(packageGroups); + staticGroups = UnmodifiableCollectionUtil.copyOfArray(packageGroups, packageGroups.length); + staticGroupsReg = compilePatterns(packageGroups); } /** @@ -662,10 +676,10 @@ private static String getImportContainer(String qualifiedImportName) { private int getGroupNumber(boolean isStatic, String name) { final Pattern[] patterns; if (isStatic) { - patterns = staticGroups; + patterns = staticGroupsReg; } else { - patterns = groups; + patterns = groupsReg; } int number = getGroupNumber(patterns, name); diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderOption.java index 2dc21daf025..f652aa8fd5a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderOption.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/MismatchStrategy.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/MismatchStrategy.java index bfb20f31dd8..d309d3116ea 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/MismatchStrategy.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/MismatchStrategy.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java index ed9a09f6961..1e3fd3cd616 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportControl.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -29,13 +29,13 @@ * be a sub-package, a class, or an allow/disallow rule. */ class PkgImportControl extends AbstractImportControl { - /** The package separator: "." */ + /** The package separator: ".". */ private static final String DOT = "."; /** The regex for the package separator: "\\.". */ private static final String DOT_REGEX = "\\."; - /** A pattern matching the package separator: "\." */ + /** A pattern matching the package separator: "\.". */ private static final Pattern DOT_REGEX_PATTERN = Pattern.compile(DOT_REGEX); /** The regex for the escaped package separator: "\\\\.". */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.java index df1ac2e926d..89459435d62 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/PkgImportRule.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java index 6d1bffa61a1..6492b236d76 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/RedundantImportCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java index 50e164e7b3f..862c4af2405 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -58,6 +58,10 @@ * The class imported is from the same package. *
        • *
        • + * A static method is imported when used as method reference. In that case, + * only the type needs to be imported and that's enough to resolve the method. + *
        • + *
        • * Optionally: it is referenced in Javadoc comments. This check is on by * default, but it is considered bad practice to introduce a compile-time * dependency for documentation purposes only. As an example, the import @@ -256,21 +260,35 @@ private void processIdent(DetailAST ast) { final DetailAST parent = ast.getParent(); final int parentType = parent.getType(); - final boolean isPossibleDotClassOrInMethod = parentType == TokenTypes.DOT - || parentType == TokenTypes.METHOD_DEF; - - final boolean isQualifiedIdent = parentType == TokenTypes.DOT - && !TokenUtil.isOfType(ast.getPreviousSibling(), TokenTypes.DOT) - && ast.getNextSibling() != null; + final boolean isClassOrMethod = parentType == TokenTypes.DOT + || parentType == TokenTypes.METHOD_DEF || parentType == TokenTypes.METHOD_REF; if (TokenUtil.isTypeDeclaration(parentType)) { currentFrame.addDeclaredType(ast.getText()); } - else if (!isPossibleDotClassOrInMethod || isQualifiedIdent) { + else if (!isClassOrMethod || isQualifiedIdentifier(ast)) { currentFrame.addReferencedType(ast.getText()); } } + /** + * Checks whether ast is a fully qualified identifier. + * + * @param ast to check + * @return true if given ast is a fully qualified identifier + */ + private static boolean isQualifiedIdentifier(DetailAST ast) { + final DetailAST parent = ast.getParent(); + final int parentType = parent.getType(); + + final boolean isQualifiedIdent = parentType == TokenTypes.DOT + && !TokenUtil.isOfType(ast.getPreviousSibling(), TokenTypes.DOT) + && ast.getNextSibling() != null; + final boolean isQualifiedIdentFromMethodRef = parentType == TokenTypes.METHOD_REF + && ast.getNextSibling() != null; + return isQualifiedIdent || isQualifiedIdentFromMethodRef; + } + /** * Collects the details of imports. * diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/package-info.java index 2fe14f94523..4731b0e5421 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java index 0880befefad..fde840aa6bc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AbstractExpressionHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.java index 96353a480f8..b84e7d0f135 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/AnnotationArrayInitHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java index 01f6654f32b..1087e76eeea 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ArrayInitHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java index 8fda9cbab22..12e33bfa5aa 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/BlockParentHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java index d44e86f1fc3..50717007a2f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CaseHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java index d43587765f4..5ba44deba87 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CatchHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java index 2aacaebd574..d299b06a274 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ClassDefHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java index 7cdc587c294..90a40d25615 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/CommentsIndentationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -35,7 +35,7 @@ * Controls the indentation between comments and surrounding code. * Comments are indented at the same level as the surrounding code. * Detailed info about such convention can be found - * + * * here *

          *
            diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DetailAstSet.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DetailAstSet.java index e9e71b447b3..35875457bbb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DetailAstSet.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DetailAstSet.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java index 2a14d95c987..a749d98f553 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/DoWhileHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java index 4ecf800fc49..7046e69d5a6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ElseHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java index 0432c82e9d8..d2ec9fb360b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/FinallyHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java index 729a2162abd..bc1881f6a48 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ForHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java index 903c197fdff..c482852a99e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/HandlerFactory.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java index 5839baabc00..41db9baaafb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IfHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java index 6db1d5263c6..2a207984fc3 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ImportHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java index aea6cd32351..db1d9ee284a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentLevel.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java index f6bbea4ba65..4fb8293e9d5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndentationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -68,6 +68,12 @@ * *
              *
            • + * Property {@code arrayInitIndent} - Specify how far an array initialization + * should be indented when on next line. + * Type is {@code int}. + * Default value is {@code 4}. + *
            • + *
            • * Property {@code basicOffset} - Specify how far new indentation level should be * indented when on the next line. * Type is {@code int}. @@ -86,16 +92,12 @@ * Default value is {@code 4}. *
            • *
            • - * Property {@code throwsIndent} - Specify how far a throws clause should be - * indented when on next line. - * Type is {@code int}. - * Default value is {@code 4}. - *
            • - *
            • - * Property {@code arrayInitIndent} - Specify how far an array initialisation - * should be indented when on next line. - * Type is {@code int}. - * Default value is {@code 4}. + * Property {@code forceStrictCondition} - Force strict indent level in line + * wrapping case. If value is true, line wrap indent have to be same as + * lineWrappingIndentation parameter. If value is false, line wrap indent + * could be bigger on any value user would like. + * Type is {@code boolean}. + * Default value is {@code false}. *
            • *
            • * Property {@code lineWrappingIndentation} - Specify how far continuation line @@ -104,12 +106,10 @@ * Default value is {@code 4}. *
            • *
            • - * Property {@code forceStrictCondition} - Force strict indent level in line - * wrapping case. If value is true, line wrap indent have to be same as - * lineWrappingIndentation parameter. If value is false, line wrap indent - * could be bigger on any value user would like. - * Type is {@code boolean}. - * Default value is {@code false}. + * Property {@code throwsIndent} - Specify how far a throws clause should be + * indented when on next line. + * Type is {@code int}. + * Default value is {@code 4}. *
            • *
            *

            @@ -222,7 +222,7 @@ public class IndentationCheck extends AbstractCheck { /** Specify how far a throws clause should be indented when on next line. */ private int throwsIndent = DEFAULT_INDENTATION; - /** Specify how far an array initialisation should be indented when on next line. */ + /** Specify how far an array initialization should be indented when on next line. */ private int arrayInitIndent = DEFAULT_INDENTATION; /** Specify how far continuation line should be indented when line-wrapping is present. */ @@ -335,9 +335,9 @@ public int getThrowsIndent() { } /** - * Setter to specify how far an array initialisation should be indented when on next line. + * Setter to specify how far an array initialization should be indented when on next line. * - * @param arrayInitIndent the array initialisation indentation level + * @param arrayInitIndent the array initialization indentation level * @since 5.8 */ public void setArrayInitIndent(int arrayInitIndent) { @@ -345,9 +345,9 @@ public void setArrayInitIndent(int arrayInitIndent) { } /** - * Getter to query how far an array initialisation should be indented when on next line. + * Getter to query how far an array initialization should be indented when on next line. * - * @return the initialisation indentation level + * @return the initialization indentation level */ public int getArrayInitIndent() { return arrayInitIndent; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java index c3341ca3151..b1372f9c70c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/IndexHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java index 748d96c3fdc..b4a22dad7a5 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LabelHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java index 80e73ad1d93..422ebe7d395 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LambdaHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java index 25c935242e3..fbca8742708 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/LineWrappingHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -81,6 +81,7 @@ public static LineWrappingOptions ofBoolean(boolean val) { * @see CaseHandler#getIndentImpl() */ private static final int[] IGNORED_LIST = { + TokenTypes.LCURLY, TokenTypes.RCURLY, TokenTypes.LITERAL_NEW, TokenTypes.ARRAY_INIT, diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java index 7de98ff70b7..c9cf977756a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MemberDefHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,6 +19,8 @@ package com.puppycrawl.tools.checkstyle.checks.indentation; +import java.util.Optional; + import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; @@ -51,13 +53,30 @@ public void checkIndentation() { checkType(); } final DetailAST firstNode = getMainAst(); - final DetailAST lastNode = getVarDefStatementSemicolon(firstNode); + final DetailAST lastNode = getArrayInitNode(firstNode) + .orElseGet(() -> getVarDefStatementSemicolon(firstNode)); - if (lastNode != null && !isArrayDeclaration(firstNode)) { + if (lastNode != null) { checkWrappingIndentation(firstNode, lastNode); } } + /** + * Finds the array init node. + * + * @param firstNode Node to begin searching + * @return array init node + */ + private static Optional getArrayInitNode(DetailAST firstNode) { + return Optional.ofNullable(firstNode.findFirstToken(TokenTypes.ASSIGN)) + .map(assign -> { + return Optional.ofNullable(assign.findFirstToken(TokenTypes.EXPR)) + .map(expr -> expr.findFirstToken(TokenTypes.LITERAL_NEW)) + .orElse(assign); + }) + .map(node -> node.findFirstToken(TokenTypes.ARRAY_INIT)); + } + @Override public IndentLevel getSuggestedChildIndent(AbstractExpressionHandler child) { return getIndent(); @@ -84,17 +103,6 @@ private void checkType() { } } - /** - * Checks if variable_def node is array declaration. - * - * @param variableDef current variable_def. - * @return true if variable_def node is array declaration. - */ - private static boolean isArrayDeclaration(DetailAST variableDef) { - return variableDef.findFirstToken(TokenTypes.TYPE) - .findFirstToken(TokenTypes.ARRAY_DECLARATOR) != null; - } - /** * Returns semicolon for variable definition statement. * diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java index bcbaf129183..f56d1e33599 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodCallHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java index 99ac7afec7b..629b111c9d3 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/MethodDefHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java index eb786c88fb0..1766763186d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/NewHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java index 76e67779ab4..f7b6db80b07 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/ObjectBlockHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java index b9f9693e0e8..0bfefbaf270 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PackageDefHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java index e05959e623b..1f41799153e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/PrimordialHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java index 5c730cbbbc0..140492abe5a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SlistHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java index 2145ba4a2f9..8b03fa6c0ec 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/StaticInitHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java index 010377e858e..dd8cc459f2b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchRuleHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchRuleHandler.java index f2d4cc28f38..95a7cf51e2b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchRuleHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SwitchRuleHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SynchronizedHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SynchronizedHandler.java index 9f37e88e210..5be7a15f65e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SynchronizedHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/SynchronizedHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java index 7eae8945c78..730eba8eab8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/TryHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java index 66d0be4dbf8..94484745789 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/WhileHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/YieldHandler.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/YieldHandler.java index 1454eb1af4c..9808bd0c73e 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/YieldHandler.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/YieldHandler.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/package-info.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/package-info.java index e3bbfc65963..ce568eb4e52 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/package-info.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/indentation/package-info.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java index f0f18a63fbe..f0cad7474c8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AbstractJavadocCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -22,6 +22,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; @@ -71,6 +72,12 @@ public abstract class AbstractJavadocCheck extends AbstractCheck { public static final String MSG_JAVADOC_PARSE_RULE_ERROR = JavadocDetailNodeParser.MSG_JAVADOC_PARSE_RULE_ERROR; + /** + * Message key of error message. + */ + public static final String MSG_KEY_UNCLOSED_HTML_TAG = + JavadocDetailNodeParser.MSG_UNCLOSED_HTML_TAG; + /** * Key is "line:column". Value is {@link DetailNode} tree. Map is stored in {@link ThreadLocal} * to guarantee basic thread safety and avoid shared, mutable state when not necessary. @@ -166,6 +173,7 @@ public boolean acceptJavadocWithNonTightHtml() { * Tight-HTML Rules. * * @param shouldReportViolation value to which the field shall be set to + * @since 8.3 */ public final void setViolateExecutionOnNonTightHtml(boolean shouldReportViolation) { violateExecutionOnNonTightHtml = shouldReportViolation; @@ -187,7 +195,8 @@ public void init() { validateDefaultJavadocTokens(); if (javadocTokens.isEmpty()) { javadocTokens.addAll( - Arrays.stream(getDefaultJavadocTokens()).boxed().collect(Collectors.toList())); + Arrays.stream(getDefaultJavadocTokens()).boxed() + .collect(Collectors.toUnmodifiableList())); } else { final int[] acceptableJavadocTokens = getAcceptableJavadocTokens(); @@ -209,19 +218,25 @@ public void init() { * @throws IllegalStateException when validation of default javadoc tokens fails */ private void validateDefaultJavadocTokens() { - if (getRequiredJavadocTokens().length != 0) { - final int[] defaultJavadocTokens = getDefaultJavadocTokens(); - Arrays.sort(defaultJavadocTokens); - for (final int javadocToken : getRequiredJavadocTokens()) { - if (Arrays.binarySearch(defaultJavadocTokens, javadocToken) < 0) { - final String message = String.format(Locale.ROOT, - "Javadoc Token \"%s\" from required javadoc " - + "tokens was not found in default " - + "javadoc tokens list in check %s", - javadocToken, getClass().getName()); - throw new IllegalStateException(message); - } - } + final Set defaultTokens = Arrays.stream(getDefaultJavadocTokens()) + .boxed() + .collect(Collectors.toUnmodifiableSet()); + + final List missingRequiredTokenNames = Arrays.stream(getRequiredJavadocTokens()) + .boxed() + .filter(token -> !defaultTokens.contains(token)) + .collect(Collectors.toUnmodifiableList()); + + if (!missingRequiredTokenNames.isEmpty()) { + final String message = String.format(Locale.ROOT, + "Javadoc Token \"%s\" from required javadoc " + + "tokens was not found in default " + + "javadoc tokens list in check %s", + missingRequiredTokenNames.stream() + .map(String::valueOf) + .collect(Collectors.joining(", ")), + getClass().getName()); + throw new IllegalStateException(message); } } @@ -319,7 +334,7 @@ public final void visitToken(DetailAST blockCommentNode) { if (violateExecutionOnNonTightHtml && result.isNonTight()) { log(result.getFirstNonTightHtmlTag().getLine(), - JavadocDetailNodeParser.MSG_UNCLOSED_HTML_TAG, + MSG_KEY_UNCLOSED_HTML_TAG, result.getFirstNonTightHtmlTag().getText()); } } @@ -374,11 +389,9 @@ private void walk(DetailNode root) { } toVisit = JavadocUtil.getNextSibling(curNode); - if (toVisit == null) { - curNode = curNode.getParent(); - if (curNode != null) { - waitsForProcessing = shouldBeProcessed(curNode); - } + curNode = curNode.getParent(); + if (curNode != null) { + waitsForProcessing = shouldBeProcessed(curNode); } } curNode = toVisit; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java index a8f33a6208a..f430bbdb48f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/AtclauseOrderCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -45,11 +45,10 @@ * *

              *
            • - * Property {@code violateExecutionOnNonTightHtml} - Control when to print violations if the - * Javadoc being examined by this check violates the tight html rules defined at - * Tight-HTML Rules. - * Type is {@code boolean}. - * Default value is {@code false}. + * Property {@code tagOrder} - Specify the order by tags. + * Type is {@code java.lang.String[]}. + * Default value is + * {@code @author, @deprecated, @exception, @param, @return, @see, @serial, @serialData, @serialField, @since, @throws, @version}. *
            • *
            • * Property {@code target} - Specify block tags targeted. @@ -74,10 +73,11 @@ * VARIABLE_DEF. *
            • *
            • - * Property {@code tagOrder} - Specify the order by tags. - * Type is {@code java.lang.String[]}. - * Default value is - * {@code @author, @deprecated, @exception, @param, @return, @see, @serial, @serialData, @serialField, @since, @throws, @version}. + * Property {@code violateExecutionOnNonTightHtml} - Control when to print violations if the + * Javadoc being examined by this check violates the tight html rules defined at + * Tight-HTML Rules. + * Type is {@code boolean}. + * Default value is {@code false}. *
            • *
            *

            @@ -97,6 +97,9 @@ * {@code javadoc.parse.rule.error} * *

          • + * {@code javadoc.unclosedHtml} + *
          • + *
          • * {@code javadoc.wrong.singleton.html.tag} *
          • *
          diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java index 7eba5e67ea3..b2cdd17807d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/HtmlTag.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheck.java index f6a69830bd0..65fe749cfb8 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocPositionCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocTag.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocTag.java index 9439047a231..56d2749bdbd 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocTag.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/InvalidJavadocTag.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java index e59c7d8d62a..d9426555c5b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocBlockTagLocationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -88,6 +88,9 @@ * {@code javadoc.parse.rule.error} *
        • *
        • + * {@code javadoc.unclosedHtml} + *
        • + *
        • * {@code javadoc.wrong.singleton.html.tag} *
        • *
        @@ -149,7 +152,7 @@ public JavadocBlockTagLocationCheck() { * @since 8.24 */ public final void setTags(String... values) { - tags = Arrays.stream(values).collect(Collectors.toSet()); + tags = Arrays.stream(values).collect(Collectors.toUnmodifiableSet()); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheck.java index 9e4c47cd45a..808bd5f7306 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationOption.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationOption.java index b0bf56e34d6..efdc52c5137 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationOption.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocContentLocationOption.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java new file mode 100644 index 00000000000..f0cc017ab44 --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocLeadingAsteriskAlignCheck.java @@ -0,0 +1,235 @@ +/////////////////////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code and other text files for adherence to a set of rules. +// Copyright (C) 2001-2024 the original author or authors. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +/////////////////////////////////////////////////////////////////////////////////////////////// + +package com.puppycrawl.tools.checkstyle.checks.javadoc; + +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.puppycrawl.tools.checkstyle.GlobalStatefulCheck; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.DetailNode; +import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; +import com.puppycrawl.tools.checkstyle.utils.CommonUtil; + +/** + *

        + * Checks the alignment of + * + * leading asterisks in a Javadoc comment. The Check ensures that leading asterisks + * are aligned vertically under the first asterisk ( * ) + * of opening Javadoc tag. The alignment of closing Javadoc tag ( */ ) is also checked. + * If a closing Javadoc tag contains non-whitespace character before it + * then it's alignment will be ignored. + * If the ending javadoc line contains a leading asterisk, then that leading asterisk's alignment + * will be considered, the closing Javadoc tag will be ignored. + *

        + *

        + * If you're using tabs then specify the the tab width in the + * tabWidth property. + *

        + *
          + *
        • + * Property {@code violateExecutionOnNonTightHtml} - Control when to print violations if the + * Javadoc being examined by this check violates the tight html rules defined at + * Tight-HTML Rules. + * Type is {@code boolean}. + * Default value is {@code false}. + *
        • + *
        + *

        + * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} + *

        + *

        + * Violation Message Keys: + *

        + *
          + *
        • + * {@code javadoc.asterisk.indentation} + *
        • + *
        • + * {@code javadoc.missed.html.close} + *
        • + *
        • + * {@code javadoc.parse.rule.error} + *
        • + *
        • + * {@code javadoc.unclosedHtml} + *
        • + *
        • + * {@code javadoc.wrong.singleton.html.tag} + *
        • + *
        + * + * @since 10.18.0 + */ +@GlobalStatefulCheck +public class JavadocLeadingAsteriskAlignCheck extends AbstractJavadocCheck { + + /** + * A key is pointing to the warning message text in "messages.properties" + * file. + */ + public static final String MSG_KEY = "javadoc.asterisk.indentation"; + + /** Specifies the line number of starting block of the javadoc comment. */ + private int javadocStartLineNumber; + + /** Specifies the column number of starting block of the javadoc comment with tabs expanded. */ + private int expectedColumnNumberTabsExpanded; + + /** + * Specifies the column number of the leading asterisk + * without tabs expanded. + */ + private int expectedColumnNumberWithoutExpandedTabs; + + /** Specifies the lines of the file being processed. */ + private String[] fileLines; + + @Override + public int[] getDefaultJavadocTokens() { + return new int[] { + JavadocTokenTypes.LEADING_ASTERISK, + }; + } + + @Override + public int[] getRequiredJavadocTokens() { + return getAcceptableJavadocTokens(); + } + + @Override + public void beginJavadocTree(DetailNode rootAst) { + // this method processes and sets information of starting javadoc tag. + fileLines = getLines(); + final String startLine = fileLines[rootAst.getLineNumber() - 1]; + javadocStartLineNumber = rootAst.getLineNumber(); + expectedColumnNumberTabsExpanded = CommonUtil.lengthExpandedTabs( + startLine, rootAst.getColumnNumber() - 1, getTabWidth()); + } + + @Override + public void visitJavadocToken(DetailNode ast) { + // this method checks the alignment of leading asterisks. + final boolean isJavadocStartingLine = ast.getLineNumber() == javadocStartLineNumber; + + if (!isJavadocStartingLine) { + final Optional leadingAsteriskColumnNumber = + getAsteriskColumnNumber(ast.getText()); + + leadingAsteriskColumnNumber + .map(columnNumber -> expandedTabs(ast.getText(), columnNumber)) + .filter(columnNumber -> { + return !hasValidAlignment(expectedColumnNumberTabsExpanded, columnNumber); + }) + .ifPresent(columnNumber -> { + logViolation(ast.getLineNumber(), + columnNumber, + expectedColumnNumberTabsExpanded); + }); + } + } + + @Override + public void finishJavadocTree(DetailNode rootAst) { + // this method checks the alignment of closing javadoc tag. + final DetailAST javadocEndToken = getBlockCommentAst().getLastChild(); + final String lastLine = fileLines[javadocEndToken.getLineNo() - 1]; + final Optional endingBlockColumnNumber = getAsteriskColumnNumber(lastLine); + + endingBlockColumnNumber + .map(columnNumber -> expandedTabs(lastLine, columnNumber)) + .filter(columnNumber -> { + return !hasValidAlignment(expectedColumnNumberTabsExpanded, columnNumber); + }) + .ifPresent(columnNumber -> { + logViolation(javadocEndToken.getLineNo(), + columnNumber, + expectedColumnNumberTabsExpanded); + }); + } + + /** + * Processes and returns the column number of + * leading asterisk with tabs expanded. + * Also sets 'expectedColumnNumberWithoutExpandedTabs' if the leading asterisk is present. + * + * @param line javadoc comment line + * @param columnNumber column number of leading asterisk + * @return column number of leading asterisk with tabs expanded + */ + private int expandedTabs(String line, int columnNumber) { + expectedColumnNumberWithoutExpandedTabs = columnNumber - 1; + return CommonUtil.lengthExpandedTabs( + line, columnNumber, getTabWidth()); + } + + /** + * Processes and returns an OptionalInt containing + * the column number of leading asterisk without tabs expanded. + * + * @param line javadoc comment line + * @return asterisk's column number + */ + private static Optional getAsteriskColumnNumber(String line) { + final Pattern pattern = Pattern.compile("^(\\s*)\\*"); + final Matcher matcher = pattern.matcher(line); + + // We may not always have a leading asterisk because a javadoc line can start with + // a non-whitespace character or the javadoc line can be empty. + // In such cases, there is no leading asterisk and Optional will be empty. + return Optional.of(matcher) + .filter(Matcher::find) + .map(matcherInstance -> matcherInstance.group(1)) + .map(groupLength -> groupLength.length() + 1); + } + + /** + * Checks alignment of asterisks and logs violations. + * + * @param lineNumber line number of current comment line + * @param asteriskColNumber column number of leading asterisk + * @param expectedColNumber column number of javadoc starting token + */ + private void logViolation(int lineNumber, + int asteriskColNumber, + int expectedColNumber) { + + log(lineNumber, + expectedColumnNumberWithoutExpandedTabs, + MSG_KEY, + asteriskColNumber, + expectedColNumber); + } + + /** + * Checks the column difference between + * expected column number and leading asterisk column number. + * + * @param expectedColNumber column number of javadoc starting token + * @param asteriskColNumber column number of leading asterisk + * @return true if the asterisk is aligned properly, false otherwise + */ + private static boolean hasValidAlignment(int expectedColNumber, + int asteriskColNumber) { + return expectedColNumber - asteriskColNumber == 0; + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java index b879b1d0139..80553d98975 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -42,6 +42,7 @@ import com.puppycrawl.tools.checkstyle.utils.AnnotationUtil; import com.puppycrawl.tools.checkstyle.utils.CheckUtil; import com.puppycrawl.tools.checkstyle.utils.CommonUtil; +import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; /** *

        @@ -102,16 +103,6 @@ * *

          *
        • - * Property {@code allowedAnnotations} - Specify annotations that allow missed documentation. - * Type is {@code java.lang.String[]}. - * Default value is {@code Override}. - *
        • - *
        • - * Property {@code validateThrows} - Control whether to validate {@code throws} tags. - * Type is {@code boolean}. - * Default value is {@code false}. - *
        • - *
        • * Property {@code accessModifiers} - Specify the access modifiers where Javadoc comments are * checked. * Type is {@code com.puppycrawl.tools.checkstyle.checks.naming.AccessModifierOption[]}. @@ -130,6 +121,16 @@ * Default value is {@code false}. *
        • *
        • + * Property {@code allowedAnnotations} - Specify annotations that allow missed documentation. + * Type is {@code java.lang.String[]}. + * Default value is {@code Override}. + *
        • + *
        • + * Property {@code validateThrows} - Control whether to validate {@code throws} tags. + * Type is {@code boolean}. + * Default value is {@code false}. + *
        • + *
        • * Property {@code tokens} - tokens to check * Type is {@code java.lang.String[]}. * Validation type is {@code tokenSet}. @@ -310,7 +311,7 @@ public void setAllowedAnnotations(String... userAnnotations) { */ public void setAccessModifiers(AccessModifierOption... accessModifiers) { this.accessModifiers = - Arrays.copyOf(accessModifiers, accessModifiers.length); + UnmodifiableCollectionUtil.copyOfArray(accessModifiers, accessModifiers.length); } /** @@ -519,8 +520,7 @@ else if (javadocNoargMatcher.find()) { tags.add(new JavadocTag(currentLine, col, javadocNoargMatcher.group(1))); } else if (noargCurlyMatcher.find()) { - final int col = calculateTagColumn(noargCurlyMatcher, i, startColumnNumber); - tags.add(new JavadocTag(currentLine, col, noargCurlyMatcher.group(1))); + tags.add(new JavadocTag(currentLine, 0, noargCurlyMatcher.group(1))); } else if (noargMultilineStart.find()) { tags.addAll(getMultilineNoArgTags(noargMultilineStart, lines, i, currentLine)); @@ -590,11 +590,9 @@ private static List getParameters(DetailAST ast) { DetailAST child = params.getFirstChild(); while (child != null) { - if (child.getType() == TokenTypes.PARAMETER_DEF) { - final DetailAST ident = child.findFirstToken(TokenTypes.IDENT); - if (ident != null) { - returnValue.add(ident); - } + final DetailAST ident = child.findFirstToken(TokenTypes.IDENT); + if (ident != null) { + returnValue.add(ident); } child = child.getNextSibling(); } @@ -686,14 +684,13 @@ private static DetailAST getFirstClassNameNode(DetailAST ast) { * @return true if throwAst is inside a block that should be ignored */ private static boolean isInIgnoreBlock(DetailAST methodBodyAst, DetailAST throwAst) { - DetailAST ancestor = throwAst.getParent(); + DetailAST ancestor = throwAst; while (ancestor != methodBodyAst) { - if (ancestor.getType() == TokenTypes.LITERAL_TRY - && ancestor.findFirstToken(TokenTypes.LITERAL_CATCH) != null - || ancestor.getType() == TokenTypes.LAMBDA - || ancestor.getType() == TokenTypes.OBJBLOCK) { - // throw is inside a try block, and there is a catch block, - // or throw is inside a lambda expression/anonymous class/local class + if (ancestor.getType() == TokenTypes.LAMBDA + || ancestor.getType() == TokenTypes.OBJBLOCK + || ancestor.findFirstToken(TokenTypes.LITERAL_CATCH) != null) { + // throw is inside a lambda expression/anonymous class/local class, + // or throw is inside a try block, and there is a catch block break; } if (ancestor.getType() == TokenTypes.LITERAL_CATCH diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.java index f9556620b9e..80a31b8f545 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingLeadingAsteriskCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -62,6 +62,9 @@ * {@code javadoc.parse.rule.error} *
        • *
        • + * {@code javadoc.unclosedHtml} + *
        • + *
        • * {@code javadoc.wrong.singleton.html.tag} *
        • *
        @@ -150,8 +153,7 @@ private static boolean isLeadingAsterisk(DetailNode detailNode) { */ private static boolean isLastLine(DetailNode detailNode) { final DetailNode node; - if (detailNode.getType() == JavadocTokenTypes.TEXT - && CommonUtil.isBlank(detailNode.getText())) { + if (CommonUtil.isBlank(detailNode.getText())) { node = getNextNode(detailNode); } else { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.java index 1aa0368fb05..f9fa38c1e07 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMissingWhitespaceAfterAsteriskCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -57,6 +57,9 @@ * {@code javadoc.parse.rule.error} * *
      • + * {@code javadoc.unclosedHtml} + *
      • + *
      • * {@code javadoc.wrong.singleton.html.tag} *
      • *
      diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.java index fd90c42594d..6dd9645aecb 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocNodeImpl.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -19,12 +19,12 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; -import java.util.Arrays; import java.util.Objects; import java.util.Optional; import com.puppycrawl.tools.checkstyle.api.DetailNode; import com.puppycrawl.tools.checkstyle.utils.JavadocUtil; +import com.puppycrawl.tools.checkstyle.utils.UnmodifiableCollectionUtil; /** * Implementation of DetailNode interface that is mutable. @@ -95,7 +95,7 @@ public int getColumnNumber() { @Override public DetailNode[] getChildren() { return Optional.ofNullable(children) - .map(array -> Arrays.copyOf(array, array.length)) + .map(array -> UnmodifiableCollectionUtil.copyOfArray(array, array.length)) .orElse(EMPTY_DETAIL_NODE_ARRAY); } @@ -151,7 +151,7 @@ public void setColumnNumber(int columnNumber) { * @param children Array of child nodes. */ public void setChildren(DetailNode... children) { - this.children = Arrays.copyOf(children, children.length); + this.children = UnmodifiableCollectionUtil.copyOfArray(children, children.length); } /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java index 4394962cc81..31ff52d0324 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocPackageCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -45,7 +45,7 @@ * Default value is {@code false}. * *
    • - * Property {@code fileExtensions} - Specify the file type extension of files to process. + * Property {@code fileExtensions} - Specify the file extensions of the files to process. * Type is {@code java.lang.String[]}. * Default value is {@code .java}. *
    • diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java index 1c62d765f13..c81839bd297 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -39,6 +39,12 @@ *
    * *

    * Parent is {@code com.puppycrawl.tools.checkstyle.TreeWalker} @@ -79,6 +79,9 @@ * {@code javadoc.parse.rule.error} *

  • *
  • + * {@code javadoc.unclosedHtml} + *
  • + *
  • * {@code javadoc.wrong.singleton.html.tag} *
  • *
@@ -249,7 +252,7 @@ private static boolean isFirstParagraph(DetailNode paragraphTag) { * @return Some nearest empty line in javadoc. */ private static DetailNode getNearestEmptyLine(DetailNode node) { - DetailNode newLine = JavadocUtil.getPreviousSibling(node); + DetailNode newLine = node; while (newLine != null) { final DetailNode previousSibling = JavadocUtil.getPreviousSibling(newLine); if (newLine.getType() == JavadocTokenTypes.NEWLINE && isEmptyLine(newLine)) { diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java index a36e184f3a3..3349075c1a0 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////// // checkstyle: Checks Java source code and other text files for adherence to a set of rules. -// Copyright (C) 2001-2023 the original author or authors. +// Copyright (C) 2001-2024 the original author or authors. // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -20,10 +20,12 @@ package com.puppycrawl.tools.checkstyle.checks.javadoc; import java.util.ArrayDeque; +import java.util.Arrays; import java.util.Deque; import java.util.List; import java.util.Locale; import java.util.Set; +import java.util.regex.Matcher; import java.util.regex.Pattern; import com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser; @@ -49,6 +51,9 @@ *
  • * Ensures the first sentence ends with proper punctuation * (That is a period, question mark, or exclamation mark, by default). + * Note that this check is not applied to inline {@code @return} tags, + * because the Javadoc tools automatically appends a period to the end of the tag + * content. * Javadoc automatically places the first sentence in the method summary * table and index. Without proper punctuation the Javadoc may be malformed. * All items eligible for the {@code {@inheritDoc}} tag are exempt from this @@ -85,15 +90,10 @@ *

    *